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

Use ConcurrentDictionary as default cache for Schema Registry client #2433

Conversation

Havret
Copy link
Contributor

@Havret Havret commented Mar 28, 2025

What

This PR is a follow-up to #2429.
It replaces the thread-unsafe Dictionary with its thread-safe variant, ConcurrentDictionary.

The main goal is to eliminate the need to acquire a lock for cache lookups, improving performance in concurrent scenarios.

Checklist

  • No changes in public API
  • Just a perf optimization, no functional changes.

@rayokota Could you please take a look?

@Copilot Copilot bot review requested due to automatic review settings March 28, 2025 00:12
@Havret Havret requested review from a team as code owners March 28, 2025 00:12
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request replaces several thread-unsafe Dictionary instances with thread-safe ConcurrentDictionary variants in the Schema Registry client to improve performance in concurrent scenarios.

  • Replaces Dictionary with ConcurrentDictionary for cache-related variables.
  • Adds fast-path checks to avoid acquiring locks when a cache hit is detected.

@rayokota
Copy link
Member

/sem-approve

@rayokota
Copy link
Member

/sem-approve

1 similar comment
@rayokota
Copy link
Member

/sem-approve

Copy link
Member

@rayokota rayokota left a comment

Choose a reason for hiding this comment

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

Thanks @Havret , LGTM

@rayokota rayokota merged commit 7338563 into confluentinc:master Mar 28, 2025
1 of 2 checks passed
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.

2 participants