- Redis 基礎
- Redis - 首頁
- Redis - 概述
- Redis - 環境
- Redis - 配置
- Redis - 資料型別
- Redis 命令
- Redis - 命令
- Redis - 鍵
- Redis - 字串
- Redis - 雜湊
- Redis - 列表
- Redis - 集合
- Redis - 有序集合
- Redis - HyperLogLog
- Redis - 釋出訂閱
- Redis - 事務
- Redis - 指令碼
- Redis - 連線
- Redis - 伺服器
- Redis 高階
- Redis - 備份
- Redis - 安全
- Redis - 基準測試
- Redis - 客戶端連線
- Redis - 管道
- Redis - 分割槽
- Redis - Java
- Redis - Php
- Redis 有用資源
- Redis - 快速指南
- Redis - 有用資源
- Redis - 討論
Redis - 基準測試
Redis 基準測試是一個實用程式,透過同時執行 n 個命令來檢查 Redis 的效能。
語法
以下是 Redis 基準測試的基本語法。
redis-benchmark [option] [option value]
示例
以下示例透過呼叫 100000 個命令來檢查 Redis。
redis-benchmark -n 100000 PING_INLINE: 141043.72 requests per second PING_BULK: 142857.14 requests per second SET: 141442.72 requests per second GET: 145348.83 requests per second INCR: 137362.64 requests per second LPUSH: 145348.83 requests per second LPOP: 146198.83 requests per second SADD: 146198.83 requests per second SPOP: 149253.73 requests per second LPUSH (needed to benchmark LRANGE): 148588.42 requests per second LRANGE_100 (first 100 elements): 58411.21 requests per second LRANGE_300 (first 300 elements): 21195.42 requests per second LRANGE_500 (first 450 elements): 14539.11 requests per second LRANGE_600 (first 600 elements): 10504.20 requests per second MSET (10 keys): 93283.58 requests per second
以下是 Redis 基準測試中可用選項的列表。
| 序號 | 選項 | 描述 | 預設值 |
|---|---|---|---|
| 1 | -h | 指定伺服器主機名 | 127.0.0.1 |
| 2 | -p | 指定伺服器埠 | 6379 |
| 3 | -s | 指定伺服器套接字 | |
| 4 | -c | 指定並行連線數 | 50 |
| 5 | -n | 指定請求總數 | 10000 |
| 6 | -d | 指定 SET/GET 值的資料大小(以位元組為單位) | 2 |
| 7 | -k | 1=保持活動狀態,0=重新連線 | 1 |
| 8 | -r | 為 SET/GET/INCR 使用隨機鍵,為 SADD 使用隨機值 | |
| 9 | -p | 管道 <numreq> 個請求 | 1 |
| 10 | -h | 指定伺服器主機名 | |
| 11 | -q | 強制 Redis 靜默。僅顯示查詢/秒值 | |
| 12 | --csv | 以 CSV 格式輸出 | |
| 13 | -l | 生成迴圈,永遠執行測試 | |
| 14 | -t | 僅執行用逗號分隔的測試列表 | |
| 15 | -I | 空閒模式。僅開啟 N 個空閒連線並等待 |
示例
以下示例顯示了 Redis 基準測試實用程式中的多個用法選項。
redis-benchmark -h 127.0.0.1 -p 6379 -t set,lpush -n 100000 -q SET: 146198.83 requests per second LPUSH: 145560.41 requests per second
廣告