Page 2 of 59

Gatling the Beginning

We are living in the world of technologies, it changes the way we work, the way we look at the things. We search queries in google, do shopping online, share a moment in Facebook, chat with our childhood friends irrespective of where they live. Everyone likes if the tasks are simplified or automated by online solutions and gives more sophistication on our needs. Hence it is more important to design the web application by considering the performance factors such as concurrency, response time, fault tolerance, scalability. Though there are so many load testing tools available in the market, Jmeter and Gatling are considered as widely used tools. These two tools are open source and offers support for protocol testing.

We had seen already about Jmeter and how it helps QA to identify performance bottlenecks without worrying much on coding part  as Jmeter offers built-in components like Logical controllers, Samplers for protocols like http,ftp,Soap,Jms etc…, listeners for reports, Config elements like CSVDatasetConfig for customizing user data, Pre-Processors , Post-Processors such as Regex-Extractor, JMXMon for Monitoring the heap parameters of the Web application. I like Jmeter so much and used it for longer period. It servers the purpose of finding the performance bottleneck. Just for a change I would really like to try Gatling and hereafter i will post more about my gatling experience.

Introduction on Gatling
Gatling is developed and maintained by Stephene Landelle. Gatling is well known for its speed and performance as it is built on AKKA Engine, scala language based. Gayling works on asynchronous model. Gatling does not lock the thread at the jvm level, so there is no one user per thread concept. After thread completes it tasks , it will be released and takes the next task. Currently Gatling supports more on HTTP protocol , also they support JMS protocol.

Download Gatling from the following location, Latest version is Gatling 2.1.7
http://gatling.io/#/download

When you open Gatling you can see the following folders

bin
It has gatling recorder and gatling to run simulations for both windows and linux

conf
Gatling configuration files are placed here

lib
lib folder has Gatling Jar files , Scala libararies, netty libraries

results
results folder basically consists of simulation results, html files

target
where simulation class files can be found

user-files
user files are placed under data folder of this user-files directory.
simulation files are inside /user-files/simulation folder.

Load Testing Apache kafka using Kafkameter

You can refer overview of Kafka here . For Installation and configuring Kafka , refer the previous post : Configuring Apache Kafka

Step 1

Go to Githup and download kafkameter
https://github.com/BrightTag/kafkameter

Step 2

Follow the Steps for building the kafkameter.jar

Step 3

Place the generated jar in $JMETER_HOME/lib/ext folder

Step 4

Restart jmeter

Step 5

Add Threadgroup->Samplers-> Javarequest

Step 6

Configure Input parameters, like hostname , kafka topic that you created already

Step 7

Run Jmeter test and verify the same message is consumed by Kafka consumer.

Refer the below screenshots

 

 

Kafka Parameters

 

Sending message to Kafka Consumer

 

Message Consumed

Configuring Apache Kafka Environment

Kafka is used widely in social networking websites because of its performance. Refer Kafka introduction for more information.  Here i’m going to show how to setup Kafka in simple 8 steps.

Step 1

Download Kafka from Apache Website:
https://www.apache.org/dyn/closer.cgi?path=/kafka/0.8.2.2/kafka_2.9.1-0.8.2.2.tgz

Step 2

Untar downloaded archive.

Step 3

cd kafka_2.9.2-0.8.2.2

Step 4

Start zookeeper which is used for Synchronizing producers and consumers.
bin/zookeeper-server-start.sh config/zookeeper.properties

Step 5

start Kafka Server
bin/kafka-server-start.sh config/server.properties

Step 6

Create topics for Kafka producer and consumer
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic kafkatopic2

Step 7

Start kafka Producer and type some messages
bin/kafka-console-producer.sh --broker-list localhost:9092 --sync --topic kafkatopic2

Step 8

Start Kafka Consumer and observe that the messages you typed in #Step 7 , getting consumed.
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic kafkatopic2 --from-beginning

So you have successfully setup the kafka . We will try to add more consumers and producers in next post.

 

© 2017 My techbook

Theme by Anders NorénUp ↑