Skip to content

SOLR-18157: Optimize buffer allocation in JavaBinCodec#4208

Open
psalagnac wants to merge 1 commit intoapache:mainfrom
psalagnac:javabin-buffer
Open

SOLR-18157: Optimize buffer allocation in JavaBinCodec#4208
psalagnac wants to merge 1 commit intoapache:mainfrom
psalagnac:javabin-buffer

Conversation

@psalagnac
Copy link
Contributor

https://issues.apache.org/jira/browse/SOLR-18157

This implements a smarter allocation strategy using powers of 2 for the internal buffer of JavaBinCodec. The goal is to reduce the number of allocations.

Added a JMH benchmark suite to measure serialization performance with different batch sizes. I see a small improvement in throughput locally. I expect the impact to be slightly higher in JVMs with big heap for other reasons.

### Before
Benchmark             (batchSize)   (type)   Mode  Cnt     Score     Error  Units
RequestWriters.write           10  javabin  thrpt    5  5770,665 ± 636,538  ops/s
RequestWriters.write          100  javabin  thrpt    5   591,845 ±  11,787  ops/s
RequestWriters.write         1000  javabin  thrpt    5    58,766 ±   8,620  ops/s
RequestWriters.write        10000  javabin  thrpt    5     5,980 ±   0,044  ops/s

### AFTER
Benchmark             (batchSize)   (type)   Mode  Cnt     Score     Error  Units
RequestWriters.write           10  javabin  thrpt    5  5824,500 ± 482,134  ops/s
RequestWriters.write          100  javabin  thrpt    5   601,498 ±   4,600  ops/s
RequestWriters.write         1000  javabin  thrpt    5    59,621 ±   0,995  ops/s
RequestWriters.write        10000  javabin  thrpt    5     5,988 ±   0,108  ops/s

Implements a smarter allocation strategy using powers of 2 for the internal buffer of JavaBinCodec.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant