Welcome! Log In Create A New Profile

Advanced

Rewrite URL scales better than canonical?

Posted by Ludo 
Rewrite URL scales better than canonical?
December 09, 2010 11:29AM
Hi there.

I recently migrated to Nginx from Cherokee. I'm loving it so far. Something which I'm not expecting is happening and I wonder if someone could point me at why I might not be doing something the right way, or might be able to explain the behaviour I'm seeing.

I'm running a Django app, using uwsgi behind Nginx. I've been doing some performance tuning and load testing using ApacheBench and have discovered something unexpected. In my Nginx config I have a rewrite directive which catches lots of different URL permutations and then forwards them to the canonical URL I wish to use, eg, it traps www.mysite.com/whatever, www.mysite.co.uk/whatever and forwards them all to http://mysite.com/whatever.

If I load test against any of the URLs listed with a redirect (ie, NOT the canonical URL which it is eventually forwarded to), it can serve 15000 concurrent connections without breaking a sweat.

If I load test against the canonical URL, which the above test I would have expected got forwarded to anyway, it can't handle nearly as much. It will drop about 4000 of the 15000 requests, and can only handle about 9000 reliably.

This is the command line I'm using to test:

ab -c15000 -n15000 http://www.mysite.com/somepath/

and

ab -c15000 -n15000 http://mysite.com/somepath/

I've tried several different times - it makes no different which order I do them in. This doesn't make sense to me - I can understand why the requests involving a redirect may not handle quite so many concurrent connections, but it's happening the other way round. Can anyone explain? I'd really prefer it if the canonical URL was the one which could handle more traffic.

My Nginx config is attached. I have a debug log of a single request to either URL which I can provide if it's of use, and I can provide outputs from ab if anyone's interested.

Thanks loads for any help, and thanks for a superb piece of kit :> In some ways it's quite funny that I'm even posting a question when I'm already able to handle these amounts of traffic on a single box!

Ludo.
Attachments:
open | download - nginx.conf (685 bytes)
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 205
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready