8

Has anyone done any real performance comparison testing on RPi 3 on popular web servers:

  1. Apache2 -- the most prevalent server
  2. Nginx -- the server that claims to be best performer
  3. Lighttpd -- the most lightweight server
  4. Or a package I have not heard of

Something like this 4 year old post for the RPi 2. Following the advice in that post, I broadened my research more generally and found this article, but consider it slightly suspect as it's a hosting company, and I need an answer tailored to the hardware of the RPi 3.

  • 3
    Off Topic: I don't understand why someone down vote a question without giving a hint what is wrong with it. – Joe Platano Mar 25 '17 at 2:28
  • 1
    I am neither passive aggressive nor seeking for you to delete your question. I was too busy at the time to post a comment explaining my downvote. The first issue is you are prematurely optimizing. You have not clearly defined the use case (what modules/ functionality will be needed etc.). I could go on for several more paragraphs but I will let your own words speak for themselves: "If Nginx will do what I need, then it does seem to be a better out-of-the-box (or out-of-apt-get) solution to put together before the performance tweaks start." – Steve Robillard Mar 25 '17 at 20:50
  • 1
    If Nginx does will do what I need (so you may be able to rule out one or more of the servers based on requirements; hence making your question irrelevant. You are putting the cart before the horse. Get a system that works then worry about performance tweaking. Secondly, to answer your question will depend on the specific workload, will the use of the DB be read heavy or write heavy? will the system be DB bound or IO bound? If the DB no amount of tuning your webserver is likely to help. – Steve Robillard Mar 25 '17 at 20:55
  • 1
    Again quoting you "being able to serve them all something without a huge amount of lag is important." How much is too much lag? and Lastly "I've seen other posts on how to tweak Apache and Nginx for better performance but that seems like a lot of work just to build a test config to benchmark the options." Isn't this exactly what you are asking someone to do for you in this question? Without the benefit of real traffic data or a complete specification of the problem. Without these things they may as well consult a crystal ball. – Steve Robillard Mar 25 '17 at 20:59
  • Considering the memory footprint and processor limitations of the PI, wouldn't something like a node based setup along with express in a non-blocking IO event driven server be of more use? Again, depends on your use case. Are you serving static files or dynamic files. Is your pan to have a web application or a website. – CoderX May 28 '17 at 20:53
5

This should be a comment, but its a bit long.

While I've not (yet) tested out various webservers on my Pi, I have previously run a lot of testing on webservers running on x86 server hardware. What I know from there is:

  1. most people get confused about the difference between performance and capacity - you'll see lots of posts claiming nginx is faster than (pre-fork) apache, this is not true, except under heavy load. Nginx (and lighty) are both much better at capacity. And that's at the most trivial level of analysis.

  2. Few people serve up exclusively static content with their webservers (in this scenario, tux and G-Wan leave the servers you've mentioned in their dust). The performance profile is highly dependent on the logic tier technology and its integration with the webserver.

  3. The performance (and capacity) is dependent on everything else running on the device.

There are lots of features of a datacentre server which are very easy to live without if you have proper cluster level redundancy (dual psu, dual network, remote console...) however a Raspberry PI doesn't make the best sense as a web serving platform due to slow disk I/O - you really need something with SATA, [i]SCSI, AOE or infiniband connectivity to your storage. The Pi doesn't have a SATA interface, only has one ethernet port and I'm not aware of an infiniband or SCSI interface.

(there are small, single board computers which are a more sensible choice for building webserving capability on - and a cluster of these can make good economic sense, but in such a scenario you are looking at multiple nodes with layered capability for SSL termination, HTTP caching, webserving, application logic and data management).

The question of fastest is hard to define, different for each case and impossible to answer.

However the biggest mistake I see again and again in IT, is people picking products based on a single attribute rather than considering the wider impact both in terms of the technology and people involved.

  • Good points all. I fear this project has gotten back burnered. – Sandor Dosa May 28 '17 at 23:07
2

I fear you need to find out by your own. When i had this question for my RPi2, I stumbled over Siege and httperf. I followed this example to run the benchmarks - just instead of plain html pages i requested php files. There performance of the web server is also depending on the cgi modules you will choose. A plain vanilla lighttpd may be faster than a vanilla Apache. If you are choosing/configuring the CGI improper, this might be change and the Apache can outperform the Lighty.

  • I fear you are right. I'll start trying to sort out a testing method and report back. – Sandor Dosa Mar 25 '17 at 4:46
  • @SandorDosa, keep me up to date, pls – Joe Platano Mar 25 '17 at 7:16
2

I have chosen the lighttpd option, for the following reasons:

  1. lightweight
  2. one of the easiest to install
  3. runs on my RPi2 for the last two years without any problems (24x7)
  4. needed a good and simple to use as my test device

I use it as:

  1. monitor my system cpu temperature, ambient/room temperature and Humidity graph logger
  2. FTP server to exchange files with my business partners and avoid storing sensitive data on 3rd party free mail servers
  3. Many web widgets to check market index like forex, bonds, stocks, etc.
  4. test html code
  5. run a script I made to check for mail, since I have many mail accounts, avoiding geo tagging lockouts
  6. run a simple blog (Nibble blog)
  7. work as a honeypot to spot (and block) hackers on my wire

just to name a few uses.

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.