Collect server stats like cpu, memory and network

This is a solution to get server stats like cpu, memory and network usage while executing test on the server.

The server stats and soapui load test result is sent to elastic search using tcp and elastic search plugin.

Pre requisite:
1. Project must be setup
2. http://jmeter-plugins.org/wiki/PerfMonAgent/ need to install a server agent.
3. JRE 1.7 and above
4. ELK setup is required.

Following steps need to perform:

Step 1: Go to project directory …/soapui-load-test

Step 2: Start logstash agent with following configuration

logstash agent -f server.conf

#server.conf
input {
 tcp {
 port => 9890
 }
}
output {
 elasticsearch {
 cluster => "loadtestelasticsearch"
 host => "localhost"
 }
}

Step 3: Start Performance client for monitoring server stats and also start tcp listener to stop monitoring.

mvn exec:java -Dexec.mainClass="com.tavisca.vexiere.perfmon.PerfMonClient" -Dexec.args="-t ip1:port1#ip2:port2 
-p tempPort -lg ip4:port4" -pl perf-mon-start,logstashforwarder

"t"  : Give the IP address and port no for target server agent. i.e ip1:port1#ip2:port2 etc
"p"  : Give the port no for perf mon server i.e. int default is 12999
"lg" : Give the IP address and port no for logstash forwarder. i.e ip1:port1

Step 4:  Start soapui load test runner.

mvn exec:java -Dexec.mainClass="com.tavisca.vexiere.loadtest.VexiereLoadTestMain" -Dexec.args="-lg ip4:port4" -pl soap-ui-load-test-runner,logstashforwarder

"tc"    : Give the thread count default is 5.
"limit" : Give the limit for number of request default is 100.

Step 5: Stop the monitoring of the yours project server stats after completing the load test:

mvn exec:java -Dexec.mainClass="com.tavisca.perfmon.client.PerfMonSutdownServerClient" -Dexec.args="-q tempPort" -pl per-mon-shutdown

"q" : "Give the port no for perf mon server i.e. int default is 12999

Note: To execute it on jenkins remove the mvn part from all commands.

Use kibana  to visualize the load test result.

Overview of Performance Testing for Web Services