# 3.7 redis性能测试
* 测试存取大小为100字节的数据包的性能。
```bash
$ redis-benchmark -h 127.0.0.1 -p 6379 -q -d 100
PING_INLINE: 85910.65 requests per second PING_BULK: 123762.38 requests per second SET: 85763.29 requests per second
GET: 81699.35 requests per second
INCR: 82372.32 requests per second
LPUSH: 83472.46 requests per second
LPOP: 82712.98 requests per second
SADD: 82236.84 requests per second
SPOP: 83963.05 requests per second
LPUSH (needed to benchmark LRANGE): 82850.04 requests per second LRANGE_100 (first 100 elements): 29585.80 requests per second LRANGE_300 (first 300 elements): 9348.42 requests per second LRANGE_500 (first 450 elements): 7562.58 requests per second LRANGE_600 (first 600 elements): 6780.58 requests per second MSET (10 keys): 94428.70 requests per second
```
* 100个并发连接,100000个请求,检测host为localhost 端口为6379的redis服务器性能
```bash
$ redis-benchmark -h 127.0.0.1 -p 6379 -c 100 -n 100000
====== PING_INLINE ======
100000 requests completed in 0.83 seconds 100 parallel clients
3 bytes payload
keep alive: 1
98.95% <= 1 milliseconds
100.00% <= 1 milliseconds
120192.30 requests per second
====== PING_BULK ======
100000 requests
completed in 0.82 seconds
100 parallel clients
3 bytes payload
keep alive: 1
100.00% <= 0 milliseconds
121506.68 requests per second
====== SET ======
100000 requests
completed in 0.82 seconds
100 parallel clients
3 bytes payload
keep alive: 1
99.80% <= 1 milliseconds
100.00% <= 1 milliseconds
122249.38 requests per second
====== GET ======
100000 requests
completed in 0.81 seconds
100 parallel clients
3 bytes payload
keep alive: 1
99.79% <= 1 milliseconds
100.00% <= 1 milliseconds
122699.39 requests per second
====== INCR ======
100000 requests
completed in 0.81 seconds
100 parallel clients
3 bytes payload
keep alive: 1
99.95% <= 1 milliseconds
100.00% <= 1 milliseconds
124223.60 requests per second
====== LPUSH ======
100000 requests
completed in 0.82 seconds
100 parallel clients
3 bytes payload
keep alive: 1
99.82% <= 1 milliseconds
100.00% <= 1 milliseconds
122100.12 requests per second
====== LPOP ======
100000 requests
completed in 1.30 seconds
100 parallel clients
3 bytes payload
keep alive: 1
99.93% <= 1 milliseconds
100.00% <= 1 milliseconds
77160.49 requests per second
====== SADD ======
100000 requests
completed in 0.88 seconds
100 parallel clients
3 bytes payload
keep alive: 1
99.81% <= 1 milliseconds
99.97% <= 2 milliseconds
100.00% <= 2 milliseconds
113895.21 requests per second
====== SPOP ======
100000 requests completed in 0.82 seconds 100 parallel clients
3 bytes payload
keep alive: 1
99.78% <= 1 milliseconds
100.00% <= 1 milliseconds
121802.68 requests per second
====== LPUSH (needed to benchmark LRANGE) ====== 100000 requests
completed in 0.81 seconds
100 parallel clients
3 bytes payload
keep alive: 1
99.09% <= 1 milliseconds
99.94% <= 2 milliseconds
100.00% <= 2 milliseconds
122850.12 requests per second
====== LRANGE_100 (first 100 elements) ======
100000 requests
completed in 2.13 seconds
100 parallel clients
3 bytes payload
keep alive: 1
28.64% <= 1 milliseconds
99.65% <= 2 milliseconds
99.97% <= 3 milliseconds
100.00% <= 3 milliseconds
47036.69 requests per second
====== LRANGE_300 (first 300 elements) ======
100000 requests completed
in 5.46 seconds 100 parallel clients
3 bytes payload keep alive: 1
0.01% <= 1 milliseconds
0.50% <= 2 milliseconds
82.99% <= 3 milliseconds
99.11% <= 4 milliseconds
99.75% <= 5 milliseconds
99.95% <= 6 milliseconds
100.00% <= 6 milliseconds
18325.09 requests per second
====== LRANGE_500 (first 450 elements) ======
100000 requests
completed in 7.94 seconds
100 parallel clients
3 bytes payload
keep alive: 1
0.01% <= 1 milliseconds
0.10% <= 2 milliseconds
3.03% <= 3 milliseconds
58.57% <= 4 milliseconds
93.27% <= 5 milliseconds
99.03% <= 6 milliseconds
99.53% <= 7 milliseconds
99.72% <= 8 milliseconds
99.77% <= 9 milliseconds
99.82% <= 10 milliseconds
99.85% <= 11 milliseconds
99.88% <= 12 milliseconds
99.94% <= 13 milliseconds
99.97% <= 14 milliseconds
99.98% <= 15 milliseconds
99.99% <= 16 milliseconds
100.00% <= 17 milliseconds
100.00% <= 17 milliseconds
12600.81 requests per second
====== LRANGE_600 (first 600 elements) ======
100000 requests
completed in 10.34 seconds
100 parallel clients
3 bytes payload
keep alive: 1
0.00% <= 1 milliseconds
0.01% <= 2 milliseconds
0.10% <= 3 milliseconds
6.40% <= 4 milliseconds
45.93% <= 5 milliseconds
84.86% <= 6 milliseconds
95.54% <= 7 milliseconds
99.47% <= 8 milliseconds
99.81% <= 9 milliseconds
99.94% <= 10 milliseconds
99.99% <= 11 milliseconds
100.00% <= 11 milliseconds
9673.99 requests per second
====== MSET (10 keys) ======
100000 requests
completed in 1.01 seconds
100 parallel clients
3 bytes payload
keep alive: 1
84.16% <= 1 milliseconds
99.59% <= 2 milliseconds
99.85% <= 3 milliseconds
100.00% <= 3 milliseconds
99206.34 requests per second
```
- 概要
- 1 分布式存储fastDFS
- 1.1 fastDFS 通用介绍
- 1.2 fastDFS安装和使用
- 1.3 基于fastDFS实现分布式
- 2 缓存数据库redis快速搭建
- 2.1 环境安装
- 2.2 redis数据类型
- 2.3 redis订阅发布模式
- 2.4 redis事务
- 2.5 redis备份
- 3 redis详细攻略
- 3.1 redis简介
- 3.2 redis使用场景
- 3.3 redis基本操作
- 3.4 redis数据类型
- 3.4.1 字符串
- 3.4.2 HASH-字典
- 3.4.3 List-列表
- 3.4.4 Set-集合
- 3.4.5 Sorted Set-有序集合
- 3.4.6 订阅-发布
- 3.4.7 事务
- 3.5 redis配置文件
- 3.6 持久化
- 3.7 redis性能测试
- 3.8 redis-C-API
- 3.9 redis-C++-API
- 3.10 总结与建议
- 4 memcache缓存数据库
- 4.1 什么是memcached
- 4.2 memcached的特征
- 4.3 memcached的内存管理
- 4.4 如何使用memcached
- 4.5 memcached参数详解
- 4.6 memcached安装
- 4.7 memcached-C客户端
- 4.8 memcached-C++客户端
- 5 Nginx
- 6 FastCGI
- 6.1 CGI
- 6.2 FastCGI
- 6.3 Nginx与FastCGI
- 7 Nginx上部署fastDFS
- 8 项目概要
- 8.1 上传文件功能
- 8.2 主界面显示与下载文件功能
- 8.3 注册功能
- 8.4 登陆功能
- 8.5 文件分类功能
- 8.6 个人网盘功能
- 8.8 秒传功能