原文地址:http://antirez.com/news/52

Hello! As promised today I did some SSD testing.

The setup: a Linux box with 24 GB of RAM, with two disks.

A) A spinning disk.
b) An SSD (Intel 320 series). The idea is, what happens if I set the SSD disk partition as a swap partition and fill Redis with a dataset larger than RAM?
It is a lot of time I want to do this test, especially now that Redis focus is only on RAM and I abandoned the idea of targeting disk for a number of reasons. I already guessed that the SSD swap setup would perform in a bad way, but I was not expecting it was *so bad*. Before testing this setup, let's start testing Redis in memory with in the same box with a 10 GB data set. IN MEMORY TEST
=== To start I filled the instance with: ./redis-benchmark -r 1000000000 -n 1000000000 -P 32 set key:rand:000000000000 foo Write load in this way is very high, more than half million SET commands processed per second using a single core: instantaneous_ops_per_sec:629782 This is possible because we using a pipeline of 32 commands per time (see -P 32), so it is possible to limit the number of sys calls involved in the processing of commands, and the network latency component as well. After a few minutes I reached 10 GB of memory used by Redis, so I tried to save the DB while still sending the same write load to the server to see what the additional memory usage due to copy on write would be in such a stress conditions: [31930] 07 Mar 12:06:48.682 * RDB: 6991 MB of memory used by copy-on-write almost 7GB of additional memory used, that is 70% more memory.
Note that this is an interesting value since it is exactly the worst case scenario you can get with Redis: 1) Peak load of more than 0.6 million writes per second.
2) Writes are completely distributed across the data set, there is no working set in this case, all the DB is the working set. But given the enormous pressure on copy on write exercised by this workload, what is the write performance in this case while the system is saving? To find the value I started a BGSAVE and at the same time started the benchmark again: $ redis-cli bgsave; ./redis-benchmark -r 1000000000 -n 1000000000 -P 32 set key:rand:000000000000 foo
Background saving started
^Ct key:rand:000000000000 foo: 251470.34 250k ops/sec was the lower number I was able to get, as once copy on write starts to happen, there is less and less copy on write happening every second, and the benchmark soon returns to 0.6 million ops per second.
The number of keys was in the order of 100 million here. Basically the result of this test is, with real hardware and persisting to a normal spinning disk, Redis performs very well as long as you have enough RAM for your data, and for the additional memory used while saving. No big news so far. SSD SWAP TEST
=== For the SSD test we still use the spinning disk attached to the system in order to persist, so that the SSD is just working as a swap partition. To fill the instance even more I just started again redis-benchmark with the same command line, since with the specific parameters, if running forever, it would set 1 billion keys, that's enough :-) Since the instance has 24 GB of physical RAM, for the test to be meaningful I wanted to add enough data to reach 50 GB of used memory. In order to speedup the process of filling the instance I disabled persistence for some time using: CONFIG SET SAVE "" While filling the instance, at some point I started a BGSAVE to force some more swapping.
Then when the BGSAVE finished, I started the benchmark again: $ ./redis-benchmark -r 1000000000 -n 1000000000 -P 32 set key:rand:000000000000 foo
^Ct key:rand:000000000000 foo: 1034.16 As you can see the results were very bad initially, probably the main hash table ended swapped. After some time it started to perform in a decent way again: $ ./redis-benchmark -r 1000000000 -n 1000000000 -P 32 set key:rand:000000000000 foo
^Ct key:rand:000000000000 foo: 116057.11 I was able to stop and restart the benchmark multiple times and still get decent performances on restarts, as long I was not saving at the same time. However performances continued to be very erratic, jumping from 200k to 50k sets per second. …. and after 10 minutes … It only went from 23 GB of memory used to 24 GB, with 2 GB of data set swapped on disk. As soon as it started to have a few GB swapped performances started to be simply too poor to be acceptable. I then tried with reads: $ ./redis-benchmark -r 1000000000 -n 1000000000 -P 32 get key:rand:000000000000
^Ct key:rand:000000000000 foo: 28934.12 Same issue, 30k ops per second both for GET and SET, and *a lot* of swap activity at the same time.
What's worse is that the system was pretty unresponsive as a whole at this point. At this point I stopped the test, the system was slow enough that filling it even more would require a lot of time, and as more data was swapped performances started to get worse. WHAT HAPPENS?
=== What happens is simple, Redis is designed to work in an environment where random access of memory is very fast.
Hash tables, and the way Redis objects are allocated is all based on this concept. Now let's give a look at the SSD 320 disk specifications: Random write (100% Span) -> 400 IOPS
Random write (8GB Span) -> 23000 IOPS Basically what happens is that at some point Redis starts to force the OS to move memory pages between RAM and swap at *every* operation performed, since we are accessed keys at random, and there are no more spare pages. CONCLUSION
=== Redis is completely useless in this way. Systems designed to work in this kind of setups like Twitter fatcache or the recently announced Facebook McDipper need to be SSD-aware, and can probably work reasonably only when a simple GET/SET/DEL model is used. I also expect that the pathological case for this systems, that is evenly distributed writes with big span, is not going to be excellent because of current SSD disk limits, but that's exactly the case Redis is trying to solve for most users. The freedom Redis gets from the use of memory allows us to serve much more complex tasks at very good peak performance and with minimal system complexity and underlying assumptions. TL;DR: the outcome of this test was expected and Redis is an in-memory system :-)

