문제

I have a JSP which shows data by many aggregation types. E.g. By market, by category, by server type, etc.. What I have is the data by publisher and time. Publisher is the most granular level of data in my case.

Now this data changes on every 1/2 an hour. The number of data per half an hour is almost 5K and anyone at a time looks data for 4 hours to 24 hours. In these cases when server is loaded the JSP load time increases rapidly. I tried to use and LRU cache with LinkedHashMap but that seems not the optimum solution as performance is still not good.

Any idea about which data structure to use would be appreciated.

도움이 되었습니까?

해결책

You could use a cache tool like Ehcache.

다른 팁

Was performance, poor, or did you have a low hit rate? Sometimes maintaining a cache is harder than just querying your data directly. This is especially true with low hit rates.

If it takes you 10ms to serve a cache hit, and 50ms to serve a cache miss, plus 20ms to store the cache hit, then you are only gaining 20ms for each cache hit, so 200ms for 10 hits. This sounds GREAT, but when you add in expiration, and invalidation, not to mention cache invalidation, suddenly you are at a point where it takes at least 10 hits for every miss to have cache be useful.

Caching is great for flash mobs, but for ad-hoc tools, a lot of time it can waste as many resources as it gains.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top