Skip to content

The API design of AvroEncoder #47

Answered by gklijs
mirosval asked this question in Q&A
Discussion options

You must be logged in to vote

I still have not build a full async app to test the usability in that case so it could be there is room for improvement.

However you should not create a new encoder for each request, as it will cause the need for a call to schema registry each time. The problem is you need the correct ID from schema registry, even if you supply a schema.

From a theoratic view there seem at least two options:

  • Wrap the encoder in a mutex, this way you can use the same one from multiple threads, but might slow things down.
  • Use a separate encoder for each thread. You will have cache misses, and additional calls to schema registry. But the thread never needs to wait till another thread is done. With the cache…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@mirosval
Comment options

Answer selected by mirosval
Comment options

You must be logged in to vote
3 replies
@mirosval
Comment options

@gklijs
Comment options

@mirosval
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants