Advice
- instead of tweaking values, first work out what is happening, 
locate the bottleneck, then try adjusting things when you have a theory


First QN you need to answer:
For your test, is your system as a whole overloaded?

As in, for he duration of the test is the #req/se supported constant? 
Is the request time shown in nginx log increasing?
If you capture the output of net stat -ant | grep -i tcp > aa is the # of tcp 
connections changing wit time


Some other key questions:

Does every PHP request involve a call to mysql?
Is there a connection pool or does every PHP instance have its connection to 
mysql
When you do your test are you ramping up workload  do you have a consistent 
workload?
How many requests per second are seeing from the nginx logs?


How are you driving the test traffic and from what host?
Ar you logging the request execution  time in the nginx log?
The ps output that you pasted only showed 36 PHP processes but 
your initial config specified 400 max_children

 If consistent, how many virtual agents / independent request sources do you 
have?

What do you mean “losing visitors abnormally?” 
how are you seeing this?
Do you realize that your PHP process is configured to die after serving 800 
(now 2500) 
requests and then needs to be restarted?


> On Oct 16, 2017, at 3:04 PM, agriz <nginx-fo...@forum.nginx.org> wrote:
> 
> worker_processes  4;
> worker_rlimit_nofile 40000;
> 
> events {
>    worker_connections 4096;
> #    accept_mutex on;
> #    accept_mutex_delay 500ms;
>    multi_accept on;
>    use epoll;
> }
> 
> pm.max_children = 50
> pm.start_servers = 4
> pm.min_spare_servers = 4
> pm.max_spare_servers = 32
> pm.max_requests = 2500 //modified
> rlimit_files = 131072 //modified
> rlimit_core = unlimited //modified
> 
> # TCP Stack changes 
> net.ipv4.tcp_fin_timeout = 20 
> net.ipv4.tcp_tw_reuse = 1
> net.core.netdev_max_backlog = 10000 
> net.core.somaxconn = 2048
> net.ipv4.tcp_max_syn_backlog = 2048 
> net.ipv4.ip_local_port_range = 15000 65000 
> 
> But still not efficient.
> Losing visitors abnormally
> 
> Posted at Nginx Forum: 
> https://forum.nginx.org/read.php?2,276892,276900#msg-276900
> 
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

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

Reply via email to