Caching JSON string vs Java Object -


in 1 of web services, caching result using memcached. can either cache result json or source object. if cache source object, have convert json everytime before sending result(i doing in code because i'm using json views dynamiccaly restrict few columns). if cache json string(considerably large), have return it. question is, json string consume more memory java object or bad idea cache json strings?

if cache source object via memcache, has serialized , deserialized. lot of overhead. caching json object faster.

two advices on this:

avoid character encoding: if possible store json object byte array , not string or char array , return via httpresponse.getoutputstream(json). way bypass additional character encoding.

cache whole response: if json result of rest query, event better cache complete request via caching server in front of application (e.g. varnish, nginx, apache traffic server.). put right http cache headers on , fine.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -