1. 程式人生 > 遊戲攻略 >《幻塔》擬態喚醒強度排名

《幻塔》擬態喚醒強度排名

【1】TCP壓測

【1.1】tcp區域網壓測

當前例項,配置檔案中已經開啟了 4 個執行緒

(1)單執行緒

CPU使用:300%-340%

redis-benchmark -h 192.168.191.82 -p 6387 -a 123456 -d 3 -q -c 50 -n 1000000 --threads 1 -t get,set,lpush

(2)4執行緒

redis-benchmark -h 192.168.191.82 -p 6387 -a 123456 -d 3 -q -c 50 -n 1000000 --threads 4 -t get,set,lpush

CPU使用:290%-330%

結果如下:

[root@bf-ltredis-4 ~]# redis-benchmark -h 192.168.191.82 -p 6387 -a 123456 -d 3 -q -c 50 -n 1000000 --threads 4 -t get,set,lpush

SET: 26722.25 requests per second, p50=1.759 msec

GET: 27276.20 requests per second, p50=1.719 msec

LPUSH: 26908.49 requests per second, p50=1.751 msec

[root@bf-ltredis-4 ~]# redis-benchmark -h 192.168.191.82 -p 6387 -a 123456 -d 3 -q -c 50 -n 1000000 --threads 1 -t get,set,lpush

SET: 26541.39 requests per second, p50=1.711 msec

GET: 28498.96 requests per second, p50=1.599 msec

LPUSH: 26726.53 requests per second, p50=1.719 msec

-------------------------------------------------------------------------------------------------------

當前例項,配置檔案中已經開啟了 1 個執行緒

(1)單執行緒

CPU使用:50%

redis-benchmark -h 192.168.191.82 -p 6387 -a 123456 -d 3 -q -c 50 -n 1000000 --threads 1 -t get,set,lpush

(2)4執行緒

redis-benchmark -h 192.168.191.82 -p 6387 -a 123456 -d 3 -q -c 50 -n 1000000 --threads 4 -t get,set,lpush

CPU使用:50%

結果和上面一樣

【1.2】本地測試

當前例項,配置檔案中已經開啟了 1 個執行緒

(1)單執行緒

CPU使用:100

redis-benchmark -h 192.168.191.82 -p 6387 -a 123456 -d 3 -q -c 50 -n 1000000 --threads 1 -t get,set,lpush

(2)4執行緒

redis-benchmark -h 192.168.191.82 -p 6387 -a 123456 -d 3 -q -c 50 -n 1000000 --threads 4 -t get,set,lpush

CPU使用:100%

結果如下:

[root@bf-ltredis-3 6387_redis]# redis-benchmark -h 192.168.191.82 -p 6387 -a 123456 -d 3 -q -c 50 -n 1000000 --threads 1 -t get,set,lpush

SET: 68226.79 requests per second, p50=0.447 msec

GET: 72521.58 requests per second, p50=0.343 msec

LPUSH: 72806.70 requests per second, p50=0.447 msec

[root@bf-ltredis-3 6387_redis]# redis-benchmark -h 192.168.191.82 -p 6387 -a 123456 -d 3 -q -c 50 -n 1000000 --threads 4 -t get,set,lpush

SET: 67535.62 requests per second, p50=0.711 msec

GET: 76663.60 requests per second, p50=0.615 msec

LPUSH: 60375.54 requests per second, p50=0.767 msec

-------------------------------------------------------------------------------------------------------

當前例項,配置檔案中已經開啟了 4 個執行緒

(1)單執行緒

CPU使用:寫時400%,讀時 130%

redis-benchmark -h 192.168.191.82 -p 6387 -a 123456 -d 3 -q -c 50 -n 1000000 --threads 1 -t get,set,lpush

(2)4執行緒

redis-benchmark -h 192.168.191.82 -p 6387 -a 123456 -d 3 -q -c 50 -n 1000000 --threads 4 -t get,set,lpush

CPU使用:寫時400%,讀時 130%

結果如下:

[root@bf-ltredis-3 6387_redis]# redis-benchmark -h 192.168.191.82 -p 6387 -a 123456 -d 3 -q -c 50 -n 1000000 --threads 1 -t get,set,lpush

SET: 68166.33 requests per second, p50=0.407 msec

GET: 72243.90 requests per second, p50=0.335 msec

LPUSH: 61996.29 requests per second, p50=0.471 msec

[root@bf-ltredis-3 6387_redis]# redis-benchmark -h 192.168.191.82 -p 6387 -a 123456 -d 3 -q -c 50 -n 1000000 --threads 4 -t get,set,lpush

SET: 117082.30 requests per second, p50=0.343 msec

GET: 132502.98 requests per second, p50=0.303 msec

LPUSH: 97162.84 requests per second, p50=0.423 msec

【1.3】結論

(1)redis 1個執行緒時

本地壓測:無論客戶端是幾個執行緒連線過來,處理效率一樣

(2)redis 4個執行緒時

本地壓測:當客戶端只有一個執行緒訪問時,效率與redis 1個執行緒時相同;當客戶端使用多個執行緒連線時,4執行緒的redis 效率是單執行緒的 1.5-2倍左右

【2】叢集壓測

【2.1】壓測單執行緒

當前例項,配置檔案中已經開啟了 4 個執行緒

(1)redis-benchmark -h 192.168.191.176 -p 6381 -a 123456 --cluster -d 3 -q -c 50 -n 1000000 --threads 1 -t get,set,lpush

CPU使用:寫時250-320%,讀時 150%左右

[root@bf-ltredis-4 /]# redis-benchmark -h 192.168.191.176 -p 6381 -a 123456 --cluster -d 3 -q -c 50 -n 1000000 --threads 1 -t get,set,lpush

WARNING: master node 192.168.191.176:6382 has no slots, skipping...

Cluster has 3 master nodes:

Master 0: 367152fbf6401b4316a4ae913cb4fb3d57bc7782 192.168.191.70:6385

Master 1: 11ac5cf5004f22a55ee0afa2b221d120ad768f7d 192.168.191.211:6384

Master 2: f5dc23c602b57f6b09b4909d01289ff4d80220ed 192.168.191.70:6386

SET: 35473.57 requests per second, p50=1.199 msec

GET: 38270.19 requests per second, p50=1.071 msec

LPUSH: 37145.72 requests per second, p50=1.167 msec

【1】單例項,配置檔案執行緒4

【1.1】壓測

  


redis-benchmark -h 192.168.191.82 -p 6387 -a 123456 -d 3 -q -c 10 -n 10000000 --threads 1 -t get,set,lpush -P 10
SET: 209244.42 requests per second, p50=0.423 msec
GET: 250037.52 requests per second, p50=0.343 msec
LPUSH: 192871.47 requests per second, p50=0.463 msec

[root@bf-ltredis-2 ~]# redis-benchmark -h 192.168.191.82 -p 6387 -a 123456 -d 3 -q -c 20 -n 10000000 --threads 1 -t get,set,lpush -P 10
SET: 212282.69 requests per second, p50=0.839 msec
GET: 247261.58 requests per second, p50=0.695 msec
LPUSH: 200304.47 requests per second, p50=0.903 msec

[root@bf-ltredis-2 ~]# redis-benchmark -h 192.168.191.82 -p 6387 -a 123456 -d 3 -q -c 30 -n 10000000 --threads 1 -t get,set,lpush -P 10
SET: 223333.92 requests per second, p50=1.207 msec
GET: 256482.61 requests per second, p50=1.023 msec
LPUSH: 215810.25 requests per second, p50=1.263 msec

[root@bf-ltredis-2 ~]# redis-benchmark -h 192.168.191.82 -p 6387 -a 123456 -d 3 -q -c 50 -n 10000000 --threads 1 -t get,set,lpush -P 10
SET: 240830.39 requests per second, p50=1.871 msec
GET: 270584.72 requests per second, p50=1.623 msec
LPUSH: 230260.88 requests per second, p50=1.951 msec

【1.2】單執行緒壓測 結論

  

如上圖我們可以發現,在pipline =10,客戶端連線為20個時,就幾乎達到了效能最大值;
且 GET 時 耗費 CPU更少

【2】叢集,全執行緒4

【2.1】叢集架構

例項與監控對應關係
+ 192.168.191.176:6381 =》 192.168.191.176:9121
+ 192.168.191.176:6382 =》 192.168.191.176:9122
+ 192.168.191.211:6383 =》 192.168.191.211:9121
+ 192.168.191.211:6384 =》 192.168.191.211:9122
+ 192.168.191.70:6385 =》 192.168.191.70:9121
+ 192.168.191.70:6386 =》 192.168.191.70:9122
其中 6384/6385/6386 是主庫,主從關係如下:
6384=》6381 , 6385=》6382 , 6386=》6383
  

【2.2】叢集4執行緒壓測

[root@bf-ltredis-3 ~]# redis-benchmark --cluster -h 192.168.191.176 -p 6381 -a 123456 -d 3 -q -c 30 -n 10000000 --threads 1 -t get,set,lpush -P 10
Cluster has 3 master nodes:

Master 0: 367152fbf6401b4316a4ae913cb4fb3d57bc7782 192.168.191.70:6385
Master 1: 11ac5cf5004f22a55ee0afa2b221d120ad768f7d 192.168.191.211:6384
Master 2: f5dc23c602b57f6b09b4909d01289ff4d80220ed 192.168.191.70:6386

SET: 251717.97 requests per second, p50=0.887 msec
GET: 299868.06 requests per second, p50=0.767 msec
LPUSH: 263852.22 requests per second, p50=0.911 msec

[root@bf-ltredis-3 ~]# redis-benchmark --cluster -h 192.168.191.176 -p 6381 -a 123456 -d 3 -q -c 60 -n 10000000 --threads 1 -t get,set,lpush -P 10
Cluster has 3 master nodes:

Master 0: 367152fbf6401b4316a4ae913cb4fb3d57bc7782 192.168.191.70:6385
Master 1: 11ac5cf5004f22a55ee0afa2b221d120ad768f7d 192.168.191.211:6384
Master 2: f5dc23c602b57f6b09b4909d01289ff4d80220ed 192.168.191.70:6386

SET: 283857.06 requests per second, p50=1.599 msec
GET: 301677.34 requests per second, p50=1.487 msec
LPUSH: 279259.41 requests per second, p50=1.631 msec

[root@bf-ltredis-3 ~]# redis-benchmark --cluster -h 192.168.191.176 -p 6381 -a 123456 -d 3 -q -c 120 -n 10000000 --threads 1 -t get,set,lpush -P 10
Cluster has 3 master nodes:

Master 0: 367152fbf6401b4316a4ae913cb4fb3d57bc7782 192.168.191.70:6385
Master 1: 11ac5cf5004f22a55ee0afa2b221d120ad768f7d 192.168.191.211:6384
Master 2: f5dc23c602b57f6b09b4909d01289ff4d80220ed 192.168.191.70:6386

SET: 294915.66 requests per second, p50=3.007 msec
GET: 320266.44 requests per second, p50=2.743 msec
LPUSH: 298552.03 requests per second, p50=3.079 msec

[root@bf-ltredis-3 ~]# redis-benchmark --cluster -h 192.168.191.176 -p 6381 -a 123456 -d 3 -q -c 180 -n 10000000 --threads 1 -t get,set,lpush -P 10
Cluster has 3 master nodes:

Master 0: 367152fbf6401b4316a4ae913cb4fb3d57bc7782 192.168.191.70:6385
Master 1: 11ac5cf5004f22a55ee0afa2b221d120ad768f7d 192.168.191.211:6384
Master 2: f5dc23c602b57f6b09b4909d01289ff4d80220ed 192.168.191.70:6386

SET: 310896.94 requests per second, p50=4.359 msec
GET: 320667.00 requests per second, p50=4.079 msec
LPUSH: 299760.19 requests per second, p50=4.663 msec

[root@bf-ltredis-3 ~]# redis-benchmark --cluster -h 192.168.191.176 -p 6381 -a 123456 -d 3 -q -c 300 -n 10000000 --threads 1 -t get,set,lpush -P 10
Cluster has 3 master nodes:

Master 0: 367152fbf6401b4316a4ae913cb4fb3d57bc7782 192.168.191.70:6385
Master 1: 11ac5cf5004f22a55ee0afa2b221d120ad768f7d 192.168.191.211:6384
Master 2: f5dc23c602b57f6b09b4909d01289ff4d80220ed 192.168.191.70:6386

SET: 318369.94 requests per second, p50=7.079 msec
GET: 358204.69 requests per second, p50=5.767 msec
LPUSH: 319335.78 requests per second, p50=7.199 msec

[root@bf-ltredis-3 ~]# redis-benchmark --cluster -h 192.168.191.176 -p 6381 -a 123456 -d 3 -q -c 150 -n 10000000 --threads 4 -t get,set,lpush -P 10
Cluster has 3 master nodes:

Master 0: 367152fbf6401b4316a4ae913cb4fb3d57bc7782 192.168.191.70:6385
Master 1: 11ac5cf5004f22a55ee0afa2b221d120ad768f7d 192.168.191.211:6384
Master 2: f5dc23c602b57f6b09b4909d01289ff4d80220ed 192.168.191.70:6386

SET: 351840.12 requests per second, p50=3.527 msec
GET: 418550.12 requests per second, p50=2.991 msec
LPUSH: 334235.75 requests per second, p50=3.815 msec

【2.3】叢集壓測 結論

例項與監控對應關係
+ 192.168.191.176:6381 =》 192.168.191.176:9121
+ 192.168.191.176:6382 =》 192.168.191.176:9122
+ 192.168.191.211:6383 =》 192.168.191.211:9121
+ 192.168.191.211:6384 =》 192.168.191.211:9122
+ 192.168.191.70:6385 =》 192.168.191.70:9121
+ 192.168.191.70:6386 =》 192.168.191.70:9122
其中 6384/6385/6386 是主庫,主從關係如下:
6384=》6381 , 6385=》6382 , 6386=》6383

  

從上面的圖可以看出,叢集是可以平均分部連線資訊到各個主節點的;
在1000W壓測中,客戶端連線併發超過 120,基本在SET相關操作時,CPU就上 300%了,GET 耗費的 CPU 資源少很多;
我們可以看到 get/set 請求基本平均分散在所有主節點上;

【3】代理壓測

例項與監控對應關係
+ 192.168.191.176:6381 =》 192.168.191.176:9121
+ 192.168.191.176:6382 =》 192.168.191.176:9122
+ 192.168.191.211:6383 =》 192.168.191.211:9121
+ 192.168.191.211:6384 =》 192.168.191.211:9122
+ 192.168.191.70:6385 =》 192.168.191.70:9121
+ 192.168.191.70:6386 =》 192.168.191.70:9122
其中 6384/6385/6386 是主庫,主從關係如下:
6384=》6381 , 6385=》6382 , 6386=》6383

【3.1】壓測

[root@bf-ltredis-2 ~]# redis-benchmark -h 192.168.191.82 -p 7617 -d 3 -q -c 300 -n 10000000 --threads 4 -t get,set,lpush -P 10
ERROR: failed to fetch CONFIG from 192.168.191.82:7617
WARN: could not fetch server CONFIG
SET: 253479.00 requests per second, p50=11.239 msec
GET: 296920.94 requests per second, p50=9.207 msec
LPUSH: 247114.94 requests per second, p50=11.487 msec

[root@bf-ltredis-2 ~]# redis-benchmark -h 192.168.191.82 -p 7617 -d 3 -q -c 300 -n 10000000 --threads 8 -t get,set,lpush -P 100
ERROR: failed to fetch CONFIG from 192.168.191.82:7617
WARN: could not fetch server CONFIG
SET: 313018.44 requests per second, p50=91.903 msec
GET: 863334.19 requests per second, p50=32.335 msec
LPUSH: 259848.23 requests per second, p50=111.487 msec

【3.2】代理壓測 結論

  

CPU始終無法突破 100%,用上多執行緒;
壓測時,我壓測了 get/set/lpop,那麼在get的時候,只會對一個主例項操作,set時也是;