Hi. I notice that nginx with just the location rules and usual
directives results in mind-blowing performance. Apache Bench test shows
“115,000 requests per second” can be handled.
However, when I add a simple rule:
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}
Which I think is important from a point of view of getting rid of so
much junk that hits any modern server, the requests per second fall to
“1,200” !!!
Is there any way around this? I would, if possible, prefer that my main
web server be able to handle such basic stuff.
On Wed, Jun 01, 2011 at 08:47:48AM -0400, pk899 wrote:
Which I think is important from a point of view of getting rid of so
much junk that hits any modern server, the requests per second fall to
“1,200” !!!
Is there any way around this? I would, if possible, prefer that my main
web server be able to handle such basic stuff.
Well, the test you added includes the regular expression calculations as
well.
Can nginx use three simpler exact string matches instead? It may be
faster.
Which I think is important from a point of view of getting rid of so
much junk that hits any modern server, the requests per second fall to
“1,200” !!!
I’m interested in what way this is important. Especially since nginx
will just return error 400 on bad requests.
On Wed, Jun 01, 2011 at 08:47:48AM -0400, pk899 wrote:
Which I think is important from a point of view of getting rid of so
much junk that hits any modern server, the requests per second fall to
“1,200” !!!
Is there any way around this? I would, if possible, prefer that my main
web server be able to handle such basic stuff.
It’s strange result. The “if” and regex slow down processing,
but not by 3 orders of magnitude.
I am just learning about nginx so I am not familiar with the syntax yet.
But
your query would still require checking three separate conditions before
proceeding.
Could check three separate times and proceed after each one:
Which I think is important from a point of view of getting rid of so
much junk that hits any modern server, the requests per second fall to
“1,200” !!!
How scientific is that test? Is 115,000 requests per second an
expected baseline performance? Did anything else change between tests?
And as someone else suggested, this is not really something you should
have to do in nginx in any case. It’s like closing ports you don’t
use. If your system is secure there’s no need. If your system isn’t
secure it won’t help.
Thomas
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.