Commit Graph

84 Commits

Author SHA1 Message Date
0f919d7163 Recompile natives for Linux x86_64
Debian 9 was used to compile the libdeflate native and OpenSSL 1.1.x crypto, CentOS for OpenSSL 1.0.x crypto only.
2020-10-27 01:44:14 -04:00
4ca996098c Merge branch 'dev/1.1.0' into further-native-tweaks
# Conflicts:
#	native/compile-linux.sh
2020-10-27 01:30:42 -04:00
5072e1085a Revert server list ping changes
They are broken with ping passthrough.
2020-10-06 11:05:36 -04:00
3bf252cf45 Start optimizing server list ping. 2020-10-04 15:30:28 -04:00
d2b65cb643 Fix velocity-natives module publishing, take 1 2020-09-23 01:05:50 -04:00
dc48eb97f9 Start publishing velocity-natives module
Note that this will remain internal API for Velocity and the publication of the module does not necessarily indicate that they will be stable.
2020-09-23 01:03:18 -04:00
6c348c994c Don't need to call memoryAddress() here as we do it later on anyway 2020-09-21 11:27:47 -04:00
bb31226e09 Clean up more cipher code and make it -Wall + -Werror clean 2020-09-16 00:07:52 -04:00
a49a77a7ef Working on improvements to natives. Not done yet. 2020-09-11 01:46:59 -04:00
5d287306c2 Small code cleanups 2020-09-01 03:25:15 -04:00
c47d25c88a Upgrade to Gradle 6.6 and use SpotBugs.
As a result, at least one real bug was fixed! Nice.
2020-08-21 19:09:04 -04:00
89f98ce57d Make Disposable interface implement Closeable 2020-07-29 05:34:15 -04:00
62703780e1 Fix a few areas of concern spotted by JITWatch 2020-06-27 21:33:05 -04:00
68e5b64c33 Don't contradict yourself. 2020-06-23 10:00:08 -04:00
43223548f4 Update outdated readme for natives. 2020-06-23 09:57:04 -04:00
9dda0ba9dd Commit the other aarch64 native recompiled on Debian 9 2020-06-23 07:55:41 -04:00
f00301e15b Add aarch64 natives compiled on Debian 9 2020-06-22 20:56:07 -04:00
676ce7b7fd Use compression native compiled on CentOS 7 2020-06-22 20:17:52 -04:00
1bb84f81df Rewrite native crypto to use OpenSSL
OpenSSL is much more portable and optimized (important for aarch64) and most systems already have a version.

Unfortunately, OpenSSL likes to break their ABI. Thankfully, Velocity's natives system is very flexible largely, so we can provide multiple versions of this crypto.

Versions of the dynamically-linked crypto were compiled on CentOS 7 (still supported until 2024, uses OpenSSL 1.0.x) and Debian 9 (the oldest distro including OpenSSL 1.1.0, whose LTS supports ends in 2022). The choice of distros was intended to cover most modern distributions (2014 and afterwards).

An ARM compilation (using Debian 9) will be published soon.
2020-06-22 20:14:46 -04:00
877f98b87a Fix typo in LibdeflateVelocityCompressor 2020-06-21 14:14:41 -04:00
f3d5c986da Add Velocity compression native for aarch64
This native has been compiled and tested on Ubuntu 18.04 aarch64 on AWS Graviton2.

