The state of the Pragmatica (Feb 2022)

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…


This content originally appeared on DEV Community and was authored by DEV Community

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).

What's new

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

Along with 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 Option<T>, Result<T>, etc.
  • 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).

What's next

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.


This content originally appeared on DEV Community and was authored by DEV Community


Print Share Comment Cite Upload Translate Updates
APA

DEV Community | Sciencx (2022-02-23T11:01:46+00:00) The state of the Pragmatica (Feb 2022). Retrieved from https://www.scien.cx/2022/02/23/the-state-of-the-pragmatica-feb-2022/

MLA
" » The state of the Pragmatica (Feb 2022)." DEV Community | Sciencx - Wednesday February 23, 2022, https://www.scien.cx/2022/02/23/the-state-of-the-pragmatica-feb-2022/
HARVARD
DEV Community | Sciencx Wednesday February 23, 2022 » The state of the Pragmatica (Feb 2022)., viewed ,<https://www.scien.cx/2022/02/23/the-state-of-the-pragmatica-feb-2022/>
VANCOUVER
DEV Community | Sciencx - » The state of the Pragmatica (Feb 2022). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/02/23/the-state-of-the-pragmatica-feb-2022/
CHICAGO
" » The state of the Pragmatica (Feb 2022)." DEV Community | Sciencx - Accessed . https://www.scien.cx/2022/02/23/the-state-of-the-pragmatica-feb-2022/
IEEE
" » The state of the Pragmatica (Feb 2022)." DEV Community | Sciencx [Online]. Available: https://www.scien.cx/2022/02/23/the-state-of-the-pragmatica-feb-2022/. [Accessed: ]
rf:citation
» The state of the Pragmatica (Feb 2022) | DEV Community | Sciencx | https://www.scien.cx/2022/02/23/the-state-of-the-pragmatica-feb-2022/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.