Web 场环境中 ASP.NET 网站的数据缓存
我做了一些搜索,但没有找到具体的答案。无论如何,我想知道大多数中型基于 ASP.NET 的网站如何缓存数据,以便它们在网络场环境中运行时不必总是在不同页面上数据库查找相同的数据。我知道您可以使用 sql server 缓存,但对我来说,这违背了缓存的全部目的。如果我想使用专用服务器来共享缓存(甚至可能的会话数据),大多数站点会使用什么?我已经进行了搜索,并在实现方面得到了很多“猜测”,但考虑到有如此之多的 ASP.NET 网站,真的很难相信没有某种标准方法可以做到这一点。
我知道 AppFabric 似乎可以解决这个问题,但只能在 Windows Server 2008+ 上运行,我们目前使用的是 2003。另外,我已经检查过 NCache,但它似乎有点贵。
有人实施了适合他们的解决方案吗?当 1000 多个用户同时访问您的网站时,数据库查找可能会非常慢。
提前致谢!
I've done some searching and haven't found a specific answer. Anyhow, I was wondering how most medium sized ASP.NET based websites cache data so that they don't always have to database look ups for the same data on different pages when running on a web farm environment. I'm aware that you can use a sql server cache, but to me, that defeats the whole purpose of the cache. If I want to use a dedicated server to share cache (and even possible session data), what do most sites use for this? I've done searching and get a lot of 'guesses' when it comes to implementations, but it's really hard to believe that there isn't some standard way of doing this given that there are so many ASP.NET websites out there.
I am aware of AppFabric that seems like it might do the trick, but only runs on Windows server 2008+ and we're currently using 2003. Also, I've checked out NCache but it seems to be a little pricey.
Has anyone implemented a solution that worked for them? Database lookups can be quite painfully slow when 1000+ users are hitting your site simultaneously.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能想看看 HttpContext.Cache 和 HttpRuntime.Cache
您可以获得然后从数据库中获取信息创建数据集(或字典,或任何你想要的),然后将它们存储在缓存中以供站点范围内引用。
您甚至可以指定缓存保留的时间。当它过期时,对该数据的下一个请求将转到数据库并重新创建缓存。
Might want to take a look at HttpContext.Cache and HttpRuntime.Cache
You can get your information from the database then create datasets (or dictionaries, or whatever you want) and then store those in cache to be referenced site wide.
You can even specify how long you want the cache to persist. And when it expires the next request for that data will go to the database and recreate your cache.