Server performance with nginx and mongrel - can you compare?

I just did test based on
http://blog.kovyrin.net/2006/08/28/ruby-performance-results/

My server is:
Athlon 2.66GHz, 1GB RAM
Rails 1.1.6. + latest mongrel and nginx
OS: CentOS 4.4
Run in Rails production mode.

I have created application with test controller based on the article
above. I have configured mongrel cluster with 4 backends and put nginx
as frontend. Nginx configuration is based on Ezras article
http://brainspl.at/articles/2006/08/23/nginx-my-new-favorite-front-end-for-mongrel-cluster

using following test:

ab -n 1000 -c 100 http://server/test/hw

gets me 55 req per second. I tried to change the number of mongrel
backends but there was no imptact on speed at all. Is it normal? My
another test page with simple scaffold item list from PostgreSQL on the
same machine(30 items) cant get higher than 16 req/s on the same hw and
configuration. The speed is the same if backend is one mongrel or 5.

Can someone share some real live experience?

Thanks,
David

On Sep 11, 2006, at 5:55 AM, David M. wrote:

I have created application with test controller based on the article
another test page with simple scaffold item list from PostgreSQL on
the
same machine(30 items) cant get higher than 16 req/s on the same hw
and
configuration. The speed is the same if backend is one mongrel or 5.

Can someone share some real live experience?

Thanks,
David

Hey David-

Are you running ab from the same machine that you are testing? That

can seriously affect your results as ab takes up significant
resources to do its thing. Try to run the ab test on another box on
the same lan or local network. That being said, for your hardware and
a hello world app that just does render :text=> ‘hello world’ you
should get better then 55. You should get closer to 100. Also start
with one mongrel backend and get a baseline with concurrency of 10.
Then up the concurrency and save the results. Then add another
mongrel in and repeat. This way you start to see how much latency you
have and how much req/sec you have.

Also keep in mind that even at 16req/sec you can serve 1,382,400

hits a day with the setup you just tested. Will you need to serve
that many requests a day any time soon? :wink: So that is probably ok
although it could be better. The other important thing to look at is
the latency. How fast does your app feel to the user. Concurrency
measure your capacity, latency measure how long it takes for one
response to complete. You can tweak the latency with some tricks to
make the user feel like your site is fast if you need to.

Cheers-
-Ezra

  1. ab is running on other computer
  2. I just did test with render :text=> ‘hello world’
    a) connecting directly to one mongrel I got: 60 req/s . The same result
    when running through nginx
    b) I setup mongrel cluster with two mongrels and tried through nginx
    with proxypass. Got the same result atou nd 60req/s. The same situation
    when using Pound as mongrel frontend, so its not nginx issue.
    c) setup environment with 5 mongrels as cluster and nginx as frontend.
    No speed boost at all.

Cant get what can be a problem. When using ab on javascript file in
rails instalation, nginx rule causes to file server directly and ommit
the mongrel, I get 220 req/s.

PS: Latency seems to be good for SQL test, but its just for one user. I
want to be sure that my users will not hang my server when running
concurently.

David

Ezra Z. wrote:

On Sep 11, 2006, at 5:55 AM, David M. wrote:

I have created application with test controller based on the article
another test page with simple scaffold item list from PostgreSQL on
the
same machine(30 items) cant get higher than 16 req/s on the same hw
and
configuration. The speed is the same if backend is one mongrel or 5.

Can someone share some real live experience?

Thanks,
David

Hey David-

Are you running ab from the same machine that you are testing? That
can seriously affect your results as ab takes up significant
resources to do its thing. Try to run the ab test on another box on
the same lan or local network. That being said, for your hardware and
a hello world app that just does render :text=> ‘hello world’ you
should get better then 55. You should get closer to 100. Also start
with one mongrel backend and get a baseline with concurrency of 10.
Then up the concurrency and save the results. Then add another
mongrel in and repeat. This way you start to see how much latency you
have and how much req/sec you have.

Also keep in mind that even at 16req/sec you can serve 1,382,400
hits a day with the setup you just tested. Will you need to serve
that many requests a day any time soon? :wink: So that is probably ok
although it could be better. The other important thing to look at is
the latency. How fast does your app feel to the user. Concurrency
measure your capacity, latency measure how long it takes for one
response to complete. You can tweak the latency with some tricks to
make the user feel like your site is fast if you need to.

Cheers-
-Ezra

snacktime wrote:

On 9/11/06, David M. [email protected] wrote:

Cant get what can be a problem. When using ab on javascript file in
rails instalation, nginx rule causes to file server directly and ommit
the mongrel, I get 220 req/s.

What’s the exact arguments you are feeding to ab? How many concurrent
requests are you testing with?

ab -n 1000 -c 10 http://server/test/hw

On Sep 11, 2006, at 11:01 PM, David M. wrote:

No speed boost at all.

Cant get what can be a problem. When using ab on javascript file in
rails instalation, nginx rule causes to file server directly and ommit
the mongrel, I get 220 req/s.

220 req/s for a static file indicates some general performance problem
on the server itself. This number is very low for modern hardware.


– Tom M.

On 9/11/06, David M. [email protected] wrote:

Cant get what can be a problem. When using ab on javascript file in
rails instalation, nginx rule causes to file server directly and ommit
the mongrel, I get 220 req/s.

What’s the exact arguments you are feeding to ab? How many concurrent
requests are you testing with?

I installed the entire environment on another machine.
PD4 2.8GHz, 2GB RAM, CentOS 4.4

with test:

ab -n 1000 -c 100 http://server/test/test1

I got around 250 req/s on following setup:
nginx + 5 mongrels on background. Its amazing!!!

Thanks to all for the hints.
David

Ezra Z. wrote:

On Sep 12, 2006, at 6:15 AM, Tom M. wrote:

situation
220 req/s for a static file indicates some general performance problem
on the server itself. This number is very low for modern hardware.


– Tom M.

Also I have just posted a new nginx.conf file on my blog. Try this
one out to see if it helps you. This one has been perfected for rails/
mongrel. And it serves all static and rails cached files via nginx
fast and then proxies the rest thru to mongrel cluster.

http://brainspl.at/articles/2006/09/12/new-nginx-conf-with-rails-caching

You should get way way more then 220req/sec for static files.

Cheers-
-Ezra

On Sep 13, 2006, at 4:39 AM, David M. wrote:

Thanks to all for the hints.
David

Hey David-

Cool! I updated the config on my blog wigth a few more things like

correct headers sent to mongrel and it now handles the .js?23129391
timestamped assets that rails makes. I also commented it for folks to
know what does what. You should update

http://brainspl.at/nginx.conf.txt

-Ezra

On Sep 12, 2006, at 6:15 AM, Tom M. wrote:

situation
220 req/s for a static file indicates some general performance problem
on the server itself. This number is very low for modern hardware.


– Tom M.

Also I have just posted a new nginx.conf file on my blog. Try this

one out to see if it helps you. This one has been perfected for rails/
mongrel. And it serves all static and rails cached files via nginx
fast and then proxies the rest thru to mongrel cluster.

http://brainspl.at/articles/2006/09/12/new-nginx-conf-with-rails-caching

You should get *way way* more then 220req/sec for static files.

Cheers-
-Ezra