Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XADD q can be more progressive while allocating new chunks #287

Open
franz1981 opened this issue Jan 25, 2020 · 0 comments
Open

XADD q can be more progressive while allocating new chunks #287

franz1981 opened this issue Jan 25, 2020 · 0 comments

Comments

@franz1981
Copy link
Collaborator

franz1981 commented Jan 25, 2020

ATM an appender thread that allocate a new chunk (ie ! pooled one) makes the whole Q to be in a rotation state while requesting to the JVM to create a new array of references, preventing other offering threads to make progress.

To improve this situation we could make MpUnboundedXaddChunk::buffer a volatile field and change the append logic to populate MpUnboundedXaddChunk::buffer with a MpUnboundedXaddChunk::casBuffer after casProducerChunkIndex, leaving any accessing thread (ie other producers and consumers) to be able to initialize it using the casBuffer(null, new Object[chunkSize]) if the buffer is null while accessing.

This would reduce the time window where the producers/consumers won't make progress while relying on the automatic GC of the JVM, instead of the one of the queue (ie the pooled chunks).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants