Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My setup:

  • nginx is listening on port 80 and working as a reverse proxy (plus directly sending static files)
  • Apache 2 is listening on port 8080
  • PHP is running in Apache 2
  • All running on one server (no internal network latency)

My problem:

Static files now are very fast, but everything going through the proxy takes a lot of extra time.

One example is a "search-as-you-type" tag suggestion box. When I connect to Apache directly though port 8080 everything is fine and the server responds quickly (~50 ms). When I use the "normal path" through port 80 (nginx -> Apache) every request takes about 15 times as long (~750 ms).

I expected some more time. Right now requests are not leaving the server in any way, so why do they take so much more time to process? How do I make them faster?

Is there any way I can use persistent connections between nginx and Apache?

Is there any way to benchmark where exactly that additional 0.7 second is added?

Main interest: Can I find out if this time comes from internal processing in nginx (e.g. hostname table lookup) or is it the connection to Apache. Is nginx waiting for an open socket - or what happens here?

share|improve this question
3  
Why are you using Apache at all? –  Michael Hampton Mar 18 at 17:44
    
Because I didn't have time to check/fix all schripts on the server for compatibility with another webserver. I may be able to do that in the long run - but right now it was "hdd crash - so I had to set up a new server and desided to try something new, because Apache was eating so many resources on static files". –  BlaM Mar 18 at 18:09
    
How do you proxy requests to Apache? If you use localhost:8080, try to use 127.0.0.1:8080 instead. –  Alexey Ten Mar 18 at 19:39
    
127.0.0.1 seems to be a little faster than localhost - but it's still slow. –  BlaM Mar 19 at 8:36
    
Is there anything in error.log? –  Alexey Ten Mar 19 at 21:02

1 Answer 1

up vote 0 down vote accepted

Okay, I finally found my problem - and it looks as if I was causing my own problems:

I misconfigured limit_req_zone throttling my server down to a crawl slower than expected.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.