简体   繁体   English

Redis 缓存:当多个应用程序写入/读取数据时选择的最佳模式

[英]Redis Cache: Best mode to choose when several applications would write/read the data

We have multiple applications (approx. 500) hosted on different servers (IIS).我们有多个应用程序(大约 500 个)托管在不同的服务器 (IIS) 上。 For caching purposes, .Net Enterprise Library (in-memory) is being used currently.出于缓存目的,目前正在使用 .Net Enterprise Library(内存中)。 But this is an overhead for the application servers when the cache grows.但是当缓存增长时,这是应用服务器的开销。 Therefore, we have a plan to keep a distributed cache using Redis.因此,我们计划使用 Redis 保留分布式缓存。

Requirement: Multiple applications would write/read the data into/from redis cache.要求:多个应用程序会将数据写入/读取 redis 缓存。 However, we would like to keep each application's data separate.但是,我们希望将每个应用程序的数据分开。 This way a noisy application wouldn't have an impact on the other applications.这样,嘈杂的应用程序不会对其他应用程序产生影响。 Also it would increase the data search performance when it is segregated.此外,当它被隔离时,它会提高数据搜索性能。

Redis enables different solutions(modes) like Standalone, Sentinel and Cluster. Redis 支持独立、哨兵和集群等不同的解决方案(模式)。

I believe 'Standalone' mode would work like this.我相信“独立”模式会像这样工作。 In a Redis Server, there will be a redis instance where a database can be created.在 Redis 服务器中,将有一个 redis 实例,可以在其中创建数据库。 With this mode, multiple application's data would be stored in the same database.使用这种模式,多个应用程序的数据将存储在同一个数据库中。 This may not enable us to store the data at the application level.这可能使我们无法在应用程序级别存储数据。 Though we can use the namespaces (prefix to key) to identify the application specific data, the growing number of applications and the data would have an impact on the key search from the application.虽然我们可以使用命名空间(key 的前缀)来识别应用程序特定的数据,但越来越多的应用程序和数据会对应用程序的 key 搜索产生影响。 Also since it is single-threaded, it is expected that there will be an impact on the operations during the peak hours.此外,由于它是单线程的,因此预计在高峰时段会对操作产生影响。

Considering the above requirements including scalability and high availability, please suggest the best mode to go with.考虑到上述包括可扩展性和高可用性在内的要求,请向 go 建议最佳模式。

PS, We'll install the redis in a dedicated server separately from the application server. PS,我们将redis安装在与应用服务器分开的专用服务器中。

There is not really enough information here to make a solid recommendation.这里没有足够的信息来提出可靠的建议。

  1. What type of throughput is being considered?正在考虑哪种类型的吞吐量?

At peak all of our applications will have a combined throughput of 50K ops/second

  1. How man items and of what size will be stored in the cache?缓存中将存储多少人项和大小?

5M keys of average size 256bytes

  1. What's the SLA and effect of downtime?停机时间的 SLA 和影响是什么?

need 95% uptime and downtime is not critical as the application can still function

  1. What's your level of SRE experience?你的 SRE 经验水平如何?

We have a crack staff of Follow the sun SREs

If you have high SLA and low throughput and memory requirements Sentinel may work.如果您有高 SLA 和低吞吐量以及 memory 要求,Sentinel 可能会工作。

If you have high SLA and high throughput and memory requirements Cluster.如果您有高 SLA 和高吞吐量以及 memory 要求的集群。

Either of the above options will work if your SRE level is high, but you may want to consider hosted or commercially supported options if that is not the case.如果您的 SRE 级别较高,则上述任何一个选项都可以使用,但如果不是这种情况,您可能需要考虑托管或商业支持的选项。

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

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