[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Optimize monit and monitrc for nginx with low latency and high throu
From: |
David Montgomery |
Subject: |
Re: Optimize monit and monitrc for nginx with low latency and high throughput server |
Date: |
Tue, 6 Mar 2012 00:51:00 +0800 |
Thanks for the advice...I will try it out.
On Tue, Mar 6, 2012 at 12:32 AM, Antonio P.P. Almeida <address@hidden> wrote:
>> Hi,
>
> Hello,
>
>> The below is a default script for monit for monitoring nginx but I do
>> not know how to optimize for my partitical situation.
>>
>> Here is the scenario.
>>
>> 1) 4 cores
>> 2) Running nginx with fastcgi using spawn-fcgi of a web.py app
>> 3) I am optimizing for potentially 8K qps where I have 120 ms for
>> a response or else punished
>> 4) Once a receive a post request only network calls is to redis.
>> There is no reading from disk etc. My response is a protocol buffer.
>> 5) I have 8 worker proccess, 2 x number of cores
>> 6) 20000 worker connections
>> 7) keepalive_timeout 20
>> 8) 8 gigs of Ram
>> 9) 146 GB Harddrive
>>
>> Given the above, how would woud I modify the monit config for nginx to
>> optimize monit monitoring?
>>
>> check process nginx
>> with pidfile "/var/run/nginx.pid"
>> start program = "/etc/init.d/nginx start"
>> stop program = "/etc/init.d/nginx stop"
>> if failed host 127.0.0.1 port 80 protocol HTTP then restart #set
>> your server IP that runs nginx
>> if 5 restarts with 5 cycles then timeout
>> if cpu is greater than 80% for 2 cycles then alert
>> if cpu is greater than 80% for 5 cycles then restart
>> if totalmem is greater than 50.0 MB for 5 cycles then restart
>> if children is greater than 10 then restart
>
> This is not a good strategy. In fact is a rather bad one. If the machine
> is under load then you should tweak the request handling.
>
> There are the following options:
>
> 1. Use traffic shaping at the network level.
>
> 2. http://nginx.org/en/docs/http/ngx_http_limit_req_module.html
>
> 3. Use Lua and adjust dinamically: http://wiki.nginx.org/HttpLuaModule
>
> 4. Use tengine instead of Nginx and take advantage of sysguard:
> http://tengine.taobao.org/document/http_sysguard.html
>
> Only 1 and 2 are addressable with monit. You should use a custom script
> for setting the traffic shape and/or the limit request. There's no need to
> do any restart a reload will do.
>
> HTH,
> --appa
>
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general