Another Status Update on Velocity 1.1.0

The last time I wrote a status update on Velocity 1.1.0 was back in November 2019, so we’re overdue for another one.

There have been many, many changes to Velocity 1.1.0 since the last status update. I’ll give you a brief tour over the new things in 1.1.0.

Flush Consolidation

Velocity 1.1.0 now supports flush consolidation. This is a technique used to reduce the amount of time spent inside the operating system when writing data out to a client. Let’s use some diagrams to explain why this is a good idea.

This is what we’d do without flush consolidation:
No flush consolidation
As you can see, the server will end up writing each packet to the player individually. This issues a lot of system calls (what a program uses to tell the kernel to do something) to write out the packet. This is problematic as each system call takes time, and that time has increased since the emergence of the Spectre and Meltdown vulnerabilities.

Flush consolidation can help reduce the cost by pushing all these packets as a group. Here’s another diagram to visualize it:
Flush consolidation
As you can see, we consolidated all five packets and did just one write to the client. That’s much more efficient!

As of today, you can find flush consolidation support in Tuinity.

Other Optimizations

We’ve had an obsessive focus on improving performance and quantifying improvements as much as possible.

Native crypto for everyone: This improves performance by making sure we don’t need to make a copy of packets in memory just to encrypt them. This has taken some time to get right, but with Velocity 1.1.0 we are now using OpenSSL to achieve this instead of mbed TLS. This means better performance on non-x86 architectures and since the support already requires OpenSSL to be installed on client machines, we can provide it to everyone who has OpenSSL. Support for OpenSSL 1.0.x and 1.1.x is now provided.

Faster compression: Velocity now utilizes the highly-optimized libdeflate C library for compressing and decompressing packets. It enjoys use in software dealing with DNA sequencing (amongst others) due to its excellent performance. In particular, the Minecraft PC protocol was amenable to the use of these highly-optimized compression and decompression routines. We’re excited to provide the bleeding edge of high performance software to our servers.

Native aarch64 natives: Velocity now provides full natives for 64-bit Arm on Linux, with Arm clients and servers now growing in popularity (especially as Apple has recently began their migration to Arm). Arm servers show tremendous promise for proxies and potentially also Minecraft servers at scale.

Other micro-optimizations: We’ve optimized and made varint framing 25-35% faster. Every bit of improvement helps!

API Additions

Yes, we added CommandExecuteEvent. Literally everyone was asking for it and we delivered.

We’re also introducing some new beta APIs, starting with PlayerAvailableCommandsEvent which allows plugins to modify the tree of commands sent to the client from a backend server.

Other features

Velocity 1.1.0 now features support for BungeeGuard for providing protection to backend servers where firewalls are not available and you can’t use Velocity’s modern forwarding.

Velocity 1.1.0 has removed support for the Netty async DNS resolver due to problems some users have with it. We’ve replaced it with a generic resolver that does the blocking lookup in a separate thread.

There are plenty of changes that were made in Velocity 1.1.0 I didn’t get time to tell you about! If you’re interested in trying out all the new features, check out our Jenkins for the latest builds.