Just wondering if anyone else is using Piwigo on Lighttpd instead of Apache. I run my web gallery from home and have been testing Lighttpd for some time. So far I've run into no issues whatsoever with Piwigo and performance and resource usage is very impressive. I've managed Apache servers for a long time, but I've got to say I'm really impressed with the simplicity of Lighttpd. I'm not saying it's better than Apache, just another very good option that I think is definitely worth consideration.
I'm using fastcgi w/ PHP, and I'm also using a gzip compression module with Lighttpd to compress outgoing files such as css, html, etc., and I'm using php's built in compression capabilities to compress php files. I've also been tweaking mysql a bit but that hasn't made as big a difference as the other options for my low traffic site which would definitely be bandwidth limited before I hit any other bottlenecks.
Just curious about other people's configs if they are running on hosts that they manage themselves. I'm still running the same install of Piwigo, being served in parallel via Apache. I'm tweaking that quite a bit too. I have compression enabled there also, but I haven't gotten around to switching to fastcgi and the worker MPM yet. At home I always used the worker MPM with mod_php but I keep hearing how php is not threadsafe and the only recommended configuration with Apache is to use fastcgi. I never had any problems with mod_php and the worker mpm, but I went back to the default prefork mpm on the apache server I"m running now. I intend to go back to the worker mpm as soon as I get my fastcgi config worked out for Apache.
I'm also considering something like xcache for lighttpd or eaccelerator, both php optimizers/accelerators. I'd also be interested if anyone is using either of these, or anything similar, with Piwigo.
Edited this last line because after further testing I decided to move my whole production site to lighttpd. If you read this previously when I had my lighttpd setup using port 81, that's no longer the case. I'll now do my apache testing on port 81 and lighttpd is using the default port 80. I did get fastcgi working with apache (more work than getting it going with lighttpd), and I still like the lighttpd simplicity, performance, and resource usage much better.
Last edited by rbr28 (2010-12-04 02:46:30)
Thank you for this feedback about Lighttpd with Piwigo.
I've always used Apache. In the past, I've reached the memory limits on a virtual server and I really wondered if it was time to switch to Lighttpd when someone told me to look at Nginx before.
So far, I haven't made any serious test with Nginx or Lighttpd but I'm really interested in other users feedback.
rbr38, do you have an idea of how much you reduced your memory usage with Lighttpd compared to Apache?
Even if I did some purely objective benchmarking I'm not sure I could answer that question because the configurations I've used in all cases are so drastically different. I've changed my apache configuration constantly, but in every case the configuration and functionality has been very different than my lighttpd configuration. Just using fastcgi w/ lighttpd, but not using it yet with apache skews things a bit. I have several php-cgi process waiting w/ my lighttpd configuration, whereas with my apache configuration, mod_php is reflected in the size of my apache processes.
When I'm watching processes, my apache processes are running using anywhere from 5.7MB to 15MB of memory each (private memory). Since I'm using the prefork MPM, with my low-traffic configuration I only keep a minimum of 5 spare servers forked, but it's pretty obvious that this setup doesn't scale well.
With lighttpd, I only have two processes running with my current configuration. One is lighttpd and one is lighttpd-angel. I won't explain what the angel process is as there's a full page document that explains it if you google it. Anyway the lighttpd process runs about .9MB and the angel runs about .1MB . Lighttpd has loadable has a few loadable modules similar to apache, and I'm using four of the optional modules. A big difference here is that I'm using fastcgi so php processing is separated out. My fastcgi configuration has 8 processes at 1.7MB each. This is configurable and there are docs that explain how to calculate how many processes you should run to accomodate your estimated load.
So, my disclaimer is that I could certainly reduce the memory usage of Apache as there are still a few modules I'm loading that I probably really don't need. I also plan to do more testing with the worker mpm and fastcgi on apache and although I've run the worker mpm before I can't recall what my memory usage looked like with that. I'm not saying my apache configuration is optimal, but it was absolutely trivial to get my lighttpd configuration to a level of memory usage far below what my 'typical' apache conifguration uses. I have a lot of apache modules loaded, but there are a lot that I have not loaded such as all the webdav modules. There's a lot of functionality that my somewhat stripped down Apache configuration has that lighttpd does not, but none of it is anything that is required for even desirable for Piwigo, it's just functionality that I might use for other parts of my website.
I expect to move to move my main site to lighttpd very soon. I think as soon as I decide on the php acclerator and test that I'll make the switch.
Another thing I have thought about is that you could potentially serve different parts of your sight from apache and lighttpd if there was some advantage to that. I haven't considered this seriously enough to investigate what kind of scenario would benefit from this. Maybe if you had some specific part of your site that needed obscure functionality, you could use apache to serve that part, and then use lighttpd for everything else.
One other thing that's nice...my lighttpd configuration is a single file currently at 22 lines. Speed, simplicity, minimal resource usage...I'm liking it a lot!
I've now added the alternative PHP cache (APC) to my configuration. My site sees so little traffic that I can't really offer any benchmarks yet, but below there's a link to a good comparison of the caches. These benchmarks show all three caches (xcache, eaccelerator, and apc) to speed things up about 3x. Other tests I have seen show anywhere from a 1x-5x performance improvement. I'm going to try the other caches just for comparisons sake, and to assure that if I end up seeing any stability, performance, or compatibility issues with apc, I can try switching to one of the others. I only went with apc because it was so simple to setup, performance was about as good as the others, and it's supported by the php developers and should track php version updates very closely. Supposedly the apc cache is going to be included in php6. I will say that with all the optimizations I have done so far...lighttpd, gzip compression, fastcgi, and apc cache, it's amazing to see how fast my pages load. Haven't had any problems with Piwigo on this setup yet.
PHP APC cache info:
You'll probably have to look elsewhere for details on how to set this up initially on your distro. On my distro it was simply a matter of installing a package called php-apc, and changing one line in a config file to enable it. Then I just used the above link to get information about the ini options that I could configure but haven't messed with too much yet.
Just one comparison of the three most popular caches.
http://2bits.com/articles/benchmarking- … pared.html
Last edited by rbr28 (2010-12-03 22:01:06)
Just a status update on the lighttpd setup. After getting my setup working great on Arch Linux, I decided that I still preferred Gentoo and went back to 64 bit Gentoo for my main machine. I rebuilt the whole web environment on Gentoo very quickly and everything has been just as stable and fast. I enabled a lot more functionality and the config file is still incredibly small and easy to manage. I haven't even bothered to install Apache and I don't expect I'll have any reason to ever go back to it for my home setup. Anyway, I just wanted to provide an update to confirm that this setup was stable enough for me to switch permanently, and I'm not just running Piwigo, but also Drupal and a few other web applications on this setup.