The performance is not up to mark when serializing/deserializing a big JSON file (~3 MB). We are using Microsoft JSON serialization. Is there any other serialization that would help to optimize the cache and provide good serialization/deserialization performance?
2
Answers
I couldn't find a solution that met the requirements, so it took me 2-3 days to find the necessary solution. We use Protobuf-net for binary serialization/deserialization, and I've also created a small sample - https://github.com/mukesh82-net/RedisProtoBuf
System.Text.Json
is quite fast since it was originally designed with perfromance in mind. Here are some "official" benchmarks results @github (though a bit dated).You can try switching to using source generation in System.Text.Json which can have some perfromance benefit but in general constantly serializing/deserializing relatively large JSON file back and forth does not sound like the best idea. It seems like you should consider using in-memory caching with some pub/sub functionality to maintain local copies in sync (possibly on top of Redis).