On Fri, 15 Nov 2024 10:05:29 GMT, Aleksey Shipilev <sh...@openjdk.org> wrote:

>> See the bug for more discussion and reproducer. This PR replaces the ad-hoc 
>> linked list segmented list of arrays. Arrays are easy targets for GC. There 
>> are possible improvements here, most glaring is parallelism that is 
>> currently knee-capped by global synchronization. The synchronization scheme 
>> follows what we have in original code, and I think it is safer to continue 
>> with it right now.
>> 
>> I'll put performance data in a separate comment.
>> 
>> Additional testing:
>>  - [x] Original reproducer improves drastically
>>  - [x] New microbenchmark shows no regression on "churning" tests, which 
>> covers insertion/removal perf
>>  - [x] New microbenchmark shows improvement on Full GC times (crude, but 
>> repeatable), serves as a proxy for reproducer
>>  - [x] `java/lang/ref` tests in release 
>>  - [x] `all` tests in fastdebug
>
> Aleksey Shipilev has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Add the node cache

Not that it was the main problem here (since using array-linked lists deliver 
already the major improvement with less changes, kudos!) - but in case having a 
lock-free structure can be of any help, in JCTools we have 
and 
https://github.com/JCTools/JCTools/blob/master/jctools-core/src/main/java/org/jctools/queues/MpmcUnboundedXaddArrayQueue.java
 which is decently scalable offer side (less consumer-side) and can save 
reusing chuncks, becoming way simpler.
If can be of any interest I can create a gist with a simplified, non-Unsafe 
version.

Otherwise 
https://github.com/pramalhe/ConcurrencyFreaks/blob/master/Java/com/concurrencyfreaks/queues/array/FAAArrayQueue.java
 it's as simple as it looks, but probably need to make it linearizable - IDK.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/22043#issuecomment-2478475080

Reply via email to