Remove hppc from LinearizabilityChecker#84878
Conversation
The LinearizabilityChecker has one use of hppc, where it uses a Long to Object map. Given that the rest of the maps in the Cache class are Java Maps, and this is only for testing, hppc does not seem necessary. This commit converts the usage to Map. relates elastic#84735
|
Pinging @elastic/es-distributed (Team:Distributed) |
|
Unfortunately this is somewhat performance sensitive due to the brute-force nature of the linearizability checker. The tests risk timing out with this change. I wonder if there is an alternative map implementation available (i.e., that we already use perhaps) that avoids wrapping longs? Or else we will need to build or use one here. Would it be a viable option to leave the dependency on hppc as a test only dependency? |
While I understand the concern, I question whether this change is that impactful. Java has become quite good at inlining boxed objects. Also, HashMap's table is a singular array, while hppc's map is two arrays (keys and values), so getting at a value still requires a second dereference once the index is retrieved.
Could we try out this change, and if it results in timeouts, then we can investigate how to fix?
This would not be ideal. It would still leave open for hppc use in many places, especially since this checker is in the test framework. |
|
@elasticmachine run elasticsearch-ci/part-2 |
|
@henningandersen I ran 20 iterations of |
|
Thanks Ryan. Perhaps also run it 20 times with no fixed seed just to check that it does not OOM with a random seed. The seed does determine the disruption type, size of cluster, number of keys, number of threads and more so might reveal a different result. |
|
Sorry, I was not clear. The fixed seed was the root seed. Each individual test iteration had a unique seed, based on the root seed. I did the fixed seed so that each iteration used the same seed, but they were all still unique. |
|
@henningandersen I ran 100 more iterations and did not see any timeouts or OOMs with this PR. |
henningandersen
left a comment
There was a problem hiding this comment.
LGTM, thanks for verifying this thoroughly.
The LinearizabilityChecker has one use of hppc, where it uses a Long to
Object map. Given that the rest of the maps in the Cache class are Java
Maps, and this is only for testing, hppc does not seem necessary.
This commit converts the usage to Map.
relates #84735