You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by yo...@apache.org on 2020/06/07 15:58:01 UTC

[incubator-apisix] branch master updated: [log] Optimize the buffer size and flush time (#1570)

This is an automated email from the ASF dual-hosted git repository.

yousa pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new f61b703  [log] Optimize the buffer size and flush time (#1570)
f61b703 is described below

commit f61b7036b08df020fd756fafc0545df81d8c03a7
Author: Yousa <sn...@gmail.com>
AuthorDate: Sun Jun 7 23:57:54 2020 +0800

    [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; `
---
 bin/apisix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/apisix b/bin/apisix
index df64744..94848d6 100755
--- a/bin/apisix
+++ b/bin/apisix
@@ -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 *};