简体   繁体   中英

Web Farm Chat Storage

I got a chat application (webservice) running on a website hosted by a web farm and I don't know how to temporarily store the chat messages. Im using long polling to save resources and I have specified a shared machine key.

Because its running on a web farm the HttpApplicationState won't work and saving each message to my database would cause a lot of overload and overhead, and I doubt that would be a good idea.

So is there any other approach to save the messages in server "memory", note: within a web farm?

The classic solution to this is to use a distributed cache; it's not as popular in .Net world as it might be, but here's an article on MSDN; Microsoft has a product , or you can use the open source Memcached, for which you can also get .Net client libraries and Windows versions.

Please note that while distributed caching is very cool when it works, it does introduce a lot of additional complexity, and exciting new ways for bugs to creep into your app. I'd only go down this route if I really, really needed to.

I found some more help on the topic here . It introduces different caching techniques. Without the use of third-part software.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM