[PATCH 8 of 8] new io_uring event module

SoYun Seong thdbsdox12 at gmail.com
Tue Nov 24 08:43:36 UTC 2020


# HG changeset patch
# User SoYun Seong <thdbsdox12 at gmail.com>
# Date 1606129415 0
#      Mon Nov 23 11:03:35 2020 +0000
# Node ID d7420a5777b63c8a8cfb7e98a522893490995510
# Parent  09dfe4a92414513c6bd3c18d871e8a76ed19c3d7
new io_uring event module.

I implemented ngx_uring_module using Linux io_uring API to improve performance of Nginx for Linux by minimizing system calls. There are performance improvements in both request/sec and average latency. The result is located at https://github.com/dachshu/nginx.

However, there are some places that uses local variable buffer(stack) to recv and send data. To do asynchronous IO, recv and send buffers should be located at safe memory(like heap, data). Therefore it is needed to make these codes to use allocated memory from memory pool when using asynchronous IO.

Also I am working on improve performance of Nginx for Windows using Registered IO and IOCP.

diff -r 09dfe4a92414 -r d7420a5777b6 auto/os/linux
--- a/auto/os/linux	Mon Nov 23 11:01:36 2020 +0000
+++ b/auto/os/linux	Mon Nov 23 11:03:35 2020 +0000
@@ -89,6 +89,30 @@
 fi
 
 
+# io_uring
+
+ngx_feature="uring"
+ngx_feature_name="NGX_HAVE_URING"
+ngx_feature_run=yes
+ngx_feature_incs="#include <liburing.h>"
+ngx_feature_path="-I src/liburing/src/include/"
+ngx_feature_libs="-L src/liburing/src/ -luring"
+ngx_feature_test="struct io_uring          ring;
+                  struct io_uring_params   params;
+                  if (io_uring_queue_init_params(32768, &ring, &params) < 0) return 1;
+                  if (!(params.features & IORING_FEAT_FAST_POLL)) return 1;"
+. auto/feature
+
+if [ $ngx_found = yes ]; then
+    have=NGX_HAVE_CLEAR_EVENT . auto/have
+    CORE_SRCS="$CORE_SRCS $URING_SRCS"
+    CORE_INCS="$CORE_INCS $ngx_feature_path"
+    CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
+    EVENT_MODULES="$EVENT_MODULES $URING_MODULE"
+    EVENT_FOUND=YES
+fi
+
+
 # O_PATH and AT_EMPTY_PATH were introduced in 2.6.39, glibc 2.14
 
 ngx_feature="O_PATH"
diff -r 09dfe4a92414 -r d7420a5777b6 auto/sources
--- a/auto/sources	Mon Nov 23 11:01:36 2020 +0000
+++ b/auto/sources	Mon Nov 23 11:03:35 2020 +0000
@@ -120,6 +120,9 @@
 EPOLL_MODULE=ngx_epoll_module
 EPOLL_SRCS=src/event/modules/ngx_epoll_module.c
 
+URING_MODULE=ngx_uring_module
+URING_SRCS=src/event/modules/ngx_uring_module.c
+
 IOCP_MODULE=ngx_iocp_module
 IOCP_SRCS=src/event/modules/ngx_iocp_module.c
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nginx-8.patch
Type: text/x-patch
Size: 2392 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20201124/39a3e007/attachment.bin>


More information about the nginx-devel mailing list