Client caching is not working when load balancer is there
-
quarta-feira, 16 de maio de 2012 08:54
I just wanted to know how client caching will work when load balancer is there ?
our deployment environment is like below
we have distributed 4 nodes will work as seperate instances these nodes connected to load balancer , but what problem we are facing is we have implimented client caching , when we are testing this client caching functionality what happens is when we test through nodes it works fine (for 1st request it shows 200 and next request it shows 304 ) but when we test through main URL it wont work (always shows 200)Ex.
http://eclipse-retail-1n1.nat.bt.com/process/get_process.aspx?id=6555 x two times. (200 & 304)
http://eclipse-retail-1n2.nat.bt.com/process/get_process.aspx?id=6555 x two times. (200 & 304)
http://eclipse-retail-1n3.nat.bt.com/process/get_process.aspx?id=6555 x two times. (200 & 304)
http://eclipse-retail-1n4.nat.bt.com/process/get_process.aspx?id=6555 x two times. (200 & 304)
http://eclipse-retail-pilot.intra.bt.com/process/get_process.aspx?id=6555 (two times) (200 & 200)Kindly help on this.
Todas as Respostas
-
quinta-feira, 17 de maio de 2012 05:00
Hi,
Are you trying this on cloud or on-premise ? From my understanding you have enabled local caching on all the instances and if directly access the instance you are able to get the data and on going through load balancer it doesn't show the right data . 200 & 304 you mentioned are these two cache items stored ?And is the key for items hard coded or generated run time ?
Thanks
Arun
arunks
-
quinta-feira, 17 de maio de 2012 06:08
we have not hard coded, it is generated run time . Let me explain in detail ..
we are fetching process details based process id , details will get displayed as XML in browser. so what we are doing is we have implemented client caching for fetching process.we are applying cache policy like below
cachingPolicy.SetExpires(DateTime.UtcNow)
cachingPolicy.SetMaxAge(New TimeSpan(0, 0, 0))
cachingPolicy.SetCacheability(HttpCacheability.Public)
cachingPolicy.SetOmitVaryStar(True)
cachingPolicy.SetNoServerCaching()
cachingPolicy.SetRevalidation(HttpCacheRevalidation.AllCaches)
cachingPolicy.SetProxyMaxAge(New TimeSpan(0, 0, 0))
cachingPolicy.SetNoTransforms()
cachingPolicy.SetLastModified(contentModified)
cachingPolicy.SetETag(ETag)
cachingPolicy.SetValidUntilExpires(True)
cachedDateKey = "pCreated" & strCachewhen we deployed code into production environment if we browse through single nodes (Ex.http://eclipse-retail-1n1.nat.bt.com/process/get_process.aspx?id=6555) then for first request it shows HTTP status code 200 in fiddler and for 2nd request it shows 304 (works fine) but when we run it through main URL (Ex.http://eclipse-retail-pilot.intra.bt.com/process/get_process.aspx?id=6555) then it is showing HTTP status code 200 always irrespective of no.of requests.

