Were interested in optimizing our wire serialization format for a returned List of POCO objects. Each POCO contains a string thats a key into a remote database that we cant change.
The key is ASCII and over 225 characters long and most often 90% of it repeats between POCO instances… So if we need to return 1000’s of them thats a lot of wasted data.
If we were able to use basic text compression on the entire JSON we could get a very high rate of compression.
Question: Are any of the existing wire formats, better than others at compressing data like this?
Sorry, i was not clear and i believe you misunderstood my question.
The value that I refer to as a key, is in contained in a string. So key Deduplication is not going to effect anything,
But i think i found an answer. In the book Mastering Service stack, they have a section on Compressing Responses.
It shows how to use a PreRequestFilter to Compress and Decompress a stream.
The client side is using a JsonServiceClient() which appears to has a property called DisableAutoCompression. So it sounds like if will detect
a compressed stream it would decompress it?
Also, are any of these advanced wire protocols supported by JsonServiceClient()? is there a different client to use in that case?
However to make it easier to compress adhoc responses I’ve just added a new [CompressResponse] Response Filter attribute which you can use annotate a collection of Services or individual Services, e.g:
[CompressResponse]
public class MyCompressedServices : Service
{
}
public class MyServices : Service
{
[CompressResponse]
public object Any(MyCompress request) => ...;
}