home shape

Improved Java Drivers for ArangoDB 3.1 Release

The upcoming 3.1 release comes with a binary protocol – VelocyStream – to transport VelocyPack (internal storage format of ArangoDB introduced with the 3.0 release) data between ArangoDB and client applications. VelocyPack stores a superset of JSON, is more compact and has a fast attribute lookup. On the other hand, VelocyStream allows to send VelocyPack in an optimized form over the network. We think it would be the right time to update our official Java Driver to modernize it and to let it be the first to fully support VelocyStream.

VelocyStream is the new bi-directional async binary protocol of ArangoDB. It supports sending messages pipelined, multiplexed, uni-directional or bi-directional. The messages themselves are VelocyPack objects.

Alongside the http protocol, ArangoDB also uses VelocyPack and VelocyStream. We have decided that the new Java Driver will exclusively use the new more efficient binary protocol. The new version natively supports de-/serialization of Java objects in and out of VelocyPack and also parsing of JSON documents from and in VelocyPack. But this does not only belong to the client – server communication. As a developer you can work directly on the raw VelocyPack returned by ArangoDB over a light API and profit from the performance and data-types supported by VelocyPack like date, binary and different number-types which is much more comfortable than JSON.

To get a stable driver that takes into consideration all benefits of the new ArangoDB release, the updated version of our Java driver renounces the http protocol and goes with VelocyStream.

ArangoDB Java Driver 4.0:

In combination with all of the above and other improvements of ArangoDB 3.1, the new Java Driver (ArangoDB-Java-Driver 4.0) shows up to 4 times better performance in synchronous operations compared to the previous 3.0 version of the driver.

Performance Java-Driver – synchronous read – single Server:

velocystream-java-driver

We also have a detailed 10 min Java tutorial for the updated driver, explaining how to perform operations in ArangoDB.

Java Driver with asynchronous support:

ArangoDB 3.1 and VelocyStream enable the possibility of asynchronous communication. By using Java 8 it becomes possible to get the right API for asynchronous computation – CompletableFuture.

Keeping that in mind, we have decided to also offer a second driver which supports asynchronous calls showing an even better performance – ArangoDB-Java-Driver-Async 4.0. Here we went with Java 8 and built an additional very strong async driver powered by the CompletableFuture.

What about Multi-document operations?

What can be better than reducing the time of a requests? Of course reducing the number of needed requests.

The two new drivers now support multi-document operations for insert/delete/update/replace. So instead of batching thousands of documents with just as many requests into ArangoDB, you can now insert thousands of documents together with only one request. Which dramatically reduces network traffic and allows for better performance.

So here we go, here are the two updated versions for the Java crowd of our community:

ArangoDB-Java-Driver 4.0
ArangoDB-Java-Driver-Async 4.0

Try them out with the RC2 of ArangoDB 3.1 and let us know what you think.

Michele

Michele Rastelli

Michele is a software engineer with experience in algorithms, web architectures, and data modeling. He has been working as a technical leader for web startups, designing and implementing scalable and resilient microservices applications. He currently works at ArangoDB on the development of the Java driver and frameworks integrations.

Leave a Comment





Get the latest tutorials, blog posts and news: