MPM -- prefork or worker?

We are running apache 2.2, mongrel and RoR 2.1.1. One of the issues we are seeing is the speed apache takes to load images out of the / public folder. The app flies and the response times from mysql and the queries is very fast. However, the time it takes for the initial load of an uncached page seems sluggish. any ideas?

It may not have anything to do with Apache - it could just be a bandwidth issue. Try to run apache bench from your web server on itself. For example, here's the command to run apache bench to serve up the /images/rails.png file from the webserver itself. ab -c 1 -n 20 http://127.0.0.1/images/rails.png

That command requests the image 20 times, with 1 concurrent request. You can adjust the numbers for whatever scenario you want to try out. In the output, you can see how fast apache is serving up the file. I just ran this and apache bench gave me: Requests per second: 1766.00 [#/sec] (mean)

Now, try it from a remote box. For example, if I now run: ab -c 1 -n 20 http://www.somethingnimble.com/images/rails.png

I get: Requests per second: 23.33 [#/sec] (mean)

Apache bench will also give you the transfer rate. For my two test runs, the results are: Transfer rate: 3532.01 [Kbytes/sec] received Transfer rate: 46.65 [Kbytes/sec] received

So clearly Apache is serving up the images quickly - it's just bandwidth that is slowing it down.

MPM worker is supposed to be better for multi-core servers, but if you're noticing sluggish page load times, I don't think it will be your solution. A couple other things: are you using Rails asset hosts? If you serve up your assets from different subdomains, the browser will load more at once. Also, are you using the :cache option of stylesheet_link_tag and javascript_include_tag to combine smaller css and js files into 1 larger file? Are you using gzip to compress your css and js files? Safari has a page load timeline view that should give you good visibility into why your page load times are slow.

-Dan Manges http://www.dcmanges.com/blog

Thank you. I will look over this stuff and reply....this is great information. I am a developer so I will need to bring some of this stuff to our admin and see what he has to say...but I do really want to thank you for taking the time to write all that up.

That was a great call...I already see the delays in transfer from remote to local but not local to local....