Eventloop Module

Eventloop module is the foundation of other modules that run their code inside event loops and threads. Useful for building client-server applications with high performance requirements.

  • Node.js-like approach for asynchronous I/O (TCP, UDP)
  • Eliminates traditional bottleneck of I/O for further business logic processing
  • Can run multiple event loop threads on available cores
  • Minimal GC pressure: arrays and byte buffers are reused

Examples

  1. TCP Echo Server
  2. TCP Client
  3. TCP Multi Echo Server

To run the examples, you should execute those three lines in the console in appropriate folder:

$ git clone https://github.com/softindex/datakernel-examples.git
$ cd datakernel-examples/examples/eventloop
$ mvn clean package exec:java -Dexec.mainClass=io.datakernel.examples.TcpEchoServerExample
$ # OR
$ mvn clean package exec:java -Dexec.mainClass=io.datakernel.examples.TcpClientExample
$ # OR
$ mvn clean package exec:java -Dexec.mainClass=io.datakernel.examples.MultiEchoServerExample