jasonk000 commented on code in PR #12109:
URL: https://github.com/apache/druid/pull/12109#discussion_r1090882727
##########
processing/src/main/java/org/apache/druid/segment/DimensionDictionary.java:
##########
@@ -47,102 +47,146 @@
private final Object2IntMap<T> valueToId = new Object2IntOpenHashMap<>();
private final List<T> idToValue = new ArrayList<>();
- private final ReentrantReadWriteLock lock;
+ private final StampedLock lock;
public DimensionDictionary()
{
- this.lock = new ReentrantReadWriteLock();
+ this.lock = new StampedLock();
Review Comment:
I've tested this with a `synchronized` solution as well, [code is all
here](https://github.com/apache/druid/compare/master...jasonk000:druid:dimension-dictionary-perf-synchronized).
In short, the results
```
ORGIINAL
Benchmark
Mode Cnt Score Error Units
StringDimensionIndexerProcessBenchmark.parallelReadWrite
avgt 10 30471.552 ± 456.716 us/op
StringDimensionIndexerProcessBenchmark.parallelReadWrite:parallelReader
avgt 10 18069.863 ± 327.923 us/op
StringDimensionIndexerProcessBenchmark.parallelReadWrite:parallelWriter
avgt 10 67676.617 ± 2351.311 us/op
StringDimensionIndexerProcessBenchmark.soloReader
avgt 10 1048.079 ± 1.120 us/op
StringDimensionIndexerProcessBenchmark.soloWriter
avgt 10 4629.769 ± 29.353 us/op
SYNCHRONIZED
Benchmark
Mode Cnt Score Error Units
StringDimensionIndexerProcessBenchmark.parallelReadWrite
avgt 10 93569.747 ± 16945.579 us/op
StringDimensionIndexerProcessBenchmark.parallelReadWrite:parallelReader
avgt 10 16777.455 ± 1096.868 us/op
StringDimensionIndexerProcessBenchmark.parallelReadWrite:parallelWriter
avgt 10 323946.622 ± 70083.402 us/op
StringDimensionIndexerProcessBenchmark.soloReader
avgt 10 198.478 ± 1.093 us/op
StringDimensionIndexerProcessBenchmark.soloWriter
avgt 10 2513.408 ± 3.333 us/op
STAMPED LOCK #13710
Benchmark
Mode Cnt Score Error Units
StringDimensionIndexerProcessBenchmark.parallelReadWrite
avgt 10 2914.859 ± 22.519 us/op
StringDimensionIndexerProcessBenchmark.parallelReadWrite:parallelReader
avgt 10 508.010 ± 14.675 us/op
StringDimensionIndexerProcessBenchmark.parallelReadWrite:parallelWriter
avgt 10 10135.408 ± 82.745 us/op
StringDimensionIndexerProcessBenchmark.soloReader
avgt 10 205.415 ± 0.158 us/op
StringDimensionIndexerProcessBenchmark.soloWriter
avgt 10 3098.743 ± 23.603 us/op
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]