Array based ring, for ketama node locator lookups, for improved performance#9
Open
tootedom wants to merge 3 commits intocouchbase:masterfrom
Open
Array based ring, for ketama node locator lookups, for improved performance#9tootedom wants to merge 3 commits intocouchbase:masterfrom
tootedom wants to merge 3 commits intocouchbase:masterfrom
Conversation
…bleFuture, and allow enough time in Overflow test for reconnect
|
@tootedom wow just saw this - seems a great addition! As you probably know we need to put changes through gerrit (http://www.couchbase.com/wiki/display/couchbase/Contributing+Changes) - if you want I can guide you through the initial process of setting it up, after that its very painless. If you just sign the CLA and don't mind I can get it in for you as well - but I'd be great if you could squash into one commit and remove the non-related changes (test fixes). We can get those in separately. If you don't care at all I can also get it in, but I want you attributed of course. |
favila
pushed a commit
to useshortcut/spymemcached
that referenced
this pull request
Jan 14, 2022
Bumped Maven version from 1.1.1 to 1.1.2 in the pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi there
This is pull request for changing the KetamaNodeLocator from using a
TreeMap<Long,MemcachedNode>to than of an array based ring lookup.I noticed that the TreeMap implementation has a few performance related issues:
To avoid the first, whilst improving on 2, I have changed the TreeMap ring implementation to use that of a sorted long[], and implement a binary search for the closest ceil long in the array, against which to hash entries. This avoids the creation of the Long objects, and also only searches for the closest ceil long in the array the once.
The jmh benchmark is showing this implementation of the ring to be more performant.
Here is the output from Java Flight Recorder and Mission Control that show the before and after. With the after now showing that item that impacts performance/takes up CPU to be that of the HashingAlgorithm and not the node lookup in the ring:
Before:
CPU:

Allocations:

After
CPU (getBytes is from get bytes on the string to byte[] required by the key hashing)

Memory: (no more Longs)

As a side note I have fixed a concurrency issue in the test case:
DummyListenableFuture. It was notifying listeners before setting the content. Also as the listeners are executed on a separate thread, the content needs to be volatile to ensure publication of the value (set in one thread) to the executor thread that the listener is running on.I also increased the sleep time in
QueueOverflowTestto allow the client to recover/reconnect as it was always failing, before even these changes were done. With the increased timeout out the test is working.