# MPM -- prefork or worker?

**URL:** <https://www.ruby-forum.com/t/mpm-prefork-or-worker/149139>\
**Category:** Rails\
**Created:** [September 21, 2008, 3:02pm UTC](https://www.ruby-forum.com/t/mpm-prefork-or-worker/149139 "2008-09-21T15:02:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [September 21, 2008, 3:02pm UTC](https://www.ruby-forum.com/t/mpm-prefork-or-worker/149139/1 "2008-09-21T15:02:15Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [September 21, 2008, 10:19pm UTC](https://www.ruby-forum.com/t/mpm-prefork-or-worker/149139/2 "2008-09-21T22:19:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [September 21, 2008, 10:36pm UTC](https://www.ruby-forum.com/t/mpm-prefork-or-worker/149139/3 "2008-09-21T22:36:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [September 21, 2008, 9:52pm UTC](https://www.ruby-forum.com/t/mpm-prefork-or-worker/149139/4 "2008-09-21T21:52:41Z")

</div>

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](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](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 M.  
[http://www.dcmanges.com/blog](http://www.dcmanges.com/blog)
