View Full Version : Is Apache really bad for serving static content afterall?
kerplunk
Thu 20th Sep '07, 3:01pm
http://journal.paul.querna.org/articles/2005/06/24/debunking-lighttpd
We switched back to Apache (worker mpm) for serving static content (such as images and javascript) at the advice of our site developers. Images actually seem to load faster than with lighttpd... not to mention our loads are down.
We used lighttpd for quite some time and it was great, but I actually think I prefer Apache with worker MPM.
Try it :)
jason|xoxide
Thu 20th Sep '07, 3:26pm
No, httpd w/ the worker or event (experimental, doesn't work with mod_ssl) mpm is excellent at serving static files. It's the prefork mpm that does a poor job and chugs memory.
Personally, I'm waiting for lighttpd 1.5 before I do a comparison for static files.
kerplunk
Thu 20th Sep '07, 3:57pm
I have heard that event is an even faster MPM. Any drawbacks besides it being "experimental" as Apache says?
jason|xoxide
Thu 20th Sep '07, 4:03pm
According to the page for the event mpm, "At present, this MPM is incompatible with mod_ssl, and other input filters.". Beyond that, there is little I've seen published on the subject.
BamaStangGuy
Thu 20th Sep '07, 4:05pm
I've always thought it was odd, that out of all the huge boards on this site, no one has really got their feet wet with event or worker. I know you have to make sure that all your extensions are thread safe with worker (assume the same for event). It'd be nice to see benchmarks for running apache worker or event for both dynamic and static content.
jason|xoxide
Thu 20th Sep '07, 5:04pm
It's probably because most people don't compile httpd, php, etc. from source so switching to a thread-safe version of PHP is difficult.
kerplunk
Thu 20th Sep '07, 6:07pm
Our lead developer told me: "PHP pieces together so many libraries for so many things that it's dangerous to use a multi-threaded environment."
But for serving just images, I don't see how you could go wrong with event. ;) I really need to get the courage to just try it.
BamaStangGuy
Fri 21st Sep '07, 2:58am
Our lead developer told me: "PHP pieces together so many libraries for so many things that it's dangerous to use a multi-threaded environment."
But for serving just images, I don't see how you could go wrong with event. ;) I really need to get the courage to just try it.
It would be nice to have a list of thread safe php extensions so that we can determine if worker or event would be something feasible for our specific setup.
I too am curious how well lighttpd 1.5 does in comparison with apache.
In lighttpd's defense, that benchmark is very old.
jason|xoxide
Fri 21st Sep '07, 11:14am
Our lead developer told me: "PHP pieces together so many libraries for so many things that it's dangerous to use a multi-threaded environment."
But for serving just images, I don't see how you could go wrong with event. ;) I really need to get the courage to just try it.
Yeah, that's true. Most of the people I know who used httpd in worker mode ended up using PHP as FastCGI or reverse proxying dynamic content to a copy of httpd with the prefork mpm and PHP.
blue_asterisk
Mon 24th Sep '07, 2:45pm
Jason, are you using worker mpm for your static files? I'm currently using lighttpd (latest stable) for static files and apache for dynamic files.
In my experience, lighttpd is buggy for dynamic files, but works well for static files. Anybody try nginx?
jason|xoxide
Mon 24th Sep '07, 3:13pm
My forums are using httpd w/ prefork for dynamic content and the ones with 1M+ posts are using lighttpd for images. I'm also using lighttpd + FastCGI PHP for OpenAds.
blue_asterisk
Mon 24th Sep '07, 8:21pm
You can also use lighttpd for other static files such as js and css files; it works well for me.:D
OpenAds looks cool; never heard of it until now.
TECK
Mon 24th Sep '07, 9:10pm
IMO, lighty is way better then apache.. no matter how you turn it. Hell, the webhostingtalk gurus ran extensive comparison tests and compared lighty (32bits app) with a mighty apache (64bits). lighy beats apache hands down... as a single thread app.
Read this (http://www.webhostingtalk.com/showpost.php?p=4324806&postcount=8) and let me know what you think. :)
blue_asterisk
Tue 25th Sep '07, 12:08am
Like many things, it depends on your application. I put lighttpd into a production enviroment for testing and there were certainly quirky things about it. It was serving both dynamic and static content but people were complaining how slow it was; lighttpd was having problems with dynamic pages.
Apache isn't the fastest but it is much more stable and focused on correctness of results.
Lighttpd theoretically is better but from my experience it could only reliably serve static files and it did this very fast.
So what I do, like many others I would imagine, is have apache serve the dynamic pages [correctly] while have lighttpd serve the static files [fast] so lighttpd saves a lot more RAM to allow apache handle more page requests.
For vBulletin I find that over 70% of the files requested are static files so having lighttpd handle this is noticably more effective.
Do any of the bigboard admins run exclusively lighttpd or similar? If so, under what setup? When I tried lighttpd exclusively, some things were broken in vb.
BamaStangGuy
Tue 25th Sep '07, 2:37am
I manage about 6-7 decent sized forums (largest over 3 Million posts) that runs lightty exclusively.
It's got a monster server setup though. Using lightty 1.4.18 with the following:
Web Servers:
(2) Dual Quad Core with 8GB of ram and Raid 5 Setup using 15k SCSI Drives (Load Balanced)
Database Servers:
(2) Dual Quad Core with 8GB of ram and Raid 10 Setup using 15k SCSI Drivers (One master, one slave)
We also have an email server and file server which also act as two memcached servers.
It hasn't been a smooth ride with it but it hasn't been terrible. I would feel much better using the setup you suggested. Apache with Dynamic and Lightty with Static. I think it would fair much better.
blue_asterisk
Tue 25th Sep '07, 4:06am
I have 2 x Dual-Dual Xeon woodcrests, 8GB RAM, SAS raid. Are all of your forums running on those 4 machines? If they are all on those machines, how many posts do they sum up to?
What do you use the memcached servers for? I use memcached as a datastore, but never utilize past 16MB; it almost seems pointless for my setup.
Also, if you don't mind me asking, how are you doing regular database backups?
jason|xoxide
Tue 25th Sep '07, 11:15am
I have 2 x Dual-Dual Xeon woodcrests, 8GB RAM, SAS raid. Are all of your forums running on those 4 machines? If they are all on those machines, how many posts do they sum up to?
What do you use the memcached servers for? I use memcached as a datastore, but never utilize past 16MB; it almost seems pointless for my setup.
Also, if you don't mind me asking, how are you doing regular database backups?
I have not found memcache to offer any performance benefit over the other caching methods when only used for the datastore. I personally prefer the XCache datastore mod (created by the same person who wrote XCache) but even that isn't any faster than the file datastore + XCache with stat checking turned off (it is a bit faster if you leave stat turned on).
As to backups, my guess is that he does the same thing I do, make backups from the slave server where they don't block any queries (like they would on a master of single-server setup).
blue_asterisk
Tue 25th Sep '07, 2:11pm
Hi Jason,
Do you use memcached for something other than datastore?
For the slave server, do you run it as a second instance on the same machine or on another physical server?
Thank you all for answering my questions.
jason|xoxide
Tue 25th Sep '07, 2:47pm
Hi Jason,
Do you use memcached for something other than datastore?
For the slave server, do you run it as a second instance on the same machine or on another physical server?
Thank you all for answering my questions.
No, I never used memcached (on vBulletin) for anything but the datastore.
When I was using the slave server as a slave server it was on a separate server. When I started using it for backups only (to keep the queries from blocking as happens on the master) I moved it to the same box as the master but in a separate VE using OpenVZ.
BamaStangGuy
Tue 25th Sep '07, 10:26pm
I have 2 x Dual-Dual Xeon woodcrests, 8GB RAM, SAS raid. Are all of your forums running on those 4 machines? If they are all on those machines, how many posts do they sum up to?
Yea they are all on those 4 machines. Adds up to just under 6 million posts.
What do you use the memcached servers for? I use memcached as a datastore, but never utilize past 16MB; it almost seems pointless for my setup.
Datastore only right now. Looking forward to when vBulletin ads Template support for memcached.
Also, if you don't mind me asking, how are you doing regular database backups?
Via rsync
TECK
Mon 1st Oct '07, 11:17am
When I tried lighttpd exclusively, some things were broken in vb.
Lighty will not break anything in a web site, vBulletin related or not. The coder who wrote a plugin will for sure. I had this argument several times with clients, telling me that Lighttpd broke their forums (broken pipes, etc.). As soon as we disabled certain plugins, everything started to work as it should. Guys/Girls, please stop saying: Lighttpd broke my site. :)
TECK
Mon 1st Oct '07, 11:25am
No, I never used memcached (on vBulletin) for anything but the datastore.
IMO, that's the right usage, Jason. memcached for datastore, XCache for the rest of compiled PHP code. However, the problem with memcached is the lack of documentation. Honestly, I think I spent over 100 hours in documenting every hidden feature that memcached has, in order to build a custom RPM with the right configuration file.
Once you know its full power, you will be blown away by memcached's strength. Just so you know, the basic setup you find everywhere on the tutorial sites tap 10% of memcached's tweaking tools. Not to mention that the security is very weak when set with default options. In fact memcached has only ONE security feature, heh.
BamaStangGuy
Mon 1st Oct '07, 2:36pm
IMO, that's the right usage, Jason. memcached for datastore, XCache for the rest of compiled PHP code. However, the problem with memcached is the lack of documentation. Honestly, I think I spent over 100 hours in documenting every hidden feature that memcached has, in order to build a custom RPM with the right configuration file.
Once you know its full power, you will be blown away by memcached's strength. Just so you know, the basic setup you find everywhere on the tutorial sites tap 10% of memcached's tweaking tools. Not to mention that the security is very weak when set with default options. In fact memcached has only ONE security feature, heh.
One thing that annoys me is I can't figure out how to view what memcached has stored in it like I can with xcache.
ekool
Fri 26th Oct '07, 5:41pm
If you are just using an image server, I've not found anything superior to thttpd -- I would not want to take the necessary time to strip down an apache install for that purpose alone when thttpd works right out of the box.
chitchatter
Sun 6th Jan '08, 7:51pm
Looking forward to when vBulletin ads Template support for memcached.It is a 5 minute job. Do it yourself.
If you cannot figure it out, send me a pm and I will release it as a mod at .org. And believe me, it beats ALL the other template caching mechanisms hands down.
chitchatter
Sun 6th Jan '08, 7:52pm
IMO, that's the right usage, Jason. memcached for datastore, XCache for the rest of compiled PHP code. However, the problem with memcached is the lack of documentation. Honestly, I think I spent over 100 hours in documenting every hidden feature that memcached has, in order to build a custom RPM with the right configuration file.
Once you know its full power, you will be blown away by memcached's strength. Just so you know, the basic setup you find everywhere on the tutorial sites tap 10% of memcached's tweaking tools. Not to mention that the security is very weak when set with default options. In fact memcached has only ONE security feature, heh.
May we be fortunate enough to benefit from your research?
vBulletin® v3.8.0 Release Candidate 1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.