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

Sort Client (Read/Write ASG followed by Write only) for add API #132

Merged
merged 1 commit into from
Jul 26, 2023

Conversation

sriram-rangarajan
Copy link
Contributor

Context:
For ADD api we skip adding keys to the cluster if the key is present in the first client. Now if a new cluster is warmed with fewer keys, the ADDS might not go through as it doesn't respect read/write mode and this might result in drop in hit rate.

Fix:
Sorting the client (read/write ASG first then followed by write-only ASG). So now the ADD API with check if the key is present in ASG which is actually serving the traffic rather than write-only ASG.

Please let me know if you have any questions. Please review and let me know your comments. Thanks!

Copy link
Contributor

@arunagrawal84 arunagrawal84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -3259,7 +3260,21 @@ public <T> boolean add(String key, T value, Transcoder<T> tc, int timeToLive) th
@Override
public <T> EVCacheLatch add(String key, T value, Transcoder<T> tc, int timeToLive, Policy policy) throws EVCacheException {
EVCacheClient[] clients = _pool.getEVCacheClientForWrite();
return this.add(key, value, tc, timeToLive, policy, clients, clients.length - _pool.getWriteOnlyEVCacheClients().length);
EVCacheClient[] writeOnlyClients = _pool.getWriteOnlyEVCacheClients();
// In case of adds , we skip adds to the pool if value is already present in the 1st client

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any concerns with enabling the same behavior as SET calls? Fan out writes to all ASGs that can take writes.

@sriram-rangarajan sriram-rangarajan merged commit db4014a into master Jul 26, 2023
@sriram-rangarajan sriram-rangarajan deleted the fix_sort_client_for_add branch July 26, 2023 21:40
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.

None yet

5 participants