I have read documentation on CompressResponse attribute regarding compressing size of the response and implemented it in our solution. Surprisingly, the size of the response reduced drastically from 2.66 MB to 54.18 KB. However, time of response is increased from 5136.87 ms to 5276.5 ms. So, is it compromise on payload size with response time, by default ?
Thanks in advance.
Compression takes compute resources in compressing the response, i.e. the extra computation it would otherwise not have to do.
Having said that 5s is a long time for a request which suggests that most of the time is spent processing the request and only a fraction of that time is compressing the response.
If your Service is cacheable consider using the [CacheResponse] Attribute which caches as well as compresses where it will save in both compute and size costs.
Thanks for the quick response as usual.
I believe, [CacheResponse] works on the mechanism of caching data, where it stores/cache data. But, what about data which is updated recently/concurrently by some other request ?.
Does SS takes care of updating data automatically, or we have to write mechanism to update cached data ?
[CacheResponse] has a
Duration for how long you want the cache to last.
The HTTP Client caching features lets you return a date-modified or Etag to instruct the client when their local client cache is still valid. Note this requires a HTTP Compatible client that supports HTTP caching like browsers or if you're calling for a Mobile or Desktop App you can use the Cache Aware Service Clients.