Skip to content

Nginx AIO threads for Concurrent Request

Rudi edited this page Sep 17, 2020 · 12 revisions

nginx-link-function with AIO threads request feature (has been tested on version 1.13.7 and above)

sometimes one worker only can process one request per time, what if process the heavy app request might slow down the performance due to synchronize process.

Resolution:- enable the multi threading request, just recompile your nginx by using --with-threads.

After installed, enable the multithread in your server block

http {
    server {
        listen 8080;
        aio threads;
        ngx_link_func_lib "/etc/nginx/apps/libcfuntest.so";

        location /callme {
            ngx_link_func_call "my_app_simple_get_greeting"; 
        }
    }
}

Full Sample Config with aio threads

Now your app can accept more than one request from client, enjoy :)

Compilation References: https://www.nginx.com/blog/thread-pools-boost-performance-9x/