[log] Optimize the buffer size and flush time (#1570)

* yousali:<log>Optimize the buffer size and flush time

1. buffer=4096 is better for Writes of more than PIPE_BUF bytes may be nonatomic
2. flush=1. Since the log buffer is lowered, the flush time should also be lowered.

* yousali:<fix>

hi, I also made a test.

```
4096  Requests/sec:  16079.75
8192 Requests/sec:  16389.52
16384 Requests/sec:  16395.30
32768 Requests/sec:  16459.71
```
I think a log buffer size of 8192 or 16384 would be appropriate.

On the other hand, the refresh time of 3 seconds is still relatively long, and 1 or 3 seconds doesn't particularly affect QPS.

So I also agree with `buffer=16384 flush=1; `
This commit is contained in:
Yousa 2020-06-07 23:57:54 +08:00 committed by GitHub
parent 3228e16705
commit f61b7036b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -228,7 +228,7 @@ http {
log_format main '$remote_addr - $remote_user [$time_local] $http_host "$request" $status $body_bytes_sent $request_time "$http_referer" "$http_user_agent" $upstream_addr $upstream_status $upstream_response_time';
access_log {* http.access_log *} main buffer=32768 flush=3;
access_log {* http.access_log *} main buffer=16384 flush=1;
open_file_cache max=1000 inactive=60;
client_max_body_size 0;
keepalive_timeout {* http.keepalive_timeout *};