uringmachine 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.gitmodules +0 -3
- data/CHANGELOG.md +13 -0
- data/Gemfile +11 -0
- data/README.md +266 -112
- data/Rakefile +8 -0
- data/TODO.md +14 -21
- data/benchmark/common.rb +2 -0
- data/benchmark/openssl.rb +77 -0
- data/benchmark/openssl_socketpair.rb +112 -0
- data/benchmark/sqlite.rb +1 -1
- data/docs/design/buffer_pool.md +1 -1
- data/docs/wroclove.rb.md +52 -0
- data/ext/um/extconf.rb +15 -0
- data/ext/um/um.c +392 -358
- data/ext/um/um.h +48 -23
- data/ext/um/um_async_op.c +9 -8
- data/ext/um/um_async_op_class.c +34 -3
- data/ext/um/um_class.c +705 -19
- data/ext/um/um_const.c +31 -0
- data/ext/um/um_mutex_class.c +12 -0
- data/ext/um/um_op.c +15 -1
- data/ext/um/um_queue_class.c +16 -0
- data/ext/um/um_ssl.c +109 -0
- data/ext/um/um_stream.c +9 -8
- data/ext/um/um_sync.c +18 -11
- data/ext/um/um_utils.c +17 -8
- data/grant-2025/interim-report.md +1 -1
- data/grant-2025/journal.md +4 -4
- data/grant-2025/tasks.md +6 -4
- data/lib/uringmachine/dns_resolver.rb +38 -0
- data/lib/uringmachine/fiber_scheduler.rb +7 -5
- data/lib/uringmachine/version.rb +1 -1
- data/lib/uringmachine.rb +106 -6
- data/test/helper.rb +15 -0
- data/test/test_async_op.rb +3 -2
- data/test/test_fiber_scheduler.rb +41 -1
- data/test/test_ssl.rb +85 -0
- data/test/test_stream.rb +11 -0
- data/test/test_um.rb +445 -11
- data/uringmachine.gemspec +1 -7
- data/vendor/liburing/examples/send-zerocopy.c +43 -31
- data/vendor/liburing/examples/zcrx.c +260 -69
- data/vendor/liburing/liburing.spec +1 -1
- data/vendor/liburing/src/include/liburing/io_uring.h +12 -0
- data/vendor/liburing/src/include/liburing.h +3 -2
- data/vendor/liburing/src/liburing-ffi.map +4 -0
- data/vendor/liburing/src/liburing.map +4 -0
- data/vendor/liburing/src/queue.c +12 -0
- data/vendor/liburing/src/register.c +1 -0
- data/vendor/liburing/src/setup.c +15 -7
- data/vendor/liburing/test/Makefile +8 -4
- data/vendor/liburing/test/conn-unreach.c +1 -1
- data/vendor/liburing/test/epwait.c +32 -6
- data/vendor/liburing/test/io-wq-exit.c +131 -0
- data/vendor/liburing/test/iowait.c +1 -1
- data/vendor/liburing/test/min-timeout.c +3 -1
- data/vendor/liburing/test/open-close.c +39 -0
- data/vendor/liburing/test/poll-update-trigger.c +85 -0
- data/vendor/liburing/test/recvsend_bundle.c +14 -11
- data/vendor/liburing/test/sendzc-bug.c +146 -0
- data/vendor/liburing/test/sqe-mixed-nop.c +151 -7
- data/vendor/liburing/test/test.h +2 -0
- data/vendor/liburing/test/timestamp-bug.c +135 -0
- data/vendor/liburing/test/timestamp.c +5 -0
- data/vendor/liburing/test/vec-regbuf.c +136 -1
- metadata +38 -283
- data/vendor/libressl/.github/scripts/changelog.sh +0 -74
- data/vendor/libressl/.github/workflows/android.yml +0 -35
- data/vendor/libressl/.github/workflows/cifuzz.yml +0 -33
- data/vendor/libressl/.github/workflows/cmake-config.yml +0 -98
- data/vendor/libressl/.github/workflows/coverity.yml +0 -69
- data/vendor/libressl/.github/workflows/emscripten.yml +0 -71
- data/vendor/libressl/.github/workflows/fedora-rawhide.yml +0 -39
- data/vendor/libressl/.github/workflows/freebsd.yml +0 -71
- data/vendor/libressl/.github/workflows/linux.yml +0 -71
- data/vendor/libressl/.github/workflows/macos.yml +0 -37
- data/vendor/libressl/.github/workflows/release.yml +0 -81
- data/vendor/libressl/.github/workflows/rust-openssl.yml +0 -47
- data/vendor/libressl/.github/workflows/solaris.yml +0 -37
- data/vendor/libressl/.github/workflows/windows.yml +0 -70
- data/vendor/libressl/.gitignore +0 -333
- data/vendor/libressl/CMakeLists.txt +0 -581
- data/vendor/libressl/COPYING +0 -133
- data/vendor/libressl/ChangeLog +0 -3280
- data/vendor/libressl/FindLibreSSL.cmake +0 -232
- data/vendor/libressl/LibreSSLConfig.cmake.in +0 -36
- data/vendor/libressl/Makefile.am +0 -60
- data/vendor/libressl/Makefile.am.common +0 -20
- data/vendor/libressl/OPENBSD_BRANCH +0 -1
- data/vendor/libressl/README.md +0 -238
- data/vendor/libressl/README.mingw.md +0 -43
- data/vendor/libressl/apps/CMakeLists.txt +0 -18
- data/vendor/libressl/apps/Makefile.am +0 -5
- data/vendor/libressl/apps/nc/CMakeLists.txt +0 -67
- data/vendor/libressl/apps/nc/Makefile.am +0 -64
- data/vendor/libressl/apps/nc/compat/accept4.c +0 -17
- data/vendor/libressl/apps/nc/compat/readpassphrase.c +0 -205
- data/vendor/libressl/apps/nc/compat/socket.c +0 -29
- data/vendor/libressl/apps/nc/compat/sys/socket.h +0 -30
- data/vendor/libressl/apps/ocspcheck/CMakeLists.txt +0 -44
- data/vendor/libressl/apps/ocspcheck/Makefile.am +0 -45
- data/vendor/libressl/apps/ocspcheck/compat/.gitignore +0 -0
- data/vendor/libressl/apps/openssl/CMakeLists.txt +0 -97
- data/vendor/libressl/apps/openssl/Makefile.am +0 -108
- data/vendor/libressl/apps/openssl/apps_win.c +0 -138
- data/vendor/libressl/apps/openssl/certhash_win.c +0 -13
- data/vendor/libressl/apps/openssl/compat/clock_gettime_osx.c +0 -26
- data/vendor/libressl/apps/openssl/compat/poll_win.c +0 -329
- data/vendor/libressl/appveyor.yml +0 -53
- data/vendor/libressl/autogen.sh +0 -15
- data/vendor/libressl/check-release.sh +0 -86
- data/vendor/libressl/cmake_export_symbol.cmake +0 -71
- data/vendor/libressl/cmake_uninstall.cmake.in +0 -36
- data/vendor/libressl/config +0 -17
- data/vendor/libressl/configure.ac +0 -165
- data/vendor/libressl/crypto/CMakeLists.txt +0 -863
- data/vendor/libressl/crypto/Makefile.am +0 -962
- data/vendor/libressl/crypto/Makefile.am.arc4random +0 -46
- data/vendor/libressl/crypto/Makefile.am.elf-mips +0 -14
- data/vendor/libressl/crypto/Makefile.am.elf-mips64 +0 -14
- data/vendor/libressl/crypto/Makefile.am.elf-x86_64 +0 -35
- data/vendor/libressl/crypto/Makefile.am.macosx-x86_64 +0 -35
- data/vendor/libressl/crypto/Makefile.am.masm-x86_64 +0 -22
- data/vendor/libressl/crypto/Makefile.am.mingw64-x86_64 +0 -23
- data/vendor/libressl/crypto/arch/aarch64/crypto_cpu_caps_darwin.c +0 -60
- data/vendor/libressl/crypto/arch/aarch64/crypto_cpu_caps_linux.c +0 -62
- data/vendor/libressl/crypto/arch/aarch64/crypto_cpu_caps_none.c +0 -26
- data/vendor/libressl/crypto/arch/aarch64/crypto_cpu_caps_windows.c +0 -36
- data/vendor/libressl/crypto/arch/loongarch64/crypto_arch.h +0 -21
- data/vendor/libressl/crypto/arch/mips/crypto_arch.h +0 -21
- data/vendor/libressl/crypto/bn/arch/loongarch64/bn_arch.h +0 -23
- data/vendor/libressl/crypto/bn/arch/mips/bn_arch.h +0 -24
- data/vendor/libressl/crypto/compat/.gitignore +0 -31
- data/vendor/libressl/crypto/compat/arc4random.h +0 -41
- data/vendor/libressl/crypto/compat/b_win.c +0 -55
- data/vendor/libressl/crypto/compat/bsd-asprintf.c +0 -96
- data/vendor/libressl/crypto/compat/crypto_lock_win.c +0 -56
- data/vendor/libressl/crypto/compat/explicit_bzero_win.c +0 -13
- data/vendor/libressl/crypto/compat/freezero.c +0 -32
- data/vendor/libressl/crypto/compat/getdelim.c +0 -78
- data/vendor/libressl/crypto/compat/getline.c +0 -40
- data/vendor/libressl/crypto/compat/getopt_long.c +0 -528
- data/vendor/libressl/crypto/compat/getpagesize.c +0 -18
- data/vendor/libressl/crypto/compat/getprogname_linux.c +0 -23
- data/vendor/libressl/crypto/compat/getprogname_unimpl.c +0 -7
- data/vendor/libressl/crypto/compat/getprogname_windows.c +0 -13
- data/vendor/libressl/crypto/compat/posix_win.c +0 -296
- data/vendor/libressl/crypto/compat/syslog_r.c +0 -19
- data/vendor/libressl/crypto/compat/ui_openssl_win.c +0 -334
- data/vendor/libressl/dist.sh +0 -22
- data/vendor/libressl/gen-coverage-report.sh +0 -58
- data/vendor/libressl/gen-openbsd-tags.sh +0 -20
- data/vendor/libressl/include/CMakeLists.txt +0 -61
- data/vendor/libressl/include/Makefile.am +0 -79
- data/vendor/libressl/include/arch/loongarch64/opensslconf.h +0 -150
- data/vendor/libressl/include/arch/mips/opensslconf.h +0 -150
- data/vendor/libressl/include/compat/arpa/inet.h +0 -15
- data/vendor/libressl/include/compat/arpa/nameser.h +0 -25
- data/vendor/libressl/include/compat/cet.h +0 -19
- data/vendor/libressl/include/compat/dirent.h +0 -17
- data/vendor/libressl/include/compat/dirent_msvc.h +0 -611
- data/vendor/libressl/include/compat/endian.h +0 -161
- data/vendor/libressl/include/compat/err.h +0 -95
- data/vendor/libressl/include/compat/fcntl.h +0 -32
- data/vendor/libressl/include/compat/getopt.h +0 -50
- data/vendor/libressl/include/compat/limits.h +0 -25
- data/vendor/libressl/include/compat/netdb.h +0 -10
- data/vendor/libressl/include/compat/netinet/in.h +0 -19
- data/vendor/libressl/include/compat/netinet/ip.h +0 -49
- data/vendor/libressl/include/compat/netinet/tcp.h +0 -10
- data/vendor/libressl/include/compat/poll.h +0 -63
- data/vendor/libressl/include/compat/pthread.h +0 -122
- data/vendor/libressl/include/compat/readpassphrase.h +0 -44
- data/vendor/libressl/include/compat/resolv.h +0 -24
- data/vendor/libressl/include/compat/stdint.h +0 -31
- data/vendor/libressl/include/compat/stdio.h +0 -65
- data/vendor/libressl/include/compat/stdlib.h +0 -57
- data/vendor/libressl/include/compat/string.h +0 -98
- data/vendor/libressl/include/compat/sys/_null.h +0 -18
- data/vendor/libressl/include/compat/sys/ioctl.h +0 -11
- data/vendor/libressl/include/compat/sys/mman.h +0 -19
- data/vendor/libressl/include/compat/sys/param.h +0 -15
- data/vendor/libressl/include/compat/sys/queue.h +0 -536
- data/vendor/libressl/include/compat/sys/select.h +0 -10
- data/vendor/libressl/include/compat/sys/socket.h +0 -18
- data/vendor/libressl/include/compat/sys/stat.h +0 -129
- data/vendor/libressl/include/compat/sys/time.h +0 -37
- data/vendor/libressl/include/compat/sys/tree.h +0 -1006
- data/vendor/libressl/include/compat/sys/types.h +0 -69
- data/vendor/libressl/include/compat/sys/uio.h +0 -17
- data/vendor/libressl/include/compat/syslog.h +0 -38
- data/vendor/libressl/include/compat/time.h +0 -59
- data/vendor/libressl/include/compat/unistd.h +0 -83
- data/vendor/libressl/include/compat/win32netcompat.h +0 -57
- data/vendor/libressl/include/openssl/Makefile.am.tpl +0 -45
- data/vendor/libressl/libcrypto.pc.in +0 -28
- data/vendor/libressl/libressl.pub +0 -2
- data/vendor/libressl/libssl.pc.in +0 -28
- data/vendor/libressl/libtls.pc.in +0 -28
- data/vendor/libressl/m4/ax_add_fortify_source.m4 +0 -80
- data/vendor/libressl/m4/ax_check_compile_flag.m4 +0 -53
- data/vendor/libressl/m4/check-hardening-options.m4 +0 -110
- data/vendor/libressl/m4/check-libc.m4 +0 -189
- data/vendor/libressl/m4/check-os-options.m4 +0 -181
- data/vendor/libressl/m4/disable-compiler-warnings.m4 +0 -44
- data/vendor/libressl/man/CMakeLists.txt +0 -26
- data/vendor/libressl/man/links +0 -2780
- data/vendor/libressl/man/update_links.sh +0 -25
- data/vendor/libressl/openssl.pc.in +0 -11
- data/vendor/libressl/patches/bn_shift.patch +0 -34
- data/vendor/libressl/patches/crypto_arch.h.patch +0 -34
- data/vendor/libressl/patches/crypto_namespace.h.patch +0 -22
- data/vendor/libressl/patches/netcat.c.patch +0 -178
- data/vendor/libressl/patches/openssl.c.patch +0 -12
- data/vendor/libressl/patches/opensslfeatures.h.patch +0 -49
- data/vendor/libressl/patches/patch-amd64-crypto-cpu-caps.c.patch +0 -20
- data/vendor/libressl/patches/patch-i386-crypto-cpu-caps.c.patch +0 -20
- data/vendor/libressl/patches/speed.c.patch +0 -114
- data/vendor/libressl/patches/ssl_namespace.h.patch +0 -21
- data/vendor/libressl/patches/tls.h.patch +0 -16
- data/vendor/libressl/patches/tls_config.c.patch +0 -15
- data/vendor/libressl/patches/win32_amd64_bn_arch.h.patch +0 -28
- data/vendor/libressl/patches/windows_headers.patch +0 -80
- data/vendor/libressl/scripts/config.guess +0 -1774
- data/vendor/libressl/scripts/config.sub +0 -1907
- data/vendor/libressl/scripts/i686-w64-mingw32.cmake +0 -9
- data/vendor/libressl/scripts/test +0 -210
- data/vendor/libressl/scripts/wrap-compiler-for-flag-check +0 -31
- data/vendor/libressl/scripts/x86_64-w64-mingw32.cmake +0 -9
- data/vendor/libressl/ssl/CMakeLists.txt +0 -183
- data/vendor/libressl/ssl/Makefile.am +0 -187
- data/vendor/libressl/tests/CMakeLists.txt +0 -970
- data/vendor/libressl/tests/Makefile.am +0 -944
- data/vendor/libressl/tests/aeadtest.sh +0 -30
- data/vendor/libressl/tests/arc4randomforktest.sh +0 -21
- data/vendor/libressl/tests/asn1time_small.test +0 -10
- data/vendor/libressl/tests/cmake/CMakeLists.txt +0 -52
- data/vendor/libressl/tests/cmake/crypto.c +0 -7
- data/vendor/libressl/tests/cmake/ssl.c +0 -6
- data/vendor/libressl/tests/cmake/tls.c +0 -6
- data/vendor/libressl/tests/compat/pipe2.c +0 -186
- data/vendor/libressl/tests/dtlstest.sh +0 -28
- data/vendor/libressl/tests/evptest.sh +0 -22
- data/vendor/libressl/tests/keypairtest.sh +0 -27
- data/vendor/libressl/tests/mlkem_tests.sh +0 -39
- data/vendor/libressl/tests/ocsptest.bat +0 -25
- data/vendor/libressl/tests/ocsptest.sh +0 -23
- data/vendor/libressl/tests/openssl.cnf +0 -29
- data/vendor/libressl/tests/optionstest.c +0 -381
- data/vendor/libressl/tests/pidwraptest.c +0 -85
- data/vendor/libressl/tests/pidwraptest.sh +0 -26
- data/vendor/libressl/tests/quictest.bat +0 -27
- data/vendor/libressl/tests/quictest.sh +0 -30
- data/vendor/libressl/tests/renegotiation_test.bat +0 -27
- data/vendor/libressl/tests/renegotiation_test.sh +0 -30
- data/vendor/libressl/tests/rfc5280time_small.test +0 -10
- data/vendor/libressl/tests/servertest.bat +0 -27
- data/vendor/libressl/tests/servertest.sh +0 -30
- data/vendor/libressl/tests/shutdowntest.bat +0 -27
- data/vendor/libressl/tests/shutdowntest.sh +0 -30
- data/vendor/libressl/tests/ssltest.bat +0 -32
- data/vendor/libressl/tests/ssltest.sh +0 -48
- data/vendor/libressl/tests/testdsa.bat +0 -47
- data/vendor/libressl/tests/testdsa.sh +0 -57
- data/vendor/libressl/tests/testenc.bat +0 -85
- data/vendor/libressl/tests/testenc.sh +0 -93
- data/vendor/libressl/tests/testrsa.bat +0 -47
- data/vendor/libressl/tests/testrsa.sh +0 -57
- data/vendor/libressl/tests/testssl.bat +0 -171
- data/vendor/libressl/tests/tlstest.bat +0 -27
- data/vendor/libressl/tests/tlstest.sh +0 -28
- data/vendor/libressl/tls/CMakeLists.txt +0 -125
- data/vendor/libressl/tls/Makefile.am +0 -76
- data/vendor/libressl/tls/compat/ftruncate.c +0 -17
- data/vendor/libressl/tls/compat/pread.c +0 -29
- data/vendor/libressl/tls/compat/pwrite.c +0 -29
- data/vendor/libressl/update.sh +0 -460
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'bundler/inline'
|
|
4
|
+
|
|
5
|
+
gemfile do
|
|
6
|
+
source 'https://rubygems.org'
|
|
7
|
+
gem 'uringmachine', path: '..'
|
|
8
|
+
gem 'benchmark'
|
|
9
|
+
gem 'io-event'
|
|
10
|
+
gem 'async'
|
|
11
|
+
gem 'pg'
|
|
12
|
+
gem 'gvltools'
|
|
13
|
+
gem 'openssl'
|
|
14
|
+
gem 'localhost'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
require 'uringmachine/fiber_scheduler'
|
|
18
|
+
require 'socket'
|
|
19
|
+
require 'openssl'
|
|
20
|
+
require 'localhost/authority'
|
|
21
|
+
|
|
22
|
+
GROUPS = 48
|
|
23
|
+
ITERATIONS = 10000
|
|
24
|
+
|
|
25
|
+
SIZE = 1 << 14
|
|
26
|
+
DATA = '*' * SIZE
|
|
27
|
+
|
|
28
|
+
AUTHORITY = Localhost::Authority.fetch
|
|
29
|
+
|
|
30
|
+
def do_io(um)
|
|
31
|
+
GROUPS.times do
|
|
32
|
+
r, w = Socket.socketpair(:AF_UNIX, :SOCK_STREAM, 0)
|
|
33
|
+
r.sync = true
|
|
34
|
+
w.sync = true
|
|
35
|
+
ctx = AUTHORITY.server_context
|
|
36
|
+
ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
|
37
|
+
s1 = OpenSSL::SSL::SSLSocket.new(r, ctx)
|
|
38
|
+
s1.sync_close = true
|
|
39
|
+
um.ssl_set_bio(s1) if um
|
|
40
|
+
Fiber.schedule do
|
|
41
|
+
s1.accept
|
|
42
|
+
ITERATIONS.times { s1.readpartial(SIZE) }
|
|
43
|
+
s1.close rescue nil
|
|
44
|
+
rescue => e
|
|
45
|
+
p e
|
|
46
|
+
p e.backtrace
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
s2 = OpenSSL::SSL::SSLSocket.new(w, OpenSSL::SSL::SSLContext.new)
|
|
50
|
+
s2.sync_close = true
|
|
51
|
+
um.ssl_set_bio(s2) if um
|
|
52
|
+
Fiber.schedule do
|
|
53
|
+
s2.connect
|
|
54
|
+
ITERATIONS.times { s2.write(DATA) }
|
|
55
|
+
s2.close rescue nil
|
|
56
|
+
rescue => e
|
|
57
|
+
p e
|
|
58
|
+
p e.backtrace
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def do_um_io(um)
|
|
64
|
+
GROUPS.times do
|
|
65
|
+
r, w = Socket.socketpair(:AF_UNIX, :SOCK_STREAM, 0)
|
|
66
|
+
r.sync = true
|
|
67
|
+
w.sync = true
|
|
68
|
+
ctx = AUTHORITY.server_context
|
|
69
|
+
ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
|
70
|
+
s1 = OpenSSL::SSL::SSLSocket.new(r, ctx)
|
|
71
|
+
s1.sync_close = true
|
|
72
|
+
um.ssl_set_bio(s1)
|
|
73
|
+
Fiber.schedule do
|
|
74
|
+
s1.accept
|
|
75
|
+
ITERATIONS.times { um.ssl_read(s1, +'', SIZE) }
|
|
76
|
+
s1.close rescue nil
|
|
77
|
+
rescue => e
|
|
78
|
+
p e
|
|
79
|
+
p e.backtrace
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
s2 = OpenSSL::SSL::SSLSocket.new(w, OpenSSL::SSL::SSLContext.new)
|
|
83
|
+
s2.sync_close = true
|
|
84
|
+
um.ssl_set_bio(s2)
|
|
85
|
+
Fiber.schedule do
|
|
86
|
+
s2.connect
|
|
87
|
+
ITERATIONS.times { um.ssl_write(s2, DATA, DATA.bytesize) }
|
|
88
|
+
s2.close rescue nil
|
|
89
|
+
rescue => e
|
|
90
|
+
p e
|
|
91
|
+
p e.backtrace
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def run(custom_bio, um_io)
|
|
97
|
+
machine = UM.new
|
|
98
|
+
scheduler = UM::FiberScheduler.new(machine)
|
|
99
|
+
Fiber.set_scheduler(scheduler)
|
|
100
|
+
if um_io
|
|
101
|
+
do_um_io(machine)
|
|
102
|
+
else
|
|
103
|
+
do_io(custom_bio ? machine : nil)
|
|
104
|
+
end
|
|
105
|
+
scheduler.join
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
Benchmark.bm do |b|
|
|
109
|
+
b.report("stock") { run(false, false) }
|
|
110
|
+
b.report("UM BIO") { run(true, false) }
|
|
111
|
+
b.report("UM I/O") { run(true, true) }
|
|
112
|
+
end
|
data/benchmark/sqlite.rb
CHANGED
data/docs/design/buffer_pool.md
CHANGED
|
@@ -37,7 +37,7 @@ buffers, to using managed buffers from the buffer pool.
|
|
|
37
37
|
is used to interact with the data read/received as it becomes available. The
|
|
38
38
|
stream instance methods may block until enough data is available in the
|
|
39
39
|
relevant buffers.
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
Example:
|
|
42
42
|
|
|
43
43
|
```ruby
|
data/docs/wroclove.rb.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# UringMachine - High Performance Concurrency for Ruby Using io_uring
|
|
2
|
+
|
|
3
|
+
https://www.papercall.io/talks/413880/children/413881
|
|
4
|
+
|
|
5
|
+
## Structure
|
|
6
|
+
|
|
7
|
+
- Introduction: the name (1)
|
|
8
|
+
- What is io_uring (2)
|
|
9
|
+
- How UringMachine works (4)
|
|
10
|
+
- The liburing API
|
|
11
|
+
- Submitting an operation
|
|
12
|
+
- Fiber switching and the runqueue
|
|
13
|
+
- Waiting for and processing CQEs
|
|
14
|
+
- The UringMachine model:
|
|
15
|
+
- exhaust all CPU-bound work, submit I/O work to kernel
|
|
16
|
+
- Wait for and process completions
|
|
17
|
+
- repeat
|
|
18
|
+
- The UringMachine API (7)
|
|
19
|
+
- More or less equivalent to the Unix I/O API
|
|
20
|
+
- Synchronization: `UM::Mutex`, `UM::Queue`
|
|
21
|
+
- Useful abstractions for multishot operations
|
|
22
|
+
- OpenSSL support
|
|
23
|
+
- Custom BIO
|
|
24
|
+
- Streams / Automatic buffer management
|
|
25
|
+
- Utilities and advanced usage: `.inotify`, `.pipe`, `#splice`
|
|
26
|
+
- Timeouts and cancellations (4)
|
|
27
|
+
- Timeout - the basic design
|
|
28
|
+
- The challenges of cancellation
|
|
29
|
+
- double life cycle
|
|
30
|
+
- holding on to buffers
|
|
31
|
+
- ensuring the lifetime of relevant objects when doing an async operation.
|
|
32
|
+
- the TRANSIENT list of ops, for async operations (e.g. `#write_async` -
|
|
33
|
+
how to do we hold on to the write buffer.)
|
|
34
|
+
- how in general we mark the objects involved in async
|
|
35
|
+
- Integration with the Ruby ecosystem (6)
|
|
36
|
+
- The Fiber::Scheduler interface: the good, the bad and the ugly
|
|
37
|
+
- Dealing with CPU-bound workloads
|
|
38
|
+
- SQLite and Extralite in particular (`on_progress` handler)
|
|
39
|
+
- Performance (3)
|
|
40
|
+
- Benchmarks
|
|
41
|
+
- CPU-bound / IO-bound: how UringMachine deals with mixed workloads
|
|
42
|
+
- Applications (3)
|
|
43
|
+
- TP2 / Syntropy
|
|
44
|
+
- Uma - Rack-compatible app server
|
|
45
|
+
- Compare performance of a Rails app on Uma / Falcon / Puma
|
|
46
|
+
- Future directions (3)
|
|
47
|
+
- Further contributions to Ruby:
|
|
48
|
+
- Support for Socket I/O in Fiber::Scheduler
|
|
49
|
+
- More stress testing, prove stability
|
|
50
|
+
- More performance research
|
|
51
|
+
- Make Uma into a first-class app server for Ruby
|
|
52
|
+
- Introduce higher-level
|
data/ext/um/extconf.rb
CHANGED
|
@@ -54,6 +54,21 @@ if !find_library('uring', nil, File.join(liburing_path, 'src'))
|
|
|
54
54
|
raise "Couldn't find liburing.a"
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
+
if !have_header("openssl/ssl.h")
|
|
58
|
+
raise "Couldn't find OpenSSL headers"
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
if !have_library("ssl", "SSL_new")
|
|
62
|
+
raise "Couldn't find OpenSSL library"
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
version_ok = checking_for("OpenSSL version >= 1.1.1") {
|
|
66
|
+
try_static_assert("OPENSSL_VERSION_NUMBER >= 0x10101000L", "openssl/opensslv.h")
|
|
67
|
+
}
|
|
68
|
+
unless version_ok
|
|
69
|
+
raise "OpenSSL >= 1.1.1 or LibreSSL >= 3.9.0 is required"
|
|
70
|
+
end
|
|
71
|
+
|
|
57
72
|
have_func("&rb_process_status_new")
|
|
58
73
|
|
|
59
74
|
$defs << "-DUM_KERNEL_VERSION=#{config[:kernel_version]}"
|