-
Notifications
You must be signed in to change notification settings - Fork 73
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
Problem with schema registry cache- Workaround #146
Comments
Hey @oscar067, I am refactoring this feature in this branch completely, and removing many of these nuisances. It's still WIP. These issues will be addressed by my future changes: |
I was checking those future changes, but at some point, if tests makes use of the schema registry cache, the problem still be there. Solution can be to github.com/riferrei/srclient v0.5.4 changing it's implemetation or a similar , to the proposed, cache mechanims is in place. Other exceptions like these ones were in place when running the original code (solved after the patch) time="2022-08-05T10:44:10Z" level=warning msg="Failed to create or get schema, manually encoding the data" error="Failed to get schema from schema registry, OriginalError: %!w(*url.Error=&{Get |
Interesting! Maybe we should ask the author of the original package for his opinion here? @riferrei |
So what is the proposal here? Remove the usage of the caching from the library? Apropos, it is possible to programmatically disable the caching, so all interactions with SR happen without any locks. That way you can remove it from the critical path. That said; it is a bit weird having the srclient in the critical path of highly concurrently applications. Ideally, the schema should be managed before any interaction with producers/consumers and then once the schema is fetched — it is used within the concurrent transactions. Let me know how can I help. I welcome changes in the project. If none of this help, we can think of a PR to change the caching behavior. 🙂 |
Cached in is needed in github.com/riferrei/srclient, makes no sense in a performance test call the schema registry everytime a message is generated. I'll try to test the code of the schemaRegistyClient.go with https://pkg.go.dev/sync#Map, and let you know the results, If not sucessfull for the xk6 kafka plugin I would recommend the workaround, and warming up the producer in the setup method of the test. "The Map type is optimized for two common use cases: (1) when the entry for a given key is only ever written once but read many times, as in caches that only grow, or (2) when multiple goroutines read, write, and overwrite entries for disjoint sets of keys. In these two cases, use of a Map may significantly reduce lock contention compared to a Go map paired with a separate Mutex or RWMutex." Many thanks fro the answer |
Hi,
I realized a very low number of messages produced when using avro with schema registry with 30 vu (less than 100 per second):
My config looks like
where kafkaConfiguration is:
Taking a look to the library github.com/riferrei/srclient v0.5.4 I realized this behaviour in the cache of schemaRegistyClient.go:
RLock has this doc:
So I decided to modify a bit schema_registry.go like this and now woks with more than 2000 per second with the same 30vu
I tested it in local
The text was updated successfully, but these errors were encountered: