开发者

Combining Session and Cache

To make my extranet web application even faster/more scalable I think of using some of the caching mechanisms. For some of the pages we'll use HTML caching, please ignore that technique for this question.

E.g.: at some point in time 2500 managers will simultaneously login on our application

(most of them with the same Acc开发者_运维百科ount/Project)

I think of storing an Account-cachekey and Project-cachekey into the user's Session and use that to get the item from the Cache.

I could have simply stored the Account into the session, but that would result in 2500 of the same Accounts in memory.

Is there a better solution to this or does it make sense :)?


Generally adding items to session is seen as having a negative impact on scalability. Depending on your technology, you may have a problem scaling out to more than 1 server when using session variables (eg in classic asp).

Having said that, if performance is your top priority you could cache data in both session and application variables. I have always thought that its not worth the hassle for a dataset of this size becuase sql server will almost certainly have this data cached in memory and all you are saving is a network round trip.

Lastly, look at code and hardware optimisation first for performance enhancements. Migrating to managed/compiled code, reducing the size of your html, optimising your images, minifying JavaScript, and of course the html caching you mentioned previously - these are all things I would consider first.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