Since last publication, Pragmatica changed significantly. It started as a minimal set of classes necessary for Pragmatic Functional Java coding style, but over the last few months it grew into the fast asynchronous I/O core with support for network and file I/O (unlike, for example, Netty, which provides only network I/O).
The main change is that Pragmatica now supports representation of all special states:
Option<T>for missing values
Result<T>for "error or result" values
Promise<T>for "not yet available" values
Promise<T> a whole new asynchronous I/O subsystem was implemented. It is based on modern asynchronous API which was recently added to the Linux kernel - io_uring. This enabled implementation of concurrency model which supports asynchronous operations for both, network and file I/O.
The implementation requires small number of threads (~1 thread per CPU core) and minimal synchronization overhead, which results in good throughput and scalability. Preliminary benchmarks show that this implementation has better throughput (up to 30% at high and very high load) than Netty.
The next change is that Pragmatica now consists of few modules:
Core, which contains base classes like
- Proactor, which contains low-level part, implemented as a Proactor pattern using Linux io_uring asynchronous API.
- Async I/O - high level, Promise-based asynchronous API. It also contains (so far minimal) infrastructure for the implementation of various clients and servers (work in progress) as well as few file processing utilities (also WIP).
- Examples (so far only one exists).
Below listed things which will be implemented next (roughly in order of priorities, from highest to lowest).
- Support for remaining io_uring APIs. Among notable ones - sending/receiving of datagram (UDP) packets.
- Run-time parameters configuration.
- Significant parts of the library require testing.
- Documentation and examples for existing code.
- Asynchronous DNS API.
- Support for SSL/TLS.
- More file utilities.
- Higher level protocols, most likely HTTP/1.1 will be first.
As one can see, there is still a lot of work ahead. So, if anyone wants to join and help - feel free to contact me here or at GitHub.