欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

【Kafka】性能測試命令-創(chuàng)新互聯(lián)

提示:一直在用kafka但是對它的性能一直沒有啥認(rèn)識,趁著這次優(yōu)化算法中臺的算法效率問題,梳理一下這塊。

創(chuàng)新互聯(lián)建站長期為上千客戶提供的網(wǎng)站建設(shè)服務(wù),團隊從業(yè)經(jīng)驗10年,關(guān)注不同地域、不同群體,并針對不同對象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺,與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為崇川企業(yè)提供專業(yè)的成都做網(wǎng)站、網(wǎng)站制作、成都外貿(mào)網(wǎng)站建設(shè)崇川網(wǎng)站改版等技術(shù)服務(wù)。擁有十余年豐富建站經(jīng)驗和眾多成功案例,為您定制開發(fā)。 文章目錄
  • 1.硬件資源
  • 2.測試
  • 3.總結(jié)


kafka是個消息中間件,現(xiàn)在我們要搞清楚它的性能,離開硬件資源配置說性能都是xjb整。


1.硬件資源

cpu:8h memery:16G disk:1.5T

cpu 查看資源

cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c #查看cpu型號

8 Intel? Xeon? Gold 5218 CPU @ 2.30GHz

硬盤信息
安裝工具smartmontools

yum -y install smartmontools

查看磁盤型號:smartctl --all /dev/sda
[root@localhost bin]# smartctl --all /dev/sda
smartctl 7.0 2018-12-30 r4883 [x86_64-linux-3.10.0-957.el7.x86_64] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Vendor:               VMware
Product:              Virtual disk
Revision:             2.0
Compliance:           SPC-4
User Capacity:        1,649,267,441,664 bytes [1.64 TB]
Logical block size:   512 bytes
LU is fully provisioned
Rotation Rate:        15000 rpm
Device type:          disk
Local Time is:        Wed Dec 28 19:27:45 2022 CST
SMART support is:     Unavailable - device lacks SMART capability.

=== START OF READ SMART DATA SECTION ===
Current Drive Temperature:     0 C
Drive Trip Temperature:        0 C

Error Counter logging not supported

Device does not support Self Test logging

命令指引看這里:https://blog.51cto.com/u_15127621/4055708

2.測試

測試腳本:
kafka-producer-perf-test --topic test --num-records 100 --record-size 1 --throughput 100 --producer-props bootstrap.servers=localhost:9092

localhost 不好使的話,換成127.0.0.1 或者 實際ip, 和config的配置有關(guān)。

kafka 被運維裝到了這里,里面的shell腳本如下面:

[root@localhost bin]# pwd
/usr/local/kafka/bin

[root@localhost bin]# ls -alh
總用量 464K
drwxr-xr-x. 3 root root 4.0K 10月 27 08:53 .
drwxr-xr-x. 8 root root  117 12月 19 11:04 ..
-rwxr-xr-x. 1 root root 1.4K 9月  14 2021 connect-distributed.sh
-rwxr-xr-x. 1 root root 1.4K 9月  14 2021 connect-mirror-maker.sh
-rwxr-xr-x. 1 root root 1.4K 9月  14 2021 connect-standalone.sh
-rwxr-xr-x. 1 root root  861 9月  14 2021 kafka-acls.sh
-rwxr-xr-x. 1 root root  873 9月  14 2021 kafka-broker-api-versions.sh
-rwxr-xr-x. 1 root root  860 9月  14 2021 kafka-cluster.sh
-rwxr-xr-x. 1 root root  864 9月  14 2021 kafka-configs.sh
-rwxr-xr-x. 1 root root  945 9月  14 2021 kafka-console-consumer.sh
-rwxr-xr-x. 1 root root  944 9月  14 2021 kafka-console-producer.sh
-rwxr-xr-x. 1 root root  871 9月  14 2021 kafka-consumer-groups.sh
-rwxr-xr-x. 1 root root  948 9月  14 2021 kafka-consumer-perf-test.sh
-rwxr-xr-x. 1 root root  871 9月  14 2021 kafka-delegation-tokens.sh
-rwxr-xr-x. 1 root root  869 9月  14 2021 kafka-delete-records.sh
-rwxr-xr-x. 1 root root  866 9月  14 2021 kafka-dump-log.sh
-rwxr-xr-x. 1 root root  863 9月  14 2021 kafka-features.sh
-rwxr-xr-x. 1 root root  870 9月  14 2021 kafka-leader-election.sh
-rwxr-xr-x. 1 root root  863 9月  14 2021 kafka-log-dirs.sh
-rwxr-xr-x. 1 root root  873 9月  14 2021 kafka-metadata-shell.sh
-rwxr-xr-x. 1 root root  862 9月  14 2021 kafka-mirror-maker.sh
-rwxr-xr-x. 1 root root  886 9月  14 2021 kafka-preferred-replica-election.sh
-rwxr-xr-x. 1 root root  959 9月  14 2021 kafka-producer-perf-test.sh
-rwxr-xr-x. 1 root root  874 9月  14 2021 kafka-reassign-partitions.sh
-rwxr-xr-x. 1 root root  874 9月  14 2021 kafka-replica-verification.sh
-rwxr-xr-x. 1 root root  11K 9月  14 2021 kafka-run-class.sh
-rwxr-xr-x. 1 root root 1.4K 9月  14 2021 kafka-server-start.sh
-rwxr-xr-x. 1 root root 1.4K 9月  14 2021 kafka-server-stop.sh
-rwxr-xr-x. 1 root root  860 9月  14 2021 kafka-storage.sh
-rwxr-xr-x. 1 root root  945 9月  14 2021 kafka-streams-application-reset.sh
-rwxr-xr-x. 1 root root  863 9月  14 2021 kafka-topics.sh
-rwxr-xr-x. 1 root root  958 9月  14 2021 kafka-verifiable-consumer.sh
-rwxr-xr-x. 1 root root  958 9月  14 2021 kafka-verifiable-producer.sh
-rw-------. 1 root root 304K 12月 28 18:56 nohup.out
-rwxr-xr-x. 1 root root 1.7K 9月  14 2021 trogdor.sh
drwxr-xr-x. 2 root root 4.0K 9月  14 2021 windows
-rwxr-xr-x. 1 root root  867 9月  14 2021 zookeeper-security-migration.sh
-rwxr-xr-x. 1 root root 1.4K 9月  14 2021 zookeeper-server-start.sh
-rwxr-xr-x. 1 root root 1.4K 9月  14 2021 zookeeper-server-stop.sh
-rwxr-xr-x. 1 root root 1019 9月  14 2021 zookeeper-shell.sh

測試命令 sh kafka-producer-perf-test.sh --topic test1 --num-records 100 --record-size 1 --throughput 100 --producer-props bootstrap.servers=10.10.90.210:9092

[root@localhost bin]# sh kafka-producer-perf-test.sh --topic test1 --num-records 100 --record-size 1 --throughput 100 --producer-props bootstrap.servers=10.10.90.210:9092
100 records sent, 99.601594 records/sec (0.00 MB/sec), 8.77 ms avg latency, 341.00 ms max latency, 1 ms 50th, 14 ms 95th, 341 ms 99th, 341 ms 99.9th.

num-records,消息數(shù)量
record-size,單條消息的大小,單位為字節(jié)
throughput,多少秒一條消息,-1為沒有間歇

[root@localhost bin]# sh kafka-producer-perf-test.sh --topic test1 --num-records 100 --record-size 1 --throughput -1 --producer-props bootstrap.servers=10.10.90.210:9092
100 records sent, 267.379679 records/sec (0.00 MB/sec), 18.74 ms avg latency, 367.00 ms max latency, 15 ms 50th, 18 ms 95th, 367 ms 99th, 367 ms 99.9th.

可以看到單點kafka, 消息沒有間歇的前提下 1kb 一條數(shù)據(jù),可以發(fā) 267條/秒

[root@localhost bin]# sh kafka-producer-perf-test.sh --topic test1 --num-records 100 --record-size 1 --throughput 100 --producer-props bootstrap.servers=10.10.90.210:9092
100 records sent, 99.601594 records/sec (0.00 MB/sec), 8.77 ms avg latency, 341.00 ms max latency, 1 ms 50th, 14 ms 95th, 341 ms 99th, 341 ms 99.9th.
[root@localhost bin]# sh kafka-producer-perf-test.sh --topic test1 --num-records 100 --record-size 1 --throughput -1 --producer-props bootstrap.servers=10.10.90.210:9092
100 records sent, 267.379679 records/sec (0.00 MB/sec), 18.74 ms avg latency, 367.00 ms max latency, 15 ms 50th, 18 ms 95th, 367 ms 99th, 367 ms 99.9th.
[root@localhost bin]# sh kafka-producer-perf-test.sh --topic test1 --num-records 100 --record-size 10 --throughput -1 --producer-props bootstrap.servers=10.10.90.210:9092
100 records sent, 280.112045 records/sec (0.00 MB/sec), 15.42 ms avg latency, 349.00 ms max latency, 12 ms 50th, 14 ms 95th, 349 ms 99th, 349 ms 99.9th.
[root@localhost bin]# sh kafka-producer-perf-test.sh --topic test1 --num-records 100 --record-size 10 --throughput -1 --producer-props bootstrap.servers=10.10.90.210:9092
100 records sent, 267.379679 records/sec (0.00 MB/sec), 16.51 ms avg latency, 367.00 ms max latency, 13 ms 50th, 15 ms 95th, 367 ms 99th, 367 ms 99.9th.
[root@localhost bin]# sh kafka-producer-perf-test.sh --topic test1 --num-records 100 --record-size 10 --throughput -1 --producer-props bootstrap.servers=10.10.90.210:9092
100 records sent, 285.714286 records/sec (0.00 MB/sec), 17.30 ms avg latency, 344.00 ms max latency, 14 ms 50th, 16 ms 95th, 344 ms 99th, 344 ms 99.9th.
[root@localhost bin]# sh kafka-producer-perf-test.sh --topic test1 --num-records 100 --record-size 100 --throughput -1 --producer-props bootstrap.servers=10.10.90.210:9092
100 records sent, 275.482094 records/sec (0.03 MB/sec), 16.33 ms avg latency, 356.00 ms max latency, 13 ms 50th, 15 ms 95th, 356 ms 99th, 356 ms 99.9th.
[root@localhost bin]# sh kafka-producer-perf-test.sh --topic test1 --num-records 100 --record-size 100 --throughput -1 --producer-props bootstrap.servers=10.10.90.210:9092
100 records sent, 264.550265 records/sec (0.03 MB/sec), 15.85 ms avg latency, 371.00 ms max latency, 12 ms 50th, 14 ms 95th, 371 ms 99th, 371 ms 99.9th.
[root@localhost bin]# sh kafka-producer-perf-test.sh --topic test1 --num-records 100 --record-size 1000 --throughput -1 --producer-props bootstrap.servers=10.10.90.210:9092
100 records sent, 268.096515 records/sec (0.26 MB/sec), 20.13 ms avg latency, 360.00 ms max latency, 17 ms 50th, 18 ms 95th, 360 ms 99th, 360 ms 99.9th.
[root@localhost bin]# sh kafka-producer-perf-test.sh --topic test1 --num-records 100 --record-size 10000 --throughput -1 --producer-props bootstrap.servers=10.10.90.210:9092
100 records sent, 246.305419 records/sec (2.35 MB/sec), 45.08 ms avg latency, 344.00 ms max latency, 44 ms 50th, 60 ms 95th, 344 ms 99th, 344 ms 99.9th.
[root@localhost bin]# sh kafka-producer-perf-test.sh --topic test1 --num-records 100 --record-size 100000 --throughput -1 --producer-props bootstrap.servers=10.10.90.210:9092
100 records sent, 229.885057 records/sec (21.92 MB/sec), 60.76 ms avg latency, 353.00 ms max latency, 58 ms 50th, 79 ms 95th, 353 ms 99th, 353 ms 99.9th.
[root@localhost bin]# sh kafka-producer-perf-test.sh --topic test1 --num-records 100 --record-size 1000000 --throughput -1 --producer-props bootstrap.servers=10.10.90.210:9092
100 records sent, 138.121547 records/sec (131.72 MB/sec), 115.93 ms avg latency, 353.00 ms max latency, 122 ms 50th, 137 ms 95th, 353 ms 99th, 353 ms 99.9th.
[root@localhost bin]# sh kafka-producer-perf-test.sh --topic test1 --num-records 100 --record-size 1000000 --throughput -1 --producer-props bootstrap.servers=10.10.90.210:9092
100 records sent, 142.857143 records/sec (136.24 MB/sec), 105.84 ms avg latency, 339.00 ms max latency, 121 ms 50th, 141 ms 95th, 339 ms 99th, 339 ms 99.9th.

從以上腳本可以看出,僅僅是修改了 record-size,也就是消息體的大小,當(dāng)1,10,100,1000,10000kb的時候,都是250records/s 以上,max latency延時則從10毫秒到了幾十毫秒。
當(dāng)增加到100000kb (100MB),1000000kb(1G)的時候,顯著下降為100+records/s 延時也增加到100毫秒以上,但正常情況下也沒有人會發(fā)100MB,或者 1G每條消息的數(shù)據(jù)吧。

2018年我在搞直播系統(tǒng)的時候,當(dāng)時的答題回傳答案用的kafka,那時候看的二手技術(shù)博客說單條消息大于10kb的時候,kafka性能會顯著下降,現(xiàn)在看不是那么回事。眼見為實,到底咋樣,拉出來溜溜!

3.總結(jié)

單體kafka, 8h 16G 的服務(wù)器,1kb每條消息, kafka的承載量是接近300條消息/s,延時在10毫秒,
隨之,單體消息的數(shù)據(jù)量增加,延時在增加,但1kb----10MB的數(shù)據(jù),消息承載量沒有顯著下降從280–240,平均延時延時從10毫秒到50毫秒

你是否還在尋找穩(wěn)定的海外服務(wù)器提供商?創(chuàng)新互聯(lián)www.cdcxhl.cn海外機房具備T級流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確流量調(diào)度確保服務(wù)器高可用性,企業(yè)級服務(wù)器適合批量采購,新人活動首月15元起,快前往官網(wǎng)查看詳情吧

新聞名稱:【Kafka】性能測試命令-創(chuàng)新互聯(lián)
文章分享:http://www.chinadenli.net/article22/dcdjcc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供虛擬主機網(wǎng)站改版靜態(tài)網(wǎng)站網(wǎng)站導(dǎo)航微信公眾號網(wǎng)站設(shè)計公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站建設(shè)