Redis 6 可以利用多核 CPU 吗? [英] Can Redis 6 take advantage of multi-core CPUs?

查看:167
本文介绍了Redis 6 可以利用多核 CPU 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于 Redis 6 支持多线程 IO,所以在超过 2 个内核的机器上部署 Redis 有意义吗?它是否能够利用额外的内核,或者 2 个内核仍然是理想的(一个用于主线程,另一个用于处理 bgsave 和其他内务操作)?

同样,在 AWS ElastiCache 上使用具有 >2 个 vCPU 的实例类型是否有意义?

解决方案

基于 release笔记,我想是的.这是那里的一些小信息:

<块引用>

尽管 Redis 在高性能方面享有当之无愧的声誉,但其单线程架构在工程师中一直存在争议,他们想知道 Redis 是否可以更快.Redis 6 在新时代响起:在保留核心单线程数据访问接口的同时,I/O 现在是线程化的.

<块引用>

通过将读取和写入 I/O 套接字的时间委托给其他线程,Redis 进程可以将更多的周期用于操作、存储和检索数据,从而提高整体性能.此改进保留了先前版本的事务特性,因此您无需重新考虑您的应用程序以利用提高的性能.同样,Redis 的单线程 DEL 命令现在可以配置为与自 Redis 版本 4 以来可用的多线程 UNLINK 命令一样.

<块引用>

局部变量的性能几乎总是无与伦比的,最后,即使是像Redis这样高性能的数据库也会比从堆栈或堆中访问东西慢得多.Redis 6 为复杂的客户端库添加了一项新技术,以实现客户端缓存层,以在您自己的进程中存储数据子集.这种实现足够智能,可以管理对同一数据的多次更新,并使您的数据尽可能保持同步——同时保留 Redis 的优势和局部变量的速度.

您还可以使用 redis-benchmarkmemtier 用于您的实例/工作负载配置文件.

Since Redis 6 supports multi-threaded IO, does it make sense to deploy Redis on machines with more than 2 cores? Will it be able to take advantage of the additional cores or are 2 cores still ideal(one for the main thread, and the other to handle bgsave and other housekeeping operations)?

Similarly, on AWS ElastiCache does it make sense to use instance types with >2 vCPUs?

解决方案

Basing on release notes, I guess it does. Here's a piece of small information from there:

Despite Redis’ well-deserved reputation for high performance, its single-threaded architecture has been controversial among engineers who wondered if Redis could be even faster. Redis 6 rings in a new era: while it retains a core single-threaded data-access interface, I/O is now threaded.

By delegating the time spent reading and writing to I/O sockets over to other threads, the Redis process can devote more cycles to manipulating, storing, and retrieving data—boosting overall performance. This improvement retains the transactional characteristics of previous versions, so you don’t have to rethink your applications to take advantage of the increased performance. Similarly, Redis’ single-threaded DEL command can now be configured to behave like the multi-thread UNLINK command that has been available since Redis version 4.

The performance of a local variable is almost always unbeatable, Finally, even a database as high performance as Redis will be much slower than accessing something from the stack or heap. Redis 6 adds a new technique for sophisticated client libraries to implement a client-side caching layer to store a subset of data in your own process. This implementation is smart enough to manage multiple updates to the same data and keep your data as in-sync as possible—while retaining the advantages of Redis with the speed of local variables.

You could also check/compare it with redis-benchmark or memtier harness for your instance/workload profile.

这篇关于Redis 6 可以利用多核 CPU 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