I am using the following configuration for JSON in my Kafka Streams app,
properties.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG,
Serdes.String().getClass());
properties.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG,
GenericJSONSerde.class);
properties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
com.buy.json.JsonSerializer.class);
properties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
com.buy.json.JsonDeserializer.class);
properties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
com.buy.json.JsonSerializer.class);
To measure the performance, I removed all Logic and what ever I receive from IN topic, I am just pushing it to OUT topic. It takes 3 minutes to process 350,000 records
But when I use AVRO, the same streams app process 3 Million records in just 1 Minute. Here is my AVRO configuration,
`properties.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG,
Serdes.String().getClass());
properties.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG,
GenericAvroSerde.class);
properties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
io.confluent.kafka.serializers.KafkaAvroSerializer.class);
properties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
io.confluent.kafka.serializers.KafkaAvroSerializer.class);
properties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
io.confluent.kafka.serializers.KafkaAvroDeserializer.class);
properties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
io.confluent.kafka.serializers.KafkaAvroDeserializer.class);`
The streams app that I am writing should support Both AVRO/JSON. I will decide that while starting the streams app.
My question is: IS using JSON a performance hit in Streams app? Please clarify.