SSD卡对redis的影响的更多相关文章

  1. SSD卡对mongodb的影响

    结论 1:SSD卡显著改善磁盘IO,io占用在50%以下 2:SSD卡使mongodb性能稳定.在200并发,数据量是内存5倍的情况下仍然保证每秒1500次插入和4500次查询.     数据如下: ...

  2. win10 ssd 卡顿

    http://www.pconline.com.cn/win10/739/7395324.html

  3. 你知道CPU结构也会影响Redis性能吗?

    啦啦啦,我是卖身不卖艺的二哈,ε=(´ο`*)))唉错啦(我是开车的二哈),我又来了,铁子们一起开车呀! 今天来分析下CPU结构对Redis性能会有影响吗? 在进行Redis性能分析的时候,通常我们会 ...

  4. 深度评测丨 GaussDB(for Redis) 大 Key 操作的影响

    本文分享自华为云社区<墨天轮评测:GaussDB(for Redis)大Key操作的影响>,作者: 高斯 Redis 官方博客. 在前一篇文章<墨天轮评测:GaussDB(for R ...

  5. [转]细说Redis监控和告警

    原文  https://zhuoroger.github.io/2016/08/20/redis-monitor-and-alarm/? 对于任何应用服务和组件,都需要一套完善可靠谱监控方案. 尤其r ...

  6. mac下的改装人生——关于ssd

    这两天研究了很多关于ssd的东西,想想还是写下来把,毕竟花了这么多时间进去. 先说一下我自己的电脑把.前几天,因为嫌我的电脑是在是太卡了,准备来次升级,然后先买了个8g的内存装上,发现的确是没有死机的 ...

  7. 【转】花开正当时,十四款120/128GB SSD横向评测

    原文地址:http://www.expreview.com/19604-all.html SSD横评是最具消费指导意义的评测文章,也是各类热门SSD固态硬盘的决斗疆场.SSD评测在行业内已经有不少网站 ...

  8. Redis计算地理位置距离-GeoHash

    Redis 在 3.2 版本以后增加了地理位置 GEO 模块,意味着我们可以使用 Redis 来实现摩拜单车「附近的 Mobike」.美团和饿了么「附近的餐馆」这样的功能了. 地图元素的位置数据使用二 ...

  9. [转]SSD固态存储大观(一)

    From: http://blog.51cto.com/alanwu/1405874 Contents 1.概述... 1 2.FusionIO:Pcie SSD的始作俑者... 2 3.Intel ...

随机推荐

  1. Django的auto_now=True没有自动更新

    auto_now=True自动更新,有一个条件,就是要通过django的model层. 如create或是save方法. 如果是filter之后update方法,则直接调用的是sql,不会通过mode ...

  2. zookeeper在dubbo中干什么

    本文旨在表述出自己对于zookeeper在dubbo的作用的初步理解 在对dubbo进行了初步的探索后,对于zookeeper在其中的作用不甚了解,因为本身对zookeeper就没有一个特别具体的概念 ...

  3. BZOJ1786 [Ahoi2008]Pair 配对 动态规划 逆序对

    欢迎访问~原文出处——博客园-zhouzhendong 去博客园看该题解 题目传送门 - BZOJ1786 题意概括 给出长度为n的数列,只会出现1~k这些正整数.现在有些数写成了-1,这些-1可以变 ...

  4. 【noip模拟赛4】汽艇 模拟

    描述 一天sxc,zsx,wl到gly坐汽艇,本来和其他的人约好了一起去,结果被放了鸽子,3人便只有一人负担x元去坐汽艇(很贵哦).坐了才发现如果汽艇上人多了位置就不宽敞,就不好玩了.而3个人貌似是最 ...

  5. ATM+购物车商城

    模拟实现一个ATM + 购物商城程序 额度 15000或自定义 实现购物商城,买东西加入 购物车,调用信用卡接口结账 可以提现,手续费5% 支持多账户登录 支持账户间转账 记录每月日常消费流水 提供还 ...

  6. ubuntu16.04下vim的安装与配置

    一.安装vim 使用命令 $ sudo apt-get install vim  来安装vim,安装后的vim需要进行一些配置,不然使用起来会有些不方便,比如不会自动缩进. 二.配置vim 使用命令  ...

  7. tensorflow入门(1):构造线性回归模型

    今天让我们一起来学习如何用TF实现线性回归模型.所谓线性回归模型就是y = W * x + b的形式的表达式拟合的模型. 我们先假设一条直线为 y = 0.1x + 0.3,即W = 0.1,b = ...

  8. @ConfigurationProperties和@Value 注入

    我这里使用的Spring Boot 2.0.1 版本 配置文件是 yml 格式文件 @ConfigurationProperties 在yml配置文件中: 在实体类中: 重点是实体类上的两个注解: @ ...

  9. psssss test

    我觉得我不该写博客了

  10. 2016年3月3日android实习笔记

    1: android自定义控件时,通常需要重写父类构造函数.这三个够找函数具体啥时调用? public View (Context context) 是在java代码创建视图的时候被调用,如果是从xm ...