bbc/mongodb-load-tests

Name: mongodb-load-tests

Owner: BBC

Description: Locust load tests written in Java for MongoDB

Created: 2018-03-01 14:07:38.0

Updated: 2018-05-24 14:19:51.0

Pushed: 2018-05-24 14:19:48.0

Homepage:

Size: 662

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

mongodb-load-tests

MongoDB

I've installed MongoDB and created a database named test and a collection called zips.

This is the zips data file.

Locust
Site

Locust

Install
p install locustio 
Locust4j

Locust4j allows the developer to code Locust tests in a JVM language. This may obviate the concurrency and measurement accurancy issues as outlined in this article.

endency>
<groupId>com.github.myzhan</groupId>
<artifactId>locust4j</artifactId>
<version>1.0.1</version>
pendency>
MongoDB Java Driver

The official MongoDB Java Driver

endency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>3.6.3</version>
pendency>
Timings

I wrapped the MongoDB insert in a timer, but it might be also worth using the MongoDB profiler.

Master

Run the Locust Master from this project root, in order for the slaves to send the metrics to.

cust -f locust-master.py --master --master-bind-host=127.0.0.1 --master-bind-port=5557
Slave
n clean compile assembly:single
va -cp target/mongodb-load-tests-1.0-SNAPSHOT-jar-with-dependencies.jar co.uk.bbc.Main 
UI
en http://localhost:8089/

Set the number of users and hatch rate. Charts can be viewed through a tab.

Test

In the MongoDB shell:

.zips.find({"city": "BABYLON"}).count()
InfluxDB
Install
macOS
ew update
ew install influxdb
Fedora
et https://dl.influxdata.com/influxdb/releases/influxdb-1.5.2.x86_64.rpm
do yum localinstall influxdb-1.5.2.x86_64.rpm
Run
fluxd -config /usr/local/etc/influxdb.conf
Create Database
rl -i -XPOST http://localhost:8086/query --data-urlencode "q=CREATE DATABASE mongodb"
Test Write
rl -i -XPOST 'http://localhost:8086/write?db=mongodb' --data-binary 'locust,name=urlBash requests=314457,failures=0,median_response_time=1,min_response_time=0,max_response_time=328,requests_per_second=3.30'
Metrics script

The Go script in bin/ scrapes the metrics from the Locust web server, parses them according to the InfluxDB line protocol and writes them to the time series database.

Further Reading

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.