1. 程式人生 > >【Redis】狀態與效能監控命令

【Redis】狀態與效能監控命令



1、redis-benchmark 
redis基準資訊,redis伺服器效能檢測 

redis-benchmark -h localhost -p 6379 -c 100 -n 100000 
100個併發連線,100000個請求,檢測host為localhost 埠為6379的redis伺服器效能 

  1. [root@Architect redis-1.2.6]# redis-benchmark -h localhost -p 6379 -c 100 -n 100000  
  2. ====== PING ======  
  3.   10001 requests completed in 0.41 seconds  
  4.   50 parallel clients  
  5.   3 bytes payload  
  6.   keep alive: 1  
  7. 0.01% <= 0 milliseconds  
  8. 23.09% <= 1 milliseconds  
  9. 85.82% <= 2 milliseconds  
  10. 95.60% <= 3 milliseconds  
  11. 97.20% <= 4 milliseconds  
  12. 97.96% <= 5 milliseconds  
  13. 98.83% <= 6 milliseconds  
  14. 99.41% <= 7 milliseconds  
  15. 99.70% <= 8 milliseconds  
  16. 99.99% <= 9 milliseconds  
  17. 100.00% <= 12 milliseconds  
  18. 24274.27 requests per second  


2、redis-cli 

redis-cli -h localhost -p 6380 monitor 
Dump all the received requests in real time; 
監控host為localhost,埠為6380,redis的連線及讀寫操作
 
  1. [root@Architect redis-1.2.6]# redis-cli -h localhost -p 6380 monitor  
  2. +OK  
  3. +1289800615.808225 "monitor"  
  4. +1289800615.839079 "GET" "name"  
  5. +1289800615.853694 "PING"  
  6. +1289800615.853783 "PING"  
  7. +1289800615.854646 "PING"  
  8. +1289800615.854974 "PING"  
  9. +1289800615.857693 "PING"  
  10. +1289800615.866862 "PING"  
  11. +1289800615.871944 "PING"  


redis-cli -h localhost -p 6380 info 
Provide information and statistics about the server ; 
提供host為localhost,埠為6380,redis服務的統計資訊
 
  1. [root@Architect redis-1.2.6]# redis-cli -h localhost -p 6380 info  
  2. redis_version:2.0.4  
  3. redis_git_sha1:00000000  
  4. redis_git_dirty:0  
  5. arch_bits:32  
  6. multiplexing_api:epoll  
  7. process_id:21990  
  8. uptime_in_seconds:490580  
  9. uptime_in_days:5  
  10. connected_clients:103  
  11. connected_slaves:0  
  12. blocked_clients:0  
  13. used_memory:4453240  
  14. used_memory_human:4.25M  
  15. changes_since_last_save:200  
  16. bgsave_in_progress:0  
  17. last_save_time:1290394640  
  18. bgrewriteaof_in_progress:0  
  19. total_connections_received:809  
  20. total_commands_processed:44094018  
  21. expired_keys:0  
  22. hash_max_zipmap_entries:64  
  23. hash_max_zipmap_value:512  
  24. pubsub_channels:0  
  25. pubsub_patterns:0  
  26. vm_enabled:0  
  27. role:slave  
  28. master_host:localhost  
  29. master_port:6379  
  30. master_link_status:up  
  31. master_last_io_seconds_ago:18  
  32. db0:keys=1319,expires=0  


3、redis-stat 

redis-stat host localhost port 6380 overview 
Print general information about a Redis instance; 
實時打印出host為localhost,埠為6380,redis例項的總體資訊
 
  1. [root@Architect redis-1.2.6]# redis-stat port 6380 overview  
  2.  ------- data ------ ------------ load ----------------------------- - childs -  
  3.  keys      used-mem  clients   requests            connections  
  4.  1319      5.37M     103       44108021 (+44108021810                 
  5.  1319      5.38M     103       44108124 (+103)     810                 
  6.  1319      5.38M     103       44108225 (+101)     810                 
  7.  1319      5.39M     103       44108326 (+101)     810                 
  8.  1319      5.40M     103       44108427 (+101)     810                 
  9.  1319      5.41M     103       44108528 (+101)     810                 


redis-stat host localhost port 6380 overview 
Measure Redis server latency; 
輸出host為localhost,埠為6380,redis服務中每個請求的響應時長
 
  1. [root@Architect redis-1.2.6]# redis-stat port 6380 latency  
  2. 10.16 ms  
  3. 20.11 ms  
  4. 30.15 ms  
  5. 40.11 ms  
  6. 50.18 ms  
  7. 60.14 ms