Alternative Java platform, built from the ground up - with its own async I/O core and DI. Ultra high-performance, simple and minimalistic - redefines server-side programming, web-development and highload!
Please note that DataKernel framework was massively improved and restructured into a new project named ActiveJ. Now it's even more streamlined, convenient, and powerful! We highly recommend you to migrate to ActiveJ.
DataKernel is a full-featured alternative web and big data Java framework built from the ground up. It does not use Netty, Jetty, Spring/Guice DI, RxJava, etc. Instead, it features a full application stack: Event Loop, Promises, HTTP, DI, and others, including decentralized big-data technologies and map-reduce algorithms.
No overhead of intermediate abstractions, legacy standards and third-party libraries makes the framework minimalistic, streamlined and lightning-fast!
Just insert this snippet to your terminal...
mvn archetype:generate -DarchetypeGroupId=io.datakernel -DarchetypeArtifactId=archetype-http -DarchetypeVersion=3.1.0
... and open project in your favourite IDE. Then, build the application and run it. Open your browser on localhost:8080 to see the "Hello World" message.
To learn more about DataKernel, visit datakernel.io or follow our 5-minute getting-started guide.
public final class HelloWorldExample {
public static void main(String[] args) throws IOException {
Eventloop eventloop = Eventloop.create();
AsyncHttpServer server = AsyncHttpServer.create(eventloop,
request -> Promise.of(
HttpResponse.ok200()
.withPlainText("Hello, World!")))
.withListenPort(8080);
server.listen();
eventloop.run();
}
}
AsyncHttpServer
is a built-in implementation of an HTTP server that runs asynchronously in a Node.js-inspired Event Loop.
AsyncHttpServer
is up to 20% faster than multithreaded Vert.x server, with 1/2 of CPU usage, on a single core!
public final class HttpHelloWorldExample extends HttpServerLauncher {
@Provides
AsyncServlet servlet() {
return request -> HttpResponse.ok200().withPlainText("Hello, World!");
}
public static void main(String[] args) throws Exception {
Launcher launcher = new HttpHelloWorldExample();
launcher.launch(args);
}
}
HttpServerLauncher
- a predefined DataKernel Launcher that takes care of the application lifecycle and provides needed components for our server
@Provides
- one of the DataKernel DI annotations
AsyncServlet
- asynchronous servlet interface
Promise
- Node.js-inspired async single-threaded Promises, an alternative to CompletableFuture
CompletableFuture
.
public RpcServer rpcServer(Eventloop eventloop) {
return RpcServer.create(eventloop)
.withStreamProtocol(...)
.withMessageTypes(Integer.class)
.withHandler(Integer.class, Integer.class, req -> Promise.of(req * 2));
}
See the docs, examples, and tutorials on our website.
Feel free to open a GitHub issue.