How to do a large buffer size > 64k uWSGI requests with Nginx proxy | uwsgi request is too big with nginx

Rai Mohammed nginx-forum at forum.nginx.org
Thu May 27 18:55:24 UTC 2021


How to do a large buffer size > 64k uWSGI requests with Nginx proxy

Deployment stack :
Odoo ERP 12
Python 3.7.10 and Werkzeug 0.16.1 as backend
Nginx proxy : 1.20.0
uWSGI : 2.0.19.1
OS : FreeBSD 13.0-RELEASE

Nginx throw an alert from uwsgi of request is too big
Alert : uwsgi request is too big: 81492, client: 10.29.79.250, server:
odoo12ce-erp, request: "GET /web/webclient/..........."

As you can see I increased the "uwsgi_buffer_size " in both uwsgi.ini and
nginx.conf.

Nginx config :
`{

    # increase the size of the buffers to handle odoo data
    # Activate uwsgi_buffering 
    uwsgi_buffering on;                                  
    uwsgi_buffers 16 128k;
    uwsgi_buffer_size 128k;                                  
    uwsgi_busy_buffers_size 256k;                            
    # uwsgi_max_temp_file_size with zero value disables buffering of
responses to temporary files
    uwsgi_max_temp_file_size 0;                          
    uwsgi_temp_file_write_size 256k;

    uwsgi_read_timeout 900s;
    uwsgi_connect_timeout 900s;
    uwsgi_send_timeout 900s;

}`

uwsgi.ini config :

`

    [uwsgi]
    strict = true
    pcre-jit = true
    #limit-as = 1024
    #never-swap = true
     
    pidfile = /var/run/odoo_erp/odoo12ce_uwsgi.pid
    # safe-pidfile = /var/run/odoo_erp/odoo12ce.pid
    
    # Enable REUSE_PORT flag on socket to allow multiple instances binding
on the same address (BSD only).
    reuse-port = true
    
    #  Testing with www or odoo12ce
    uid = odoo12ce
    gid = odoo12ce
    
    # To test and verification
    callable = application
    # To test and verification
    #module = odoo.service.wsgi_server:application
    
    # enable uwsgi master process
    master = true
    lazy = true
    lazy-apps=true

    # turn on memory usage report
    #memory-report=true

    enable-threads = true
    threads = 2
    thunder-lock = true
    so-keepalive = true
    
    buffer-size = 262144
    http-buffer-size = 262144
    
    response-headers-limit = 262144
    http-headers-timeout = 900
    # set max connections to 1024 in uWSGI
    listen = 1024 
    
    so-send-timeout = 900
    socket-send-timeout = 900
    so-write-timeout = 900
    socket-write-timeout = 900
    
    http-timeout = 900
    socket-timeout = 900
    
    wsgi-accept-buffer = true
    wsgi-accept-buffers = true
    # clear environment on exit and Delete sockets during shutdown
    vacuum = true
    single-interpreter = true
    
    # Shutdown when receiving SIGTERM (default is respawn)
    die-on-term = true
    need-app = true
    
    # Disable built-in logging
    disable-logging = false 
    
    # but log 4xx's and 5xx's anyway
    log-4xx = true
    log-5xx = true                      
    
    # full path to Odoo12ce project's root directory
    chdir = /odoo_erp/odoo12ce/odoo12ce_server
    #chdir2 = = /odoo_erp/odoo12ce/odoo12ce_server
    
    pythonpath = /odoo_erp/odoo12ce/odoo12ce_server
    
    # odoo12ce's wsgi file
    wsgi-file = /odoo_erp/odoo12ce/odoo12ce_server/setup/odoo12ce-uwsgi.py
    
    #emperor = /odoo_erp/odoo12ce/vassals
    
    uwsgi-socket = 127.0.0.1:8070
    uwsgi-socket = 127.0.0.1:8170
    
    # daemonize uwsgi and write messages into given log
    daemonize = /var/log/odoo_erp/odoo12ce/odoo12ce_uwsgi_emperor.log
    
    # Restart workers after this many requests
    max-requests = 2000
    
    # Restart workers after this many seconds
    max-worker-lifetime = 3600

    # Restart workers after this much resident memory
    reload-on-rss = 2048

    # How long to wait before forcefully killing workers
    worker-reload-mercy = 90
    
    # Maximum number of workers allowed (cpu * 2)
    processes = 8

`

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,291675,291675#msg-291675



More information about the nginx mailing list