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

Reuse serializers #1201

Open
fbad opened this issue Sep 14, 2023 · 0 comments
Open

Reuse serializers #1201

fbad opened this issue Sep 14, 2023 · 0 comments

Comments

@fbad
Copy link

fbad commented Sep 14, 2023

Hi!

I have profiled Kafka Rest v7.5.0 under some test load (2rps on Produce V2 endpoint with Avro format and schemas registered in Schema Registry, using schema id) and it looks like most of the time inside RecordSerializerFacade.serialize is actually spent reinstantiating the three serializers (Avro, JsonSchema, Protobuf) (you can see how small is the portion spent actually serializing in this profiling).

image

It seems this is due to io/confluent/kafka/serializers/AbstractKafkaSchemaSerDe.addRuleObjectsFromServiceLoader.

  1. Am I interpreting this right? Are serializers reinstantiated for each request?
  2. Would it be possible to reuse the same serializers for different requests? Are they thread-safe? If yes, can we maybe bind SchemaRecordSerializerFactory with singleton scope?

Thank you!

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

No branches or pull requests

1 participant