5

I'm starting over and want to maximize performance on a Pi to run node.js.

How can I do this? I only need SSH, Samba, and node.js and I want to know how the memory should be configured.

4
+50

A good way is to take a minimal image and bolt on the things you need your self.

This 118mb minimal image is hard float compiled so some computational methods should be allot faster and only takes up 14mb of ram after booted. It has a NTP server to stay in synch with time. Read the website on how to configure first boot as none of the extra heavy stuff is included as in the normal distribution.

Some considerations:

  • It would be best to take GPU ram to the lowest possible value.
  • Boot of the SD card but maybe attach a faster drive to USB, possibly SSD? or a nice 10k USB hdd with it own power. This will radically improve read and write performance.
    • If you do this then take care while adding any more USB devices, since the bandwidth will be shared across LAN, USB HDD and anything else.
  • Use nginx as your frontened web server with PHP CGI, it is extremely fast and much uses MUCH less resources than a'patch'me.
  • Over clocking sounds like a good idea but I wouldn't recommend it because it has caused me issues with networking.
  • Once you installed your packages,your scripts, an so forth, you can make your file system read only mount (protects from tampering, viruses and sometimes may benefit in performance increase),and mount your USB performance storage for RW, disable any updating services, and make use of RAMFS for temporary files. The size is up to you. You should assume once its configured, thats it.

Node.js is already highly optimized made to run as fast as you can provide the resources to make it run. Put it on a slow SD card and you will have poor response, communication with bulky MySQL or Apache pipes/PHP and it will be slow.

PS- Samba is really fat and consumes way too much resources for what SFTP (Included with OpenSSH) can do instead! Or NFS. I know, Windows users.. use FileZilla and create them accounts if you must, login using the address of your Pi, change port to 22 and viola. You are connected, securly and efficiently to the users home directory and with any permissions applied to the group.

| improve this answer | |
  • Since both SSH and SFTP are on port 22, is there a method to access SSH and SFTP at the same time? – shaun5 Apr 18 '14 at 0:11
  • Yea. Use Putty and Filezilla, you can open SFTP or SSH's as many times as you like (or limited to config file). – Piotr Kula Apr 21 '14 at 6:48
  • After trying the suggestions, there was no noticeable improvement in performance... – shaun5 May 16 '14 at 20:21
  • Please write more specifically what kind of performance issues you are having and how you benchmarked? – Piotr Kula May 16 '14 at 22:25
  • I am not experiencing any performance issues. I did a head to head test with the minimal installation and a regular distribution: there was no noticeable performance difference for my node.js application. – shaun5 Jun 4 '14 at 16:16
3

If your main focus is to enhance performance you can lower the allocated GPU memory, since you wont be doing graphical tasks.

To achieve this you must define the RAM available to 16MB by editing /boot/config.txt, and adding:

gpu_mem=16

This ain't the only possibility, but is a good one to start with.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.