๐ Hello
Greetings. Welcome to the documentation of the dart-iouring-transport (DIOT) library.
The main purpose of this project is the implementation of different kinds of transport using io_uring Linux API.
๐ง Reasoning
I need a transport. I need to communicate over the network and with the file system.
Also, I want to use Dart and Linux only.
Current Dart IO implementation is based on Linux sockets, files, and EPOLL.
The implementation is hidden inside Dart SDK and if I want to improve it, there will be complications.
So, I've decided to take the most performant and modern Linux IO - io_uring
and implement my own IO with Dart.
Implemented features:
- TCP
- UDP
- UNIX socket streams
- Files
- Asynchronous execution (leveraging Dart streams and futures)
๐จ Usage
There are requirements for Linux configuration to launch DIOT-based projects:
* hard nofile 1048576
* soft nofile 1048576
* hard memlock unlimited
* soft memlock unlimited
And some optimal configurations (rmem
and wmem
are very important values):
fs.file-max = 2097152
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
net.ipv4.tcp_synack_retries = 2
net.ipv4.ip_local_port_range = 2000 65535
net.ipv4.tcp_rfc1337 = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_keepalive_intvl = 15
net.core.rmem_default = 31457280
net.core.rmem_max = 33554432
net.core.wmem_default = 31457280
net.core.wmem_max = 33554432
net.core.somaxconn = 65535
net.core.netdev_max_backlog = 65536
net.core.optmem_max = 25165824
net.ipv4.tcp_mem = 786432 1048576 26777216
net.ipv4.udp_mem = 65536 131072 262144
net.ipv4.tcp_rmem = 8192 87380 33554432
net.ipv4.udp_rmem_min = 16384
net.ipv4.tcp_wmem = 8192 65536 33554432
net.ipv4.udp_wmem_min = 16384
net.ipv4.tcp_max_tw_buckets = 1440000
- Initiate a Dart project with
pubspec.yaml
. - Append the following section to your dependencies:
iouring_transport:
git:
url: https://github.com/antonbashir/dart-iouring-transport/
path: dart
- Run
dart pub get
. - Refer to the API for implementation details. Enjoy!
๐ฅ Samples
A basic sample of usage lives here.
โ Limitations
There are some features which I don't implement:
- non-Linux platform - because of IOUring
๐จโ๐ป Contribution
Issues about wanted functions or existing bugs are always welcome.