Azure Redis 缓存说明Azure Cache for Redis description

Azure Cache for Redis 基于开源软件 Redis 提供内存中数据存储。Azure Cache for Redis provides an in-memory data store based on the open-source software Redis. 当用作缓存时,Redis 可以提高严重依赖于后端数据存储的系统的性能和可伸缩性。When used as a cache, Redis improves the performance and scalability of systems that rely heavily on backend data-stores. 提高性能的方式是将经常访问的数据复制到靠近应用程序的快速存储。Performance is improved by copying frequently accessed data to fast storage located close to the application. 使用 Azure Cache for Redis 时,此快速存储位于内存中,而不是通过数据库从磁盘加载。With Azure Cache for Redis, this fast storage is located in-memory instead of being loaded from disk by a database.

Azure Cache for Redis 也可用作内存中数据结构存储、分布式非关系数据库以及消息代理。Azure Cache for Redis can be used as an in-memory data structure store, a distributed non-relational database, and a message broker. 若要提高应用程序性能,可充分利用 Redis 引擎低延迟、高吞吐量的性能特点。Application performance is improved by taking advantage of the low-latency, high-throughput performance of the Redis engine.

Azure Cache for Redis 提供了安全的专用 Redis 缓存。Azure Cache for Redis provides access to a secure, dedicated Redis cache. Azure Redis 缓存由 Microsoft 进行管理并承载在 Azure 中,可供 Azure 内外的任何应用程序访问。Azure Cache for Redis is managed by Microsoft, hosted within Azure, and accessible to any application within or outside of Azure.

使用 Azure Redis 缓存Using Azure Cache for Redis

Azure Cache for Redis 通过支持常见的应用程序体系结构模式来提高应用程序性能。Azure Cache for Redis improves application performance by supporting common application architecture patterns. 部分最常用的模式包括:Some of the most common include the following:

模式Pattern 说明Description
缓存端Cache-Aside 数据库通常很大,无法直接加载到缓存中。Databases are often too large to load directly into a cache. 通常是使用缓存端模式,只在需要时才将数据加载到缓存中。It is common to use the cache-aside pattern to load data into the cache only as needed. 系统对数据进行更改时,还会同时更新缓存,然后将缓存分发给其他客户端。When the system makes changes to the data, the system can also update the cache, which is then distributed to other clients. 另外,系统还可以设置数据的过期时间,或者使用逐出策略触发对缓存的数据更新。Additionally, the system can set an expiration on data, or use an eviction policy to trigger data updates into the cache.
内容缓存Content Caching 许多网页都是基于使用静态内容(例如页眉、页脚、横幅)的模板生成的。Many web pages are generated from templates that use static content such as headers, footers, banners. 这些静态项不应经常更改。These static items shouldn't change often. 与后端数据存储相比,使用内存中缓存可以快速地访问静态内容。Using an in-memory cache provides quick access to static content compared to backend datastores. 此模式降低了处理时间和服务器负载,使 Web 服务器能够更快地做出响应。This pattern reduces processing time and server load, allowing web servers to be more responsive. 这可减少处理负载所需的服务器数量。It can allow you to reduce the number of servers needed to handle loads. Azure Cache for Redis 提供 Redis 输出缓存提供程序,支持对 ASP.NET 使用此模式。Azure Cache for Redis provides the Redis Output Cache Provider to support this pattern with ASP.NET.
用户会话缓存User session caching 此模式通常用于购物车和其他用户历史记录数据。Web 应用程序可能需要将此类信息与用户 Cookie 相关联。This pattern is commonly used with shopping carts and other user history data that a web application may want to associate with user cookies. 在 Cookie 中存储过多内容可能会对性能造成负面影响,因为 Cookie 会变大,并且每次请求都需要传递和验证 Cookie。Storing too much in a cookie can have a negative impact on performance as the cookie size grows and is passed and validated with every request. 常用解决方案是使用 Cookie 作为键来查询数据库中的数据。A typical solution uses the cookie as a key to query the data in a database. 使用内存中缓存(例如 Azure Redis 缓存)将信息与用户关联在速度上要比与整个关系数据库交互快得多。Using an in-memory cache, like Azure Cache for Redis, to associate information with a user is much faster than interacting with a full relational database.
作业和消息队列Job and message queuing 当需要花费时间来执行与请求相关联的操作时,应用程序通常将任务添加到队列中。Applications often add tasks to a queue when the operations associated with the request take time to execute. 长时间运行的操作将排队等待按顺序处理,通常由另一服务器进行处理。Longer running operations are queued to be processed in sequence, often by another server. 这种将工作推迟的方法称为任务队列。This method of deferring work is called task queuing. Azure Cache for Redis 提供了一个分布式队列,用以在应用程序中启用此模式。Azure Cache for Redis provides a distributed queue to enable this pattern in your application.
分布式事务Distributed transactions 有时候,应用程序需要将针对后端数据存储的一系列命令作为单个原子操作来执行。Applications sometimes require a series of commands against a backend data-store to execute as a single atomic operation. 所有命令都必须成功,否则,所有命令都必须回退到初始状态。All commands must succeed, or all must be rolled back to the initial state. Azure Cache for Redis 支持将一批命令作为单个事务来执行。Azure Cache for Redis supports executing a batch of commands as a single transaction.

Azure Redis 缓存的产品/服务Azure Cache for Redis offerings

Azure Redis 缓存在下述层中提供:Azure Cache for Redis is available in the following tiers:

Tier 说明Description
基本Basic 单节点缓存。A single node cache. 此层级支持多个内存大小(250 MB - 53 GB),适用于开发/测试和非关键工作负荷。This tier supports multiple memory sizes (250 MB - 53 GB)and is ideal for development/test and non-critical workloads. 基本层没有服务级别协议 (SLA)The Basic tier has no service-level agreement (SLA)
标准Standard 在 Azure 托管的双节点(主/辅)配置中提供复制的缓存,并提供高可用性 SLA (99.9%)A replicated cache in a two-node, primary/secondary, configuration managed by Azure with a high-availability SLA (99.9%)
高级Premium 高级层是面向企业的层。The Premium tier is the Enterprise-ready tier. 高级层缓存支持更多的功能,吞吐量更高,延迟更低。Premium tier Caches support more features and have higher throughput with lower latencies. 高级层中的缓存部署在更强大的硬件上,其性能优于基本层或标准层。Caches in the Premium tier are deployed on more powerful hardware providing better performance compared to the Basic or Standard Tier. 这种优势意味着,在缓存大小相同的情况下,高级层的吞吐量大于标准层。This advantage means the throughput for a cache of the same size will be higher in Premium compared to Standard tier.


有关高级缓存大小、吞吐量和带宽的详细信息,请参阅 Azure Redis 缓存常见问题解答For more information about size, throughput, and bandwidth with premium caches, see Azure Cache for Redis FAQ.

可以在缓存创建后将其提升到更高的层级。You can scale your cache up to a higher tier after it has been created. 不允许降到更低的层。Scaling down to a lower tier is not supported. 有关缩放的分步说明,请参阅如何缩放 Azure Redis 缓存如何自动执行缩放操作For step-by-step scaling instructions, see How to Scale Azure Cache for Redis and How to automate a scaling operation.

功能比较Feature comparison

Azure Redis 缓存定价页对每个层进行了详细比较。The Azure Cache for Redis Pricing page provides a detailed comparison of each tier. 下表介绍了每个层支持的部分功能:The following table helps describe some of the features supported by tier:

功能说明Feature Description 高级Premium 标准Standard 基本Basic
服务级别协议 (SLA)Service Level Agreement (SLA) -
Redis 数据持久性Redis data persistence - -
Redis 群集Redis cluster - -
通过防火墙规则确保安全性Security via Firewall rules
传输中加密Encryption in transit
通过 VNet 增强安全性和隔离性Enhanced security and isolation with VNet - -
导入/导出Import/Export - -
计划的更新Scheduled updates
异地复制Geo-replication - -

后续步骤Next steps