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
Size: 662
Language: Java
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
I've installed MongoDB and created a database named test and a collection called zips.
This is the zips data file.
p install locustio
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>
The official MongoDB Java Driver
endency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>3.6.3</version>
pendency>
I wrapped the MongoDB insert in a timer, but it might be also worth using the MongoDB profiler.
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
n clean compile assembly:single
va -cp target/mongodb-load-tests-1.0-SNAPSHOT-jar-with-dependencies.jar co.uk.bbc.Main
en http://localhost:8089/
Set the number of users and hatch rate. Charts can be viewed through a tab.
In the MongoDB shell:
.zips.find({"city": "BABYLON"}).count()
ew update
ew install influxdb
et https://dl.influxdata.com/influxdb/releases/influxdb-1.5.2.x86_64.rpm
do yum localinstall influxdb-1.5.2.x86_64.rpm
fluxd -config /usr/local/etc/influxdb.conf
rl -i -XPOST http://localhost:8086/query --data-urlencode "q=CREATE DATABASE mongodb"
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'
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.