Windows 和 linux 下面 Redis 性能比较

windows,linux,下面,redis,性能,比较 · 浏览次数 : 210

小编点评

## Windows 和 Linux 下 Redis 性能比较问题来源 以下是两种操作系统下 Redis 性能比较的总结: **Windows 3.2.100:** * 性能比 Linux 6.2.8 高 1.4 倍。 * 测试脚本中使用 `LPUSH` 等命令会导致性能下降。 **Linux 6.2.8:** * 性能比 Windows 3.2.100 高 2.3 倍。 * 测试脚本中使用 `LRANGE_100` 等命令会导致性能下降。 **其他问题:** * **最大打开文件数限制:** Windows 上的 Redis 限制为 10032,而 Linux 上的限制取决于系统内存量。 * **`LPUSH` 和 `LRANGE_100` 等命令会导致性能下降,因为它需要遍历整个数据集。 * **内存使用率过高:** 即使使用 `LPUSH` 等命令,也可能导致内存使用率过高,影响性能。 **归纳总结:** * 在相同硬件条件下,Windows 3.2.100 通常具有更高的性能,但性能会随着 `LPUSH` 等命令的使用而下降。 * 在相同硬件条件下,Linux 6.2.8 通常具有更高的性能,但性能会随着 `LRANGE_100` 等命令的使用而下降。 **其他建议:** * 优化 Redis 配置,例如减少 `maxmemory` 和 `maxconnections` 等选项。 * 使用线程池或其他并发技术来提高性能。 * 监控 Redis 的内存使用率和性能,及时进行调整。

正文

Windows 和 linux 下面 Redis 性能比较


问题来源

公司里面有一些环境还是使用Windows来跑
对应的. Redis和nginx 也是跑在Windows上面
但是微软官网自从 3.2.100 之后就再也没有编译过Windows版本的redis

网上能找到的基本上都不让用于生产. 
但是3.2.100 版本太早了, 很多特性支持的也不是很好. 
这里想比较一下他们两者的性能. 以便备忘.

版本说明

1. Windows 上面采用微软编译的 3.2.100 和 github上面有人编译的 6.2.12的版本
2. linux上面采用 6.2.8的版本

都采用默认参数启动. 
测试脚本为:
redis-benchmark.exe -h 127.0.0.1 -p 6379 -n 100000 -c 20 -q
./redis-benchmark -h 127.0.0.1 -p 6379 -n 100000 -c 20 -q

Windows上面的其他问题

1. 微软的系统有一个 3200 个文件打开数的限制.
   我花了一个小时没有找到一个合适的注册表修改方法来避开这个参数. 

# Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
# Current maximum open files is 3200. maxclients has been reduced to 3168 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.

注意提示信息还是 linux的方法.Redis 默认有32个文件数是留给内部使用的. 

2. 部分自行用cygwin 或者是  msys2 编译的版本稳定性不足. 运行一段时间就会卡死宕机. 
上生产必须进行严格的 压力和性能测试才可以. 

机器配置信息

机器用的是一个 两路的2015年产的服务器
CPU为: E5-2620v2 2.1Ghz
内存为: 256G
磁盘为: 5快2T near-line 7200rpm HDD raid6
操作系统: Win2019

虚拟机为Windows 上面的CentOS8.0 虚拟机. 

部分结论

微软编译的 3.2.100 是github 吃瓜群众编译的 6.2.12 的 1.4倍的性能. 

linux上面的6.2.8 是 github 吃瓜群众编译的6.2.12的 2.3 倍的性能

linux上面 6.2.8 是 windows 3.2.100 性能的 1.6 倍 

Windows 上面的redis 被碾压..

部分图标

image


image


如下是详细结果


Windows 3.2.100

PING_INLINE: 22296.54 requests per second
PING_BULK: 22872.83 requests per second
SET: 22967.39 requests per second
GET: 23380.88 requests per second
INCR: 22246.94 requests per second
LPUSH: 23375.41 requests per second
RPUSH: 22862.37 requests per second
LPOP: 23239.60 requests per second
RPOP: 22794.62 requests per second
SADD: 23299.16 requests per second
SPOP: 23062.73 requests per second
LPUSH (needed to benchmark LRANGE): 23272.05 requests per second
LRANGE_100 (first 100 elements): 12515.64 requests per second
LRANGE_300 (first 300 elements): 7000.84 requests per second
LRANGE_500 (first 450 elements): 5093.21 requests per second
LRANGE_600 (first 600 elements): 4213.72 requests per second
MSET (10 keys): 19845.21 requests per second

Windows 6.2.12

PING_INLINE: 15822.78 requests per second, p50=0.863 msec
PING_MBULK: 15900.78 requests per second, p50=0.847 msec
SET: 15669.07 requests per second, p50=0.863 msec
GET: 15900.78 requests per second, p50=0.855 msec
INCR: 15943.88 requests per second, p50=0.855 msec
LPUSH: 15669.07 requests per second, p50=0.895 msec
RPUSH: 15710.92 requests per second, p50=0.887 msec
LPOP: 15661.71 requests per second, p50=0.887 msec
RPOP: 15987.21 requests per second, p50=0.863 msec
SADD: 16048.79 requests per second, p50=0.855 msec
HSET: 15812.78 requests per second, p50=0.895 msec
SPOP: 15787.81 requests per second, p50=0.847 msec
ZADD: 15600.62 requests per second, p50=0.911 msec
ZPOPMIN: 15959.15 requests per second, p50=0.847 msec
LPUSH (needed to benchmark LRANGE): 15800.28 requests per second, p50=0.887 msec
LRANGE_100 (first 100 elements): 9330.97 requests per second, p50=1.383 msec
LRANGE_300 (first 300 elements): 4779.20 requests per second, p50=2.119 msec
LRANGE_500 (first 500 elements): 3214.19 requests per second, p50=3.191 msec
LRANGE_600 (first 600 elements): 2837.85 requests per second, p50=3.663 msec
MSET (10 keys): 14751.44 requests per second, p50=1.023 msec

linux 6.2.8

PING_INLINE: 37453.18 requests per second, p50=0.279 msec
PING_MBULK: 36589.83 requests per second, p50=0.287 msec
SET: 37160.91 requests per second, p50=0.295 msec
GET: 36630.04 requests per second, p50=0.295 msec
INCR: 36589.83 requests per second, p50=0.295 msec
LPUSH: 37355.25 requests per second, p50=0.303 msec
RPUSH: 37383.18 requests per second, p50=0.303 msec
LPOP: 36968.58 requests per second, p50=0.311 msec
RPOP: 37064.49 requests per second, p50=0.303 msec
SADD: 37023.32 requests per second, p50=0.295 msec
HSET: 36683.79 requests per second, p50=0.303 msec
SPOP: 37160.91 requests per second, p50=0.295 msec
ZADD: 36913.99 requests per second, p50=0.311 msec
MSET (10 keys): 36941.26 requests per second, p50=0.375 msec

与Windows 和 linux 下面 Redis 性能比较相似的内容:

Windows 和 linux 下面 Redis 性能比较

# Windows 和 linux 下面 Redis 性能比较 ## 问题来源 ``` 公司里面有一些环境还是使用Windows来跑 对应的. Redis和nginx 也是跑在Windows上面 但是微软官网自从 3.2.100 之后就再也没有编译过Windows版本的redis 网上能找到的基本上

[转帖]编译实战 | 手摸手教你在Windows环境下运行Redis6.x

原创:微信公众号 码农参上,欢迎分享,转载请保留出处。 哈喽大家好啊,我是没事就愿意瞎捣鼓的Hydra。 不知道有没有小伙伴像我一样,平常开发中用的是windows操作系统,有时候想装点什么软件,一看只支持linux系统,无奈要么启动虚拟机、要么装在云服务器上。 这不前几天又是这样,刚想用一下Red

QtCreator 跨平台开发添加动态库教程(以OpenCV库举例)- Windows篇

Qt具有跨平台的特性,即Qt数据结构与算法库本身跨平台和编译脚本(.pro)跨平台。在同时具有Windows下和Linux开发的需求时,最好的建议是使用QtCreator来开发,虽然也可以使用其他的IDE配合CMake等方式,但使用QtCreator更加方便,并且操作环境完全一致。QtCreator

[转帖]如何使用storcli在系统中管理RAID磁盘阵列

Windows版和Linux版storcli命令中个别参数略有差异,可以查看帮助文件,命令如下: ./storcli help page=30 上面命令page=30表示每页显示30行内容。 下载storcli storcli下载地址如下: StorCLI Standalone Utility 查看

GitHub SSH 快速配置

每次更换系统或者电脑时,都需要重新配置一番 Github SSH 的验证,记性不太好,写了一个快速部署的辅助脚本,直接安装脚本提示使用即可,经测试,Linux 和 Windows 下均能使用。 脚本功能 设置 Git 用户名和邮箱 脚本会提示用户输入 Git 用户名和邮箱,并将其设置为全局配置。 生

推荐一个 C#写的 支持OCR的免费通用扫描仪软件

NAPS2是一个开源免费软件,体积只有6M不到,支持运行在 Windows, Mac 和 Linux操作系统中,默认就带有简体中文界面,官方默认就提供绿色版,所以解压即可使用,直接可以从官方网站下载:https://www.naps2.com/。NAPS2全名叫做Not Another PDF Sc

[转帖]Linux:crontab要点整理(表达式,转义,权限管理,日志)

https://www.jianshu.com/p/fd46652f247e 摘要:Linux,crontab整理crontab的使用,包括cron表达式,设置和删除任务,权限管理,查看日志 crontab简介 crontab命令被用来提交和管理用户的需要周期性执行的任务,与windows下的计划任

Windows 挂载minio 到本地磁盘

# Windows 挂载minio 到本地磁盘 ## 背景 ``` 新公司建议使用minio 进行一些业务操作 已经在各位领导同事的帮助下找到了linux本地s3fs挂载和k8s使用csi方式挂载到pod内的方式. 今天一个帮助过我的同事想用windows平台进行联调. 我感觉很有必要解决这个联调的

Win11系统下的MindSpore环境搭建

本文介绍了一个在Win11系统下,通过WSL2+Docker+VSCode的方案搭建了一个mindspore-gpu的编程环境。这种方案既可以实现Linux系统编程以及部署的便捷性,又可以兼顾Windows系统强大的办公软件生态,甚至还可以借助Docker达到一定的软件可迁移性和可复制性。

[转帖]Nginx源码编译安装

https://www.cnblogs.com/lizexiong/p/15012713.html Nginx 是一款优秀的开源软件,支持在 FreeBSD、Linux、Windows、macOS 等多种操作系统平台下编译及运行。CentOS 拥有良好的系统结构和工具软件生态环境,是一款基于 Lin