我在windows10 里面安装了Ubuntu 20.04.4 LTS,
然后在Ubuntu 20.04.4 LTS 安装了Redis 6.2.6。
下面我要进行性能测试
****
首先我打开一个Ubuntu 20.04.4 LTS ,就像是打开一个普通应用程序一样,然后弹出界面
Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 4.4.0-19041-Microsoft x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Fri Apr 8 10:28:53 CST 2022
System load: 0.52 Processes: 9
Usage of /home: unknown Users logged in: 0
Memory usage: 48% IPv4 address for wifi0: 192.168.1.105
Swap usage: 0%
10 updates can be applied immediately.
To see these additional updates run: apt list --upgradable
*** System restart required ***
This message is shown once a day. To disable it please create the
/home/gsz/.hushlogin file.
我输入redis-serve
然后返回:
3042:C 08 Apr 2022 10:29:10.577 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
3042:C 08 Apr 2022 10:29:10.577 # Redis version=6.2.6, bits=64, commit=00000000, modified=0, pid=3042, just started
3042:C 08 Apr 2022 10:29:10.578 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
3042:M 08 Apr 2022 10:29:10.579 * Increased maximum number of open files to 10032 (it was originally set to 1024).
3042:M 08 Apr 2022 10:29:10.579 * monotonic clock: POSIX clock_gettime
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 6.2.6 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 3042
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
3042:M 08 Apr 2022 10:29:10.586 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
3042:M 08 Apr 2022 10:29:10.587 # Server initialized
3042:M 08 Apr 2022 10:29:10.587 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
3042:M 08 Apr 2022 10:29:10.588 * Loading RDB produced by version 6.2.6
3042:M 08 Apr 2022 10:29:10.588 * RDB age 28 seconds
3042:M 08 Apr 2022 10:29:10.589 * RDB memory usage when created 3.55 Mb
3042:M 08 Apr 2022 10:29:10.589 # Done loading RDB, keys loaded: 2, keys expired: 0.
3042:M 08 Apr 2022 10:29:10.591 * DB loaded from disk: 0.003 seconds
3042:M 08 Apr 2022 10:29:10.591 * Ready to accept connections
至此redis 的服务器开启完毕。
然后 我重新打开Ubuntu 20.04.4 LTS ,就像是打开一个普通应用程序一样,然后弹出界面。
然后输入
redis-benchmark -c 50 -n 10000
然后返回很多东西
(redis性能测试redis-benchmark - 日行一善g - 博客园)
50个客户端同时请求Redis,一共一万次。默认只会有三个键值来回写入,可以通过keys *看到。
我们可以看到部分指令在1ms以内完成。牛X啊
throughput summary: 40000.00 requests per second
latency summary (msec):
avg min p50 p95 p99 max
0.636 0.160 0.607 0.863 0.983 1.391
上图是Redis 官方的可视化软件,
可以看到 有50+2个客户端链接
每秒处理24566和指令
总共占用内存4MB
CPU占用19.69%