Reputation: 8946
I am doing kafka producers and consumers. there are three ways to do Serialization and de-serialization.
1, custom object -> byte[] -> object (example)
2, custom object -> String -> object (I tried. working)
3, custom object -> JsonNode -> object (example)
Which one is better? Thanks
Upvotes: 1
Views: 6011
Reputation: 2560
You can try benchmarking but I would imagine all three are about the same.
If you're interested in maximizing performance you might want to avoid using json as a serialization mechanism and explore protobuf. A kafka protobuf example is here. Some numbers comparing protobuf performance vs json serialization are here.
Upvotes: 4