A ruby based end to end performance monitoring setup using Jmeter, InfluxDB and Grafana Dashboard.
Capture the response time of a page using jmeter in non gui mode, push the captured response time data to time series database Influx DB. Query the influx dbthrough Grafana dashboard to view the results in time series chart.
Three easy ways to capture the response time of a page
# Site Configurations
export [email protected]
export SITE_PASSWORD=demoadmin
export SITE_URL=https://www.phptravels.net
# Jmeter Configurations
export THROUGHPUT_PER_MINUTE=10
export THREAD_COUNT=1
export USERS_RAMPUP_TIME=10
export LOOP_COUNT=2
# Influx DB Configurations
export DATABASE_NAME=performance_jmeter
export DB_HOST=127.0.0.1
export DB_PORT=8086
export TEST_ENV=phptravels
{
"scenarios": {
"scenario1": {
"name": "load_admin_page",
"method": "GET",
"url": "/admin"
},
"scenario2": {
"name": "load_booking_page",
"method": "GET",
"url": "admin/bookings"
}
}
}
$ rake performance:test[file_name.json]
Before running test,
run following commands from command line (make sure you are in your project root directory ):
$ brew update
$ brew install rbenv
$ brew install ruby-build
$ rbenv install (this will install jruby version mentioned in your .ruby-version file)
$ bundle install (this will install all necessary gems mentioned in your Gemfile)
$ brew install influxdb
$ brew install grafana
$ brew install jmeter
$ influxd -config /usr/local/etc/influxdb.conf
$ source setup.sh (this will export all necessary env and change your USER_NAME,
USER_PASSWORD, SITE_URL and jmeter influxdb configuaration.
$ rake performance:test[load_admin_page.json]
$ rake performance:test_all
$ brew services start grafana (visit localhost:3000 to view the dashboard end point. Configure the influx DB data soruce, query the DB and create the time series charts to visualize response time over the period).