ericzhifengchen opened a new pull request, #15376: URL: https://github.com/apache/kafka/pull/15376
*More detailed description of your change, current MetadataCache is partially (but not fully) immutable, thus read/write requires synchronization and led to high produce latency with large number of topics in a kafka cluster This change improves performance of metadata cache read operation of native kafka producer with copy-on-write strategy What is copy-on-write strategy It’s a solution to reduce synchronized lock contention by making the object immutable, and always create a new instance when updating, but since the object is immutable, read operation will be free from waiting, thus produce latency reduced significantly Besides performance, it can also make the metadata cache immutable from unexpected modification, reduce occurrence of code bugs due to incorrect synchronization *Summary of testing strategy (including rationale) Add unit test to cover concurrent read/write Run in production, with large scale for over 3months ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org