Logo

dev-resources.site

for different kinds of informations.

Unlocking Cosmos DB Potential: Testing API Performance with JMeter!!

Published at
8/3/2023
Categories
jmeter
cosmosdb
performance
luxoft
Author
ujwalabothe
Author
11 person written this
ujwalabothe
open
Unlocking Cosmos DB Potential: Testing API Performance with JMeter!!

Jmeter #CosmosDatabase #PeroformanceTesting #databasetesting #Luxoft #Poland

Working with Luxoft for over a year, I have gained invaluable experience in my 11+ years of overall professional journey. The culture of knowledge sharing at Luxoft not only fosters continuous learning but also plays a vital role in our collective success.
In today’s fast-paced software development industry, ensuring the optimal performance of your product is paramount. However, as the sole tester on your project or even within the entire company, selecting the right performance testing tool can feel overwhelming. With a vast array of options available, making an informed choice is crucial. This article aims to demystify the process by exploring Apache JMeter — an exceptionally powerful and user-friendly tool for performance testing. I will provide a step-by-step guide to help you become familiar with JMeter and successfully execute your first performance test.
I have had the opportunity to work extensively on performance projects using Jmeter.
Though jmeter is very popular among us but still we don't have lot of documentation for cosmos database so here I’m sharing my experience of Jmeter with cosmos which I have recently used in my project .

Azure Cosmos DB is a globally distributed, multi-model database service offered by Microsoft Azure. It is designed to provide high availability, scalability, and low-latency access to data for mission-critical applications.

Apache JMeter™ can also perform load testing against Azure Cosmos DB (SQL API).

Azure Cosmos DB (SQL API) is operated by the REST API.
So, it will be tested using the HTTP request sampler in Apache JMeter™.

For the request to be successful, it must be made with the appropriate method, header, and body.

Outline of steps

  1. Install jmeter
  2. Install the plugin for Microsoft Azure.
  3. Cosmos database set up configuration.
  4. Add a Thread Group.
  5. HTTP Header Manager .
  6. User Parameters.
  7. JSON Extractor.
  8. Extract the test data in CSV format.
  9. Save the Response.
  10. Run the test plan and check the result
  11. Detailed steps with real-time examples :

Step 1: Download and Install JMeter

Download the latest stable version of JMeter from (https://jmeter.apache.org/).

Step 2 : Install Azure CosmosDB Plugin

To enable the connectivity download “Azure backend listerner” plugin from JMeter Plugins website (https://jmeter-plugins.org/) or you can use the JMeter Plugins Manager to install it.

Place it in lib/ext directory of your JMeter installation. Next restart JMeter to load the plugin.

Image description

Step 3: Cosmos database set up configuration

You can get all the below details from the cosmos database, go to the database and check the cosmos database properties.

Add > Config Element > User Defined Variables

cosmosdbHost: Hostname of Cosmos DB (***.documents.azure.com)
cosmosdbKey: Key of Cosmos DB
You can use either the primary or secondary key.
headers.x-ms-version: Version of Cosmos database

Image description

Step 4: Add a Thread Group

Add>Threads(Users)> SetUp Thread Group

This will be set up once and can be used many times throughout the test plan. Eg data extracted/saved from this script can be used in various thread groups.

Protocol : https/http ,ServerName or IP : you can directly provide here e.g test.com or you can define a variable and use it here e.g ${cosmosdbHost},

Method : POST ( small correction in SS :( )and Path .

Note : all these varibles are defined in

Image description

Image description

Step 5: HTTP Header Manager

Configure the parmaters (x-ms-version, authorizaton and other parameters) as per below screenshot .

Image description
Image description

Step 6: User Parameters

Image description

Image description

Step 7 : JSON Extractor

Here I have given two examples but you can extract as many as you want. Also you can change the JSON expression ( may be we can cover JSON expression in next article )

Image description

Image description

Step 8 : Extract the test data in csv format.

Image description

Image description

Image description

Step 9: Save the Response:

Save the response in txt or json format . You can also define a reference varible for response file name in the variable section and use a variable here eg ${responseFilePath}

Go to Http request >> Add>Listener> Save Response to a file and provide a file name and location else it will be saved in Jmeter bin folder ( default location )

Image description

Image description

Step 10 : Run the test plan and check the result

Testing Azure Cosmos DB with Apache JMeter provides valuable insights into the performance and reliability of your database deployments. By following the basic steps outlined in this article, you can establish a strong foundation for testing and ensuring optimal performance of your Cosmos DB applications. Harness the power of JMeter to validate the behavior of your Cosmos DB and deliver robust and scalable solutions.

Stay tuned for the next article where I will cover JSON extractor in detail :)

jmeter Article's
30 articles in total
Favicon
Performance Testing of a medical staffing services web application using JMeter
Favicon
Distributed Load Testing with JMeter in Testkube
Favicon
JMeter vs LoadRunner — Which Tool is Right for You?
Favicon
10 Best Functional Testing Tools for 2024
Favicon
7 Best JMeter Alternative
Favicon
Azure DevOps | Running JMeter Test Collection using JMeter Docker Image
Favicon
peviitor.ro are si locurile de munca de pe ANOFM
Favicon
Stress Testing Your Rails Application Using JMeter
Favicon
JMeter-Dynamic Load Testing of Restful APIs
Favicon
Install JMeter on Mac (Apple Silicon M1,M2,M3... processor)
Favicon
How to optimise JMeter for performance tests
Favicon
Jmeter 테스트
Favicon
Exploring JMeter: A Simple Guide to Its Basic Components
Favicon
Controllers in JMeter!!
Favicon
Mastering JSON Extraction in Apache JMeter for Effective API Testing
Favicon
Unlocking Cosmos DB Potential: Testing API Performance with JMeter!!
Favicon
Guide to Handling Variables in JMeter
Favicon
Hashing Passwords using the md5() Method in Groovy and Using it as a Parameter in JMeter
Favicon
How to use CSV file for parameterization in JMeter
Favicon
Installing Apache JMeter using Homebrew
Favicon
Thread Group in Jmeter: Understanding its Components and Use Cases
Favicon
Loadtest Websocket Server
Favicon
Automatizando a criação de requisições no JMeter utilizando Postman
Favicon
Benefits of using JMeter for Performance Testing
Favicon
Discover issues with performance testing
Favicon
How fix Jmeter on a Mac ? Could not initialize class org.apache.jmeter.gui.util.FileDialoger
Favicon
Jmeter:- How to Send multiple request concurrently/Sequentially in "Jmeter" with different set of values for each request?
Favicon
JMeter Interview Questions
Favicon
Deploy JMeter on AWS using Terraform
Favicon
JMeter 5.4.1 fix for Security CVE-2021-44228 issue

Featured ones: