In the Internet enterprise technology architecture ,MQ It's getting more and more important . system decoupling 、 asynchronous communication 、 Peak shaving and valley filling 、 Data order guarantee and so on , You can see... Everywhere MQ The figure of .
And the test engineer at work , And often need to talk to mq Dealing with , For example, constructing test data , Trigger some business scenarios , And aiming at mq Performance test, etc .
At present, it is well-known in the industry mq The products are kafka、rabbitmq、rocketmq etc. . Today I'm going to talk about how to use Jmeter Come to rocketmq Send a message , Realize to mq Performance test of sending message function .
Let's start with a brief introduction Rocketmq
RocketMQ It's a distributed 、 Message middleware of queue model , It is a professional message middleware independently developed by Alibaba group , After many times of tmall double 11 massive news test . It has been donated to Apache The foundation , And in 2016 year 11 Month be Apache Incubation projects .
1、MQ Basic concepts
Message: news , The carrier of information transmission in message queue
Topic: Message topic , First level message type , adopt Topic Categorize messages
Tag: Message tags , Secondary message type , Used to further differentiate a Topic Next message classification
Producer: Message producer , Also known as the publisher of the message , Responsible for producing and sending messages
Consumer： Message consumer , Also known as a message subscriber , Responsible for receiving and consuming messages
2、RocketMQ Of 4 A component
Namely nameserver、broker、producer and consumer
Broker: The core module of cluster , Mainly responsible for Topic Message store 、 Consumer's consumption point management （ Consumption progress ）Producer: Message producer , Every producer has one ID( Number )
nameserver: Store all of the current cluster Brokers Information 、Topic Follow Broker Correspondence of
Consumer: Message consumer , Each subscriber also has one ID( Number )
3、MQ Messaging model
After understanding the above concepts , Let's write Jmeter Script .
stay idea Create a Java engineering , And introduce Rocketmq and Jmeter The dependency package of , Let's write one demo Script .Rocketmq The message sending code is very simple , Just a few lines of code , The code is as follows ：
Run script , You can see the printed results “SEND_OK” word , Indicates that the message was sent successfully .
Log in to rocketmq Console page , You can search for the message you just sent .
up to now , The test script has been debugged , Just convert the script to Jmeter The script can be . It can be divided into the following steps ：
1、 Create a test class , Realization Jmeter Of JavaSamplerClient Interface , Need to implement... In the interface 4 A way , Respectively ：
setupTest： Script initialization operation , Each thread executes when it starts , And only once
runTest：Jmeter Thread loop execution method
teardownTest：Jmeter The ending method , Execute at the end of each thread , And only once
getDefaultParameters： Need to be exposed to Jmeter Parameters in the interface , For the time being, we do not need
According to the characteristics of the four methods , The corresponding mq Code operations in different ways , Detailed explanation can be seen in the comment code as follows ：
2、 take Java Scripts and their dependent packages are exported as jar package , Then put jmeter Of lib/ext Under the table of contents
3、 open Jmeter, newly build “Java request ”, Select the script class you just wrote
That's it , One is based on Jmeter Sending of MQ The message script is done , If you want to do a pressure test , stay Jmeter Configure the number of threads and duration to start the pressure measurement .
- RocketMQ message sending system busy、broker busy Cause analysis and solutions
Catalog 1. The phenomenon 2. Principle interpretation 2.1 RocketMQ Overview of network processing mechanism 2.2 pair.getObject1().rejectRequest() 2.3 A talk transientStorePoolE ...
- RocketMQ Nine ：RocketMQ Message sending process interpretation
Before we discuss the problem , Let's take a look first Client The overall structure of . Producer And Consumer Class system The following points can be seen from the figure below :(1)Producer And Consumer The common logic of , Packaged in MQClientI ...
- RocketMQ message sending
Basic process of message sending : 1. Message validation Verify the theme (topic), Message body cannot be empty and size cannot exceed 4M. 2. Route lookup a. View cache , Is there a topic Routing information for . b. If not, go to NameServer Get what you want ...
- RocketMQ Queue selection and fault tolerance strategy for message sending
One topic There are multiple queues , Scattered in different broker.producer When sending a message , You need to select a queue producer Send message global sequence diagram : Queue selection and fault tolerance strategy conclusion : Without fault tolerance on , Polling queue into ...
- RocketMQ Message sending process and high availability design
( Read the source code first look at the main line Look at the spur line So far We'll break it down later ) The design of high availability is : When producer Send a message to broker On ,broker But it's down , How to avoid sending to this next time broker On , Is to adopt La ...
- RocketMQ( 8、 ... and )： message sending
Zero ingenuity Reprint please indicate the original source , thank you ! RocketMQ Network deployment diagram NameServer: In the system, it's a naming service , Update and discover broker service . Broker-Master:broker Message host server . ...
- RocketMQ Message sending and consumption of
RocketMQ Message supported patterns : There are three patterns of message support :NormalProducer( Normal synchronization ), Messages are sent asynchronously ,OneWay. Message synchronization : The sending and receiving of ordinary messages have been demonstrated earlier , In the previous case ...
- Program restart RocketMQ Message re consumption
Recently debugging RocketMQ Message sending and consumption Demo when , Find a problem : Just restart the program ,RocketMQ News will be consumed repeatedly . So what's the reason for this , How to solve it ? After some investigation , Find out what the program uses Rocket ...
- Kafka、RabbitMQ、RocketMQ Comparison of message middleware —— Message sending performance - From Alibaba middleware
introduction Distributed system , We widely use message middleware to exchange data between systems , Easy to decouple asynchronously . Now there are many open source message middleware , Some time ago, our own products RocketMQ (MetaQ The kernel of ) Open source also smoothly , Get everyone's attention . ...
- turn Kafka、RabbitMQ、RocketMQ Comparison of Message Oriented Middleware —— Messaging performance and benefits
Kafka.RabbitMQ.RocketMQ Comparison of Message Oriented Middleware —— Messaging performance and benefits introduction Distributed system , We widely use message middleware to exchange data between systems , Easy to decouple asynchronously . Now there are many open source message middleware , front ...
- git The command operation
git add . : Submit all modified working documents to staging area git commit -am 'new' : Record the modified documents git push origin dev : Push the project to dev Divided ...
- 【MyEcplise SVN】myEcplise Installation on SVN In many ways
The first one is :SVN Online installation of 1. open MyEclipse, Find the top menu bar Help( help )-Install from Site-( Install from the website ), Here's the picture 2. then : Click on Install from Site ...
- js Of variables using <bean><list:write> It is necessary to add ' '
script Of variables using <bean><list:write> It is necessary to add ' ', Such as :var code ='<bean:write name="target" ...
- performance tuning ： understand Set Statistics Time Output
In performance tuning : understand Set Statistics IO We discussed Set Statistics IO, And how to help us with performance tuning . This article will discuss Set Statistics Time, It will tell us ...
- PL/SQL Lecture notes
PL/SQL: Knowledge review : SQL: Structured query language : T-SQL: microsoft sql Language : PL/SQL: Oracle sql Language : Variable naming rule : 1. The initials have to be letters , Can contain words ...
- PL/SQL Developer Remote connection Oracle database
First, turn on the computer , To pl/sql The specified directory of the installation [D:\app\DZL\product\11.2.0\dbhome_1\NETWORK\ADMIN] find [tnsnames.ora] open [tnsna ...
- Caffe : Layer Catalogue(2)
TanH / Hyperbolic Tangent type (type):TanH CPU Realization : ./src/caffe/layers/tanh_layer.cpp CUDA.GPU Realization : ./src/ ...
- install solaris_11.2 And windows Dual system （VM10 Simulation Implementation ）（ One ）
Sigh with emotion : Just this week solaris, loading solaris It hurts , One word : slow ! It's still slow to install packages on it , Wireless networks are also very unstable . It's more painful to build an environment on it , One word : Miserable ! I don't want to talk about the environment , Ordinary computers can . ...
- jsp base route
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"% ...
- Python beginner introduction We should learn python 2 still python 3？
Many just started Python The problem that all my friends are struggling with is : I should choose to study python2 still python3? Regarding this , Dr. Mi's answer is : decisive Python3 ! But , There are still many white friends who are still hesitating : Then why is it still ...