The cipher native is at the moment unlikely to provide a performance boost as mbed TLS doesn't provide an accelerated AES extension.
2020-06-04 15:22:03 -04:00
31d1871bd5 Check for AARCH64. 2020-06-04 15:03:27 -04:00
bb69481f99 Lay down foundation for cross-architecture natives
We have dropped the rarely used kqueue and replaced it with the new Netty aarch64
native. In addition, lay down the foundation for other aarch64 natives.
2020-06-04 14:59:22 -04:00
ae8852dc9d Native tests should only run on Linux 2020-05-25 13:29:02 -04:00
793e938dd1 Drop macOS native support
This served a good purpose when I used macOS as a primary development system, but those days are gone (I use Linux now). The spirit of multiple variants is preserved by our special Java 11+ optimized compression.
2020-05-24 10:58:28 -04:00
b3bd773fea Switch out Cloudflare zlib for libdeflate.
libdeflate is significantly faster than vanilla zlib, zlib-ng, and Cloudflare zlib. It is also MIT-licensed (so no licensing concerns). In addition, it simplifies a lot of the native code (something that's been tricky to get right).

While we're at it, I have also taken the time to fine-time compression in Velocity in general. Thanks to this work, native compression only requires one JNI call, an improvement from the more than 2 (sometimes up to 5) that were possible before. This optimization also extends to the existing Java compressors, though they require potentially two JNI calls.
2020-05-24 10:56:26 -04:00
742b8d98cb Fix noexecstack for natives. 2020-05-20 04:55:55 -04:00
9edbef981c Uncomment compile lines from script 2020-02-18 01:35:54 -05:00
b3ac73a51e Use Cloudflare zlib for more aggressive optimizations 2020-02-18 01:34:39 -05:00
496027f7c1 Add AMD64-specific compile script 2020-02-18 01:15:33 -05:00
75359256b3 Introduce velocity.natives-tmpdir property for properly handling noexec /tmp 2019-11-29 14:27:27 -05:00
2f55912995 Graceful fallback when /tmp is amounted noexec on Linux
Fixes #260
2019-11-29 12:04:12 -05:00
af0903050d Make sure in-place AES respects reader index 2019-11-09 21:30:46 -05:00
d73496e8df Introduce zero memory-copy compression for regular Java native
The compression itself is zero-copy in most cases. However, the overhead
needed to copy a direct buffer into a heap buffer (and back) is still
present. If possible, use Linux for best performance.
2019-11-09 17:39:47 -05:00
6ff5cac4d3 Fix issues with decoding and Java fallback native 2019-10-19 23:56:44 -04:00
a16684564b Make AES crypto operations use one buffer
All AES implementations being used are 'copy safe', where the source and
destination arrays may be the same. Lets save ourself a copy and reap
the performance wins!
2019-10-19 19:55:02 -07:00
20559e059d Properly rethrow DataFormatException in Java 11+ compressor 2019-10-05 14:44:05 -04:00
7747679ee1 Implement optimized compression for Java 11+
Using the fact that the Java Deflater/Inflater API now supports
ByteBuffers as of Java 11, we can provide performance benefits equivalent
to the Velocity 1.0.x native compression on servers running Java 11+ on
non-macOS and non-Linux platforms (such as Windows).
2019-10-04 17:08:14 -04:00
e21c33d435 Switch to zlib-ng
zlib-ng boasts higher throughput than regular zlib, by combining patches
from Cloudflare, zlib, and ARM's improvements to zlib along with a more
modern codebase.

Profiling consistently shows that compression is the largest CPU expense
by far, so even a minor speed-up here is significant.
2019-09-08 23:30:28 -04:00
3a77068088 Slightly more accurate natives check 2019-09-07 00:15:10 -04:00
35856fec04 Merge branch 'dev/1.1.0' into natives-java-improvements
# Conflicts:
#	native/src/main/java/com/velocitypowered/natives/encryption/JavaVelocityCipher.java
2019-09-07 00:06:13 -04:00
dab9c9a382 Use Netty thread factory to take advantage of FastThreadLocal
This should reduce CPU usage slightly.
2019-07-02 02:19:52 -04:00
5a209a098c Fix memory leak in NativeVelocityCipher 2019-06-22 16:03:55 -04:00
5fa5d9567d Remove unused NativeConstants 2019-06-11 02:05:54 -04:00
ec32def592 Take advantage of pooled ByteBufs in Java cipher
ByteBufs are pooled in Velocity, so we can achieve lower memory usage
by using what Netty is going to provide to us for free.
2019-06-11 02:04:38 -04:00
b0736548a9 Strengthen check in JavaVelocityCompressor 2019-06-09 04:43:24 -04:00
b19d36e939 Strictly enforce packet size limits for incoming compressed packets 2019-06-09 04:25:13 -04:00
b881e9cf04 Do a small sanity check, however 2019-05-21 00:58:52 -04:00
821a7a45bc Small optimization for NativeVelocityCipher
Instead of going through the general process function, which does extra
checks to ensure that its arguments are sane, move "closer" to the action
by stripping down to the actual implementation.
2019-05-21 00:56:14 -04:00
961e3ece27 Fix DataFormatException with java decompression (#195) 2019-04-27 19:04:28 -04:00