3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00
Commit graph

108 Commits

Autor SHA1 Nachricht Datum
Andrew Steinborn
742b8d98cb Fix noexecstack for natives. 2020-05-20 04:55:55 -04:00
Andrew Steinborn
9edbef981c Uncomment compile lines from script 2020-02-18 01:35:54 -05:00
Andrew Steinborn
b3ac73a51e Use Cloudflare zlib for more aggressive optimizations 2020-02-18 01:34:39 -05:00
Andrew Steinborn
496027f7c1 Add AMD64-specific compile script 2020-02-18 01:15:33 -05:00
Andrew Steinborn
75359256b3 Introduce velocity.natives-tmpdir property for properly handling noexec /tmp 2019-11-29 14:27:27 -05:00
Andrew Steinborn
2f55912995 Graceful fallback when /tmp is amounted noexec on Linux
Fixes #260
2019-11-29 12:04:12 -05:00
Andrew Steinborn
af0903050d Make sure in-place AES respects reader index 2019-11-09 21:30:46 -05:00
Andrew Steinborn
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
Andrew Steinborn
6ff5cac4d3 Fix issues with decoding and Java fallback native 2019-10-19 23:56:44 -04:00
Joe Hirschfeld
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
Andrew Steinborn
20559e059d Properly rethrow DataFormatException in Java 11+ compressor 2019-10-05 14:44:05 -04:00
Andrew Steinborn
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
Andrew Steinborn
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
Andrew Steinborn
3a77068088 Slightly more accurate natives check 2019-09-07 00:15:10 -04:00
Andrew Steinborn
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
Andrew Steinborn
dab9c9a382 Use Netty thread factory to take advantage of FastThreadLocal
This should reduce CPU usage slightly.
2019-07-02 02:19:52 -04:00
Andrew Steinborn
5a209a098c Fix memory leak in NativeVelocityCipher 2019-06-22 16:03:55 -04:00
Andrew Steinborn
5fa5d9567d Remove unused NativeConstants 2019-06-11 02:05:54 -04:00
Andrew Steinborn
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
Andrew Steinborn
b0736548a9 Strengthen check in JavaVelocityCompressor 2019-06-09 04:43:24 -04:00
Andrew Steinborn
b19d36e939 Strictly enforce packet size limits for incoming compressed packets 2019-06-09 04:25:13 -04:00
Andrew Steinborn
b881e9cf04 Do a small sanity check, however 2019-05-21 00:58:52 -04:00
Andrew Steinborn
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
Willsr71
961e3ece27 Fix DataFormatException with java decompression (#195) 2019-04-27 19:04:28 -04:00
Andrew Steinborn
1661cece2d
An Easter basket bearing gifts! (#191)
* Delay switch to new server until after JoinGame is sent.

Unfortunately, in some cases (especially vanilla Minecraft) some login
disconnects are sent after ServerLoginSuccess but before JoinGame.
We've been using ServerLoginSuccess but it has caused too many problems.
Now Velocity will switch to a stripped-down version of the play session
handler until JoinGame is received. This handler does very little by
itself: it simply forwards plugin messages (for Forge) and waits for the
JoinGame packet from the server.

This is an initial version: only vanilla Minecraft 1.12.2 was tested.
However this is the way Waterfall without entity rewriting does server
switches (which, in turn, is inherited from BungeeCord).

* Move to Gradle 5 and Error Prone.
2019-04-24 14:36:49 -04:00
Andrew Steinborn
d8e7f87506 Forgot to update the JNI compile script for Linux. 2019-01-11 14:15:07 -05:00
Andrew Steinborn
9daa6c3a64 Prettify JNI stuff. 2019-01-11 14:13:13 -05:00
Andrew Steinborn
1ddeb85f60 Try to reduce JNI calls into compressor.
Comparatively speaking, JNI calls are very expensive, so we want to
reduce them as much as possible.
2019-01-10 21:10:00 -05:00
Andrew Steinborn
466d06216d Fix minor bug in JavaVelocityCipher 2018-12-30 11:08:13 -05:00
Andrew Steinborn
25773cd366 Fix typo, clarification, pre-size buffer in ensureCompatible(). 2018-12-30 07:18:19 -05:00
Andrew Steinborn
ae850443ad Fix build due to checkstyle 2018-12-30 06:50:44 -05:00
Andrew Steinborn
8588e7f1fe Optimize native handling further.
We now try to work within the boundaries given by the native. In the
case of Java natives, we work with byte arrays. With natives, always use
direct buffers.

However, the numbers do favor the natives, since they work with direct
byte buffers, without any copying. For the most part, this commit is
intended to improve the lives of Velocity users on Windows.
2018-12-30 06:16:04 -05:00
Andrew Steinborn
095a478440 Always ensure we don't pass a heap ByteBuf to the natives. 2018-12-30 04:53:47 -05:00
Andrew Steinborn
1c50922cba Make sure we can get memory addresses before we think about natives. 2018-12-30 04:33:10 -05:00
Andrew Steinborn
9bbe25fc90 Improve efficiency of Java implementation of natives. 2018-12-28 13:02:46 -05:00
Andrew Steinborn
2ab84f3775 Fix missing throws clause 2018-12-24 12:19:40 -05:00
Andrew Steinborn
e690d88fa0 Generic MBEDTLS_ROOT 2018-12-24 12:18:36 -05:00
Andrew Steinborn
41592afade Allow native crypto to always be selected.
This removes the need to patch Velocity to enable the native crypto
support, if compiled.
2018-12-23 23:02:51 -05:00
Andrew Steinborn
868976e09c Add Javadoc and remove all Checkstyle issues from API and natives. 2018-11-15 19:04:39 -05:00
Andrew Steinborn
1310cd2c53 Mix of Checkstyle and SonarLint. 2018-10-28 03:18:15 -04:00
Andrew Steinborn
25b5e00125 Reformat with Google code style and enforce Checkstyle.
Fixes #125
2018-10-27 23:45:36 -04:00
Andrew Steinborn
32829c5637
Checker Framework integration (#126) 2018-10-27 21:45:42 -04:00
Andrew Steinborn
50c27066e2 Import cleanup 2018-09-19 14:56:49 -04:00
Andrew Steinborn
fc48db62b5 Improve native initialization logic, again 2018-09-17 15:02:49 -04:00
Andrew Steinborn
e75ec71b32 Improve native initialization logic
This uses the double-check pattern as recommended in Effective Java.
2018-09-17 01:03:17 -04:00
Andrew Steinborn
168c36facf Bring to latest master 2018-08-25 01:13:00 -04:00
Andrew Steinborn
a37a0d6665 Merge branch 'master' into native-crypto
# Conflicts:
#	native/src/main/java/com/velocitypowered/natives/util/Natives.java
2018-08-25 01:12:26 -04:00
kashike
6a3a5a0458 minor shuffle to log messages 2018-08-12 01:36:37 -07:00
Andrew Steinborn
0c7815b6e9 Disable the natives test for now 2018-08-04 23:48:31 -04:00
Andrew Steinborn
8aa1fe524e Native cryptography support using mbed TLS 2018-08-04 23:46:41 -04:00
Andrew Steinborn
9438d087e2 Refactor cipher logic. 2018-08-04 00:09:25 -04:00
Andrew Steinborn
68d315d1d3 Improvements for natives. 2018-08-02 23:52:21 -04:00
Andrew Steinborn
b720b691de Revert experimental change 2018-08-02 14:22:42 -04:00
Andrew Steinborn
4bc4a1ec6a Use singular plurals, clean up some stuff. 2018-08-02 14:07:32 -04:00
Andrew Steinborn
2e59138428 Cleaned up native code. 2018-08-02 00:43:38 -04:00
Andrew Steinborn
850b2f7958 Add disposal checks. 2018-08-01 23:14:22 -04:00
Andrew Steinborn
fb4e6fd8f1 JNI native zlib compression 🔥 2018-08-01 22:22:09 -04:00
Andrew Steinborn
22dd4bbb99 Split natives. Add proper disposal for natives. 2018-08-01 00:20:51 -04:00