Performance Tuning

This page describes settings that can be applied to increase the performance of Babl server.

To ensure that these settings have a useful effect, it is important to measure performance against a baseline without the settings enabled.

Configuration items below can either be set on the command-line, or included in the config file passed to the BablServer program (in this case, without their -D prefix).

JVM Arguments

Disable Buffer Bounds Checking

When rigorous testing has been completed, and an application has been deployed to production, buffer bounds-checking can be disabled for an extra performance boost.
Performance gain is likely to be a few percent. Any advantage should be measured against the possible downsides. For example, an incorrect buffer read in the application will cause a segmentation fault and program crash.

Disable bounds-checking with this JVM parameter:


Cache Integer Objects

In the Java IO libraries, java.lang.Integer variables are used to represent file-descriptors. Depending on how many sockets are created on the system in use, the value presented below may need to be increased to reduce allocation.

Cache a fixed number of java.lang.Integer values with this JVM parameter:


Prefer IPv4 Network Stack

A hint to the JVM that it should not default to using IPv6 even when the system supports it.

Enable with this JVM parameter:

Trust Non-Static Final Fields

A hint to the JIT compiler that final fields can be trusted as final (i.e. subject to certain optimisations).

Enable with these JVM parameters:

-XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields

Immediate Biased Locking

Perform biased locking immediately. Older JVMs wait several seconds before attempting to bias locks. Since Babl is inherently single-threaded when dealing with synchronized objects (e.g. java.nio.SocketChannel), lock biasing should be performed at start-up.

This setting may have a negligible effect on JDK9+, where intrinsic locks have been replaced with java.util.concurrent.ReentrantLock instances in the java.nio socket components.

Enable with this JVM parameter:


Babl Configuration

Disable Nagle's Algorithm

Setting this flag will tell the operating system to send TCP packets as soon as they are queued, rather than waiting for more data to improve batching.


Use Busy-spin in Server Event-loop

Setting this property configures a busy-spin wait-loop when processing the Server event-loop.
This will reduce latency between the session container and the application, at the expense of higher CPU usage.


Use Busy-spin in Application Event-loop

Setting this property configures a busy-spin wait-loop when communicating with the IPC transport.
This will reduce latency, at the expense of higher CPU usage.