简体   繁体   English

HttpContext.Current.Cache具有负载平衡功能吗?

[英]HttpContext.Current.Cache with load balancing?

We're trying to implement caching of data used to compile Web Api response data. 我们正在尝试实现用于编译Web Api响应数据的数据缓存。 Thus far, we've been using HttpContext.Current.Cache, but I haven't found any information on how to configure this on a load balancing scenario. 到目前为止,我们一直在使用HttpContext.Current.Cache,但是我还没有找到有关如何在负载平衡方案中配置它的任何信息。

I'm looking to use something along the lines of State Services or SQL Server (similar to session) 我正在寻找使用类似于State Services或SQL Server的东西(类似于会话)

Is this even the right library to use? 这甚至是正确使用的库吗?

If you go with sticky sessions on your load balancer then you don't need to change anything in your application and you do have your load splitted. 如果您在负载均衡器上进行粘性会话,则无需更改应用程序中的任何内容,并且可以拆分负载。 But you will miss on availability. 但是您会错过可用性。
Otherwise, you can't use the in process cache anymore and need to go to an outside server like Memcached / Aerospike / Redis - which are basically in memory no sql databases. 否则,您将无法再使用进程内缓存,而需要转到Memcached / Aerospike / Redis之类的外部服务器-基本上在内存中没有sql数据库。 You can also use Sql Server for this, but I don't think it is the right tool for such a job, because with a cache you shouldn't worry with things like persistence. 您也可以为此使用Sql Server,但我认为这不是用于此类工作的正确工具,因为有了缓存,您不必担心持久性之类的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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