Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
I have made some investigation on using custom implementations of the JavaSerializationTranscoder using compression .
I have created to one transcoder using GZIP (JavaGzipTranscoder) and another transcoder using LZ4 (JavaLZ4Transcoder).
The JavaGzipTranscoder has bad results but JavaLZ4Transcoder has very similar and sometimes as best times that the JavaSerializationTranscoder using your Benchmark, and the size of the resulting byte array is very small compared with JavaSerializationTranscoder and even compared with KryoTranscoder.
Given the difference of sizes I have made a new Benchmark that takes in account the read/write of the session to a memcache server.
(time is in nanos in this graph)
This gives an edge to JavaLZ4Transcoder over JavaSerializationTranscoder to session bigger that 2kB, and giving a good cut to the session size at the same time. Has JavaLZ4Transcoder can be a direct replacement to JavaSerializationTranscoder this can be a nice upgrade for a lot of people.
Results of the Benchmarks
using-lz4-Benchmark.xlsx
using-lz4-BenchmarkWithMemcache.xlsx
This investigation let me thinking that compression code be a more transversal thing. We can have classes that handles the OutputStream >> byte[] >> InputStream work providing that services to the Transcoders. Removing that code from the Transcoders, and giving the opportunity to have implementation that do compression.
What do you think about that?