The Jank Busters (and other news)

I recently made several changes to get rid of “jank”, which makes the proxy less efficient and gives players a bad experience. These problems were found with a proxy with 100 players online, so this is pretty significant. I’ll also go ahead and recap changes made over December and early January.

Jank Busted

  • Constant allocation of byte arrays in MinecraftVarintFrameDecoder could result in many, many thousands of objects being allocated by Velocity on top of what was already allocated. This has been fixed by making Velocity use a ByteBuf instead, which is both more correct and allows us to take advantage of Netty’s PooledByteBufAllocator.
  • Velocity would sometimes resolve names using blocking look-ups in the event loop, when it should have been using Netty’s asynchronous name resolver. Having this blocking activity would cause substantial jank. This has been corrected.
  • The connection field in ConnectedPlayer was renamed to reduce the overhead of running YourKit probes on the proxy.
  • We have reduced the number of JNI calls made into native compression code. JNI calls are not particularly cheap, so reducing those calls can only help.
  • The Java-based implementations of natives can now take advantage of byte array-based ByteBufs.

Other Changes

  • Fixed support for SRV records pointing to a Velocity forced host.
  • Velocity now supports sending resource packs to players from the Velocity API.
  • Velocity now supports 1.13-style tab complete for proxy commands.
  • Users no longer receive errors from Velocity if an error occurs in their connection. Velocity will log the exception to the console but users will receive a generic error message instead.
  • Velocity now supports the -1 pseudo-version for status messages only.
  • Velocity now resolves plugin dependencies using a depth-first search instead of using Kahn’s algorithm. This fixes issues with indirect dependencies (think A has no dependencies, B depends on A, and C depends on B (and thus A)).
  • Other enhancements.

Thanks for using Velocity! 2019 has already had an excellent start.