Welcome! Log In Create A New Profile

Advanced

Re: Tuning workers and connections

Stefan Caunter
August 21, 2012 05:16AM
On Tue, Aug 21, 2012 at 3:23 AM, liangrubo <nginx-forum@nginx.us> wrote:
> Hello, we meet similar problem.
>
> if we set "multi_accept off;" and "accept_mutex on;", it sometimes took 3 or
> 9 or even 21 seconds to connect to nginx on port 80 from the same server. if
> we set "multi_accept on;" and "accept_mutex off;", we can connect to nginx
> on port 80 instantly but it may take long to get the response (more than 3
> seconds for small css files on the same server).
>
> Our deploy structure is as follows:
> frontend nginx listen on port 80, servering static files. For dynamic
> requests, nginx on port 80 reverse proxy to nginx on port 81 via tcp socket,
> nginx on port 81 again reverse proxy to uwsgi via unix sokcet.
>
> the site is handling about 1200 requests per second.
>
> the server has 24 cpu cores and 96G memory. the system has low load, lots
> of free memory and no IO bottleneck.

What is the system load? You have a bottleneck, you just have not
found it. If static file access is problematic, look to the disk i/o
subsystem. Are you caching? How many files is nginx accessing? What is
the filesystem? Show the output of a filesystem utility under 1200r/s.
If nginx is accessing many small static files from one partition, is
it on its own partition, or is logging writing to the same partition?
Concurrent access times to disk reduce geometrically as requests grow
arithmetically. At 1200 per second, nginx processes are likely waiting
for the disk to find request.

> some of the nginx configurations are as follows:
> worker_processes 8; //it was originally 4, I doubled it but it didn't help
> worker_rlimit_nofile 15240;
> worker_connections 15240;
>
> use epoll;
>
> we have keepalive setup for upstream(80 to 81 reverse proxy) as follows:
> keepalive 32;
>
>
> information shown by status_sub:
> Active connections: 4320
> server accepts handled requests
> 9012300 9012300 37349248
> Reading: 118 Writing: 199 Waiting: 4003
>
> we examined the dynamic request handling is fast and even if it was slow, it
> should not affect static file servering on port 80 anyway, right?

Right. Your dynamic processing is not i/o bound from what you have described.

> it seems nginx can't process the request fast enough but we can't find what
> is the bottleneck.
>
> any help is greatly appreciated.
>

Stefan Caunter

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Tuning workers and connections

Avleen Vig July 01, 2009 09:23PM

Re: Tuning workers and connections

Gabriel Ramuglia July 01, 2009 10:39PM

Re: Tuning workers and connections

Dave Cheney July 02, 2009 01:43AM

Re: Tuning workers and connections

Avleen Vig July 02, 2009 09:58AM

Re: Tuning workers and connections

Maxim Dounin July 02, 2009 05:56AM

Re: Tuning workers and connections

Avleen Vig July 02, 2009 10:01AM

Re: Tuning workers and connections

mike July 02, 2009 01:56PM

Re: Tuning workers and connections

Maxim Dounin July 02, 2009 02:19PM

Re: Tuning workers and connections

mike July 02, 2009 02:34PM

Re: Tuning workers and connections

Maxim Dounin July 02, 2009 03:05PM

Re: Tuning workers and connections

Momchil Ivanov July 03, 2009 04:58AM

Re: Tuning workers and connections

liangrubo August 21, 2012 03:23AM

Re: Tuning workers and connections

liangrubo August 21, 2012 03:48AM

Re: Tuning workers and connections

Stefan Caunter August 21, 2012 05:16AM

Re: Tuning workers and connections

hagai avrahami August 27, 2012 03:34AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 182
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