Skip to content

Reinstate open-addressing hash to work on concurrency improvements.#5419

Closed
headius wants to merge 4 commits intomasterfrom
restore_open_hash
Closed

Reinstate open-addressing hash to work on concurrency improvements.#5419
headius wants to merge 4 commits intomasterfrom
restore_open_hash

Conversation

@headius
Copy link
Member

@headius headius commented Nov 6, 2018

See #5412.

This is a work in progress as we improve @ChrisBr's open-addressing Hash impl for better concurrency.

@headius headius added this to the JRuby 9.2.2.0 milestone Nov 6, 2018
This should help move us toward safer concurrent access to Hash,
although most of these reads are still non-atomic and may be
interrupted by another thread (e.g. an update happens between read
of `start` and `end`). We at least reduce the possibility of
another thread's updates via this change.
@anup1710
Copy link

anup1710 commented Mar 5, 2019

@headius - Are we planing to include in coming releases of 9.2.x.x ?

@ChrisBr
Copy link
Contributor

ChrisBr commented Mar 5, 2019

That would be great, I'm still open for helping out 👍

@headius
Copy link
Member Author

headius commented Mar 7, 2019

@ChrisBr @anup1710 Unsure if we'll get to it for 9.2.7, or even 9.2.8, since priority right now is fixing some long-neglected areas (refinements, newer load/require logic) but this is still definitely in plan.

I'll see about cleaning up what I've done on the branch. It constitutes more of an experiment. The general idea is trying to reduce the number of fields we have to update when adding to the Hash. My approach seems to be working, generally...I split the two implementations (linear search and open addressed) as different classes, so switching between them is switching atomically between two object instances. However, this means an extra hope, and the two impls themselves don't have any more thread-safety than they did before (except perhaps for a bit safer handling of the int values, since I pack them into longs.

We have never managed to isolate the concurrency problems that @enebo found while trying to run rails with this Hash impl, but we suspect the problem is that the state changes happening for open addressing happen to be slightly "less threadsafe" than the already-not-threadsafe Hash on master. If we can mitigate that by simplifying, atomicizing, or otherwise synchronizing those state changes, we can land it.

This may mean we have to go full-on thread-safe Hash, ideally just using atomic updates (i.e. no locks).

We still very much want to land this!

@Jrakesh
Copy link

Jrakesh commented Jul 16, 2019

@headius - Hope we are moving on track to make this live in 9.3.x.x
Am i being optimistic or far-fetched ?

@ChrisBr
Copy link
Contributor

ChrisBr commented Jul 16, 2019

Yeah, happy to continue working on this 👍 @headius any plans how to move forward?

@headius
Copy link
Member Author

headius commented Nov 8, 2019

This version went a bit too far in restructuring so I've rebooted this as #5967.

@headius headius closed this Nov 8, 2019
@headius headius deleted the restore_open_hash branch November 8, 2019 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants