kafka stress test

 

table of Contents

1 , and environmental testing purposes 1

2 , Test Scope and Method 2

2.1 , the range of the test described 2

2.2 , the performance test scenarios designed 2

2.2.1 , Kafka message producer Stress Test 2

2.2.2 , Kafka used to live consumer news Stress Test 2

2.3 , a brief description of the test method 2

2.3.1 Test purpose 2

2.3.2 Test Method 2

3 , the test results 4

3.1 , the test results show that 4

3.2 , the test results 4

3.2.1 write MQ message 4

3.2.2 consumer MQ messaging 5

4 , the results of the analysis (from writing) 6

5 , optimizing the environment with 7

 

 

1 , and environmental testing purposes

For kafka producers and consumers of the message processing performance of stress tests, based on 10W , 50W , 100W , 500W analyze the results of message processing level, assessment kafka of whether the performance indicators.

103.249.52.4:10027

Hardware: a few core a few G operating environment windows

 

2 , test range and method

2.1 Test Range Description

By the command kafka initiate the production and consumption of news messages, assessed according to the processing results kafka meets the needs treatment projects.

2.2 , performance testing scenario design

2.2.1 , Kafka used to live producer stress test news

testing scenarios

The number of news

Write the number of messages per second

Each record size

 

kafka messages written test

10W

2000 Tiao

1000

50W

5000 Tiao

1000

100W

5000 Tiao

1000

500W

5000 Tiao

1000

2.2.2 , Kafka used to live consumer news Stress Test

testing scenarios

The number of messages consumers

 

kafka news consumption test

10W

50W

100W

500W

2.3 Brief description of the test method

2.3.1 Test purpose

Verify kafka ability to produce and consume messages messages.

2.3.2 Test Method

Use on the server kafka own test scripts, simulate 10W , 50W , 100W , 500W of the write request message, view kafka treatment capacity to handle different number of stages of the message, the second message including the production, throughput, message delay. The main view kafka combing ability of different magnitude messages.

stress test command

testing scenarios

Pressure measurement message number

 

 

Write a message

 

10W

./kafka-producer-perf-test.sh --topic test_perf --num-records 100000 --record-size 1000  --throughput 2000 --producer-props bootstrap.servers=localhost:9092

 

50W

./kafka-producer-perf-test.sh --topic test_perf --num-records 500000 --record-size 2000  --throughput 5000 --producer-props bootstrap.servers=localhost:9092

 

100W

./kafka-producer-perf-test.sh --topic test_perf --num-records 1000000 --record-size 2000  --throughput 5000 --producer-props bootstrap.servers=localhost:9092

 

500W

./kafka-producer-perf-test.sh --topic test_perf --num-records 5000000 --record-size 2000  --throughput 5000 --producer-props bootstrap.servers=localhost:9092

 

Consumer news

 

10W

./kafka-consumer-perf-test.sh --zookeeper localhost:2181 --topic test_perf --fetch-size 1048576 --messages 100000 --threads 1

 

50W

./kafka-consumer-perf-test.sh --zookeeper localhost:2181 --topic test_perf --fetch-size 1048576 --messages 500000 --threads 1

 

100W

./kafka-consumer-perf-test.sh --zookeeper localhost:2181 --topic test_perf --fetch-size 1048576 --messages 1000000 --threads 1

 

500W

./kafka-consumer-perf-test.sh --zookeeper localhost:2181 --topic test_perf --fetch-size 1048576 --messages 5000000 --threads 1

 

3、测试结果

3.1、测试结果说明

对单机kafka服务器进行压力测试,关注kafka消息写入的延迟时间是否满足要求,验证kafka消息的处理能力

3.2、测试结果

3.2.1、写入MQ消息

测试项

生产消息总数(单位:W

设置单个消息大小(单位字节)

设置每秒发送信息数

实际写入的消息数(秒)

%95的消息延迟(毫秒)

写入MQ消息

10

1000

2000

 

 

50

1000

5000

 

 

100

1000

5000

 

 

500

1000

5000

 

 

 

压力测试结果截图

1、写入10W消息压测

 

2、写入50W消息压测

 

3、写入100W消息压测

 

4、写入500W消息压测

 

l kafka-producer-perf-test.sh 脚本命令的参数解析

(以100w写入消息为例)

--topic topic

主题,本例为test_perf

--num-records

总共发送的消息数,本例为1000000

--record-size

每个记录的字节数,本例为1000

--throughput

每秒发送的记录数,本例为5000

--producer-props bootstrap.servers=localhost:9092   kafka服务

MQ消息写入测试结果解析:

本例中写入100wMQ消息为例,每秒平均向kafka写入了4.77MB的数据,大概是4999.875条消息/秒,每次写入的平均延迟为1毫秒,最大的延迟为647毫秒,1ms内占99%

3.2.2消费MQ消息

测试项

消费消息总数(单位:W

共消费数据(单位:M

每秒消费数据(单位:M

每秒消费的消息数

消费所消耗的时间(秒)

消费MQ消息

10

 

 

 

 

50

 

 

 

 

100

 

 

 

 

500

 

 

 

 

压力测试结果截图

1、消耗10W消息压测

 

2、消耗50W消息压测

 

3、消耗100W消息压测

 

4、消耗500W消息压测

 

l kafka-consumer-perf-test.sh 脚本命令的参数为:

(以100w写入消息为例):

--zookeeper

指定zookeeper的链接信息,本例为localhost:2181

--topic

主题,本例为test_perf,即4.2.1中写入的消息

--fetch-size

指定每次取的数据的大小,本例为1048576,也就是1M

--messages

总共要消费的消息个数,本例为1000000100w

以本例中消费100wMQ消息为例总共消费了953.66M的数据,每秒消费数据大小为177.19M,总共消费了10000004条消息,每秒消费185804.53条消息。

 

4、结果分析(自写)

根据4.2.测试结果,可以看出在单台服务器上,写入MQ消息设置5000/秒时,消息写入及时,95%的消息延迟时间小于等于1ms,在可接受范围内;Kafka消费MQ消息时,1000W待处理消息的处理能力在每秒20w条以上,处理结果理想。

   根据Kafka处理10w100w1000w级的消息时的处理能力,可以评估出Kafka集群服务,是否有能力处理上亿级别的消息。

本次测试是在正式环境集群服务中的单台服务器上进行,基本不需要考虑网络带宽的影响。所以单台服务器的测试结果,对评估集群服务是否满足上线后实际应用的需求,很有参考价值。

 

5、环境配合优化

Guess you like

Origin www.cnblogs.com/charon2/p/11349850.html
Recommended