These examples aim to represent core DataKernel technologies and show how they can be used for both common and advanced
If you’d like to learn more about basic modules of DataKernel (Promise, ByteBuf etc.), please go to
Basic modules section. With these examples you’ll understand how DataKernel’s building blocks work
from within and the core principles of their efficient asynchronous performance.
If you are up to more complicated web applications, there are Global applications examples -
see how to utilize Global components for developing scalable web applications.
Please note, that to run any of the examples in your console, you should first clone the project from GitHub:
And then install DataKernel locally:
To run the examples in an IDE, you need to clone DataKernel locally
and import it as a Maven project. Then you should set up default working directory of run configurations in your IDE so
that the examples can work correctly. In accordance to DataKernel module structure, the working directory should be set
to the module folder.
In IntelliJ IDEA you can do it in the following way: Run -> Edit configurations -> [Run/Debug Configurations ->
[Templates -> Application] -> [Working directory -> $MODULE_WORKING_DIR$]].
Before running the examples, build the project (Ctrl + F9 for IntelliJ IDEA).
These instructions are repeated in each of the examples’ description just to make sure that everything will work
correctly. Yet if you’ve followed the instructions once, you can omit them from now on.
If you haven’t checked out “Hello World” getting-started example yet, you can start
with it. This simple 5-minutes tutorial represents how to create a basic application in DataKernel-like way.
Then you may continue with some basic modules:
ByteBuf examples - ByteBuf provides efficient
and recyclable byte buffers. The examples will show you how to create and utilize them for different purposes.
Promise examples - Promises were inspired by
Node.js and allow to efficiently handle asynchronous operations. In the examples you’ll see some basic functionality of
Promises along with utilizing them for working with files.
To provide efficient work with objects, their bytecode generation, serialization, encoding or decoding, there are
several corresponding modules:
Codegen examples - see how to set up dynamic
generation of classes and methods in runtime.
Serializer examples - Serializer allows to
serialize and deserialize objects extremely fast. In the examples you can learn how to use Serializer for objects of
Codec example - create efficient
custom codec to encode/decode object to JSON, ByteBuf, Map and List.
DataKernel provides efficient communications between suppliers and consumers (for example, client and server) with
special channels and streams:
CSP examples - the examples demonstrate how to
create channels for communications, ByteBufs parsers and handle Communication Sequential Processes.
HTTP examples - several examples of simple web
applications, ranging from basic HTTP client and server to multithreaded example.
Also check out HTTP Hello World -
a detailed tutorial on how to create a simple but scalable HTTP server with multiple Worker Servers. This example
also demonstrates the core principles of single-threaded Eventloop module.
Net examples - show how to create TCP echo servers
and clients from scratch in a few steps.
Eventloop examples - although Eventloop
is one of the basic modules of DataKernel and is not bound to web applications, these examples demonstrate how
eventloops can be utilized with Net module for developing servers.
RPC example - a simple example of utilizing Remote
Procedure Call module.
Remote key-value storage -
with this detailed guide you can create a remote key-value storage with basic operations “put” and “get” utilizing
RPC and Boot modules.
CRDT example - demonstrates how CRDT (conflict-free
replicated data type) algorithms manage merging of two replicas with conflicting states.