diff --git a/documentation/developer/Performance-jmeter.md b/documentation/developer/Performance-jmeter.md new file mode 100644 index 00000000..2be23e1f --- /dev/null +++ b/documentation/developer/Performance-jmeter.md @@ -0,0 +1,26 @@ +#Performance test using Apache JMeter + +This document explains how to run performance tests on Libresonic using [Apache JMeter](http://jmeter.apache.org/). +The installation and setup of JMeter is not documented bellow; please refer to the JMeter web site. + +##Main test plan +The Libresonic sources come with a main performance test case defined in file libresonic-main/src/test/resources/jmeter/libresonicMainTestPlan.jmx. +This is a JMeter test plan file. + +This test plan simulates a single user that picks up a random album id (xxx) every 5 second and run the main.view?id=xxx http request. + +To run the test plan, open the libresonicMainTestPlan.jmx file in JMeter. +Run Libresonic. Note that the default configuration of this test plan expects Libresonic to be reached at the http://localhost:8080 URL. +Then run the test plan in JMeter. +After a while, you'll obtain a beautiful graph like this + +![](jmeter-main-test-plan.png) + +If you want to run the test with more than one user, just change the _Number of Threads_ property in the main _Thread Group_ configuration. + +If you want to change the delay between each request, change the value in the _Wait next request Timer_ _Constant Timer_ definition. + + + + + diff --git a/documentation/developer/jmeter-main-test-plan.png b/documentation/developer/jmeter-main-test-plan.png new file mode 100644 index 00000000..9f6d0a1b Binary files /dev/null and b/documentation/developer/jmeter-main-test-plan.png differ diff --git a/libresonic-main/src/test/resources/jmeter/libresonicMainTestPlan.jmx b/libresonic-main/src/test/resources/jmeter/libresonicMainTestPlan.jmx new file mode 100755 index 00000000..33ac4c67 --- /dev/null +++ b/libresonic-main/src/test/resources/jmeter/libresonicMainTestPlan.jmx @@ -0,0 +1,314 @@ + + + + + + false + false + + + + + + + + + + SERVER_NAME + localhost + = + + + SERVER_PORT + 8080 + = + + + + + + + false + standard + org.apache.jmeter.protocol.http.control.HC4CookieHandler + + + + continue + + false + 1 + + 1 + + 1459196515000 + 1459196515000 + false + + + + + + + + + + + ${SERVER_NAME} + ${SERVER_PORT} + + + + + /login + GET + true + false + true + false + false + + + + + LOGIN_CSRF_TOKEN + input[name=_csrf] + value + + false + + JSOUP + ${LOGIN_CSRF_TOKEN} + + + + + + + + false + ${LOGIN_CSRF_TOKEN} + = + true + _csrf + + + false + admin + = + true + j_username + + + false + admin + = + true + j_password + + + + ${SERVER_NAME} + ${SERVER_PORT} + + + + + /login + POST + true + false + true + false + false + + + + + + true + -1 + + + + 5000 + + + + + + + false + admin + = + true + u + + + false + admin + = + true + p + + + false + 1.13.0 + = + true + v + + + false + jmeter + = + true + c + + + false + random + = + true + type + + + false + 1 + = + true + size + + + + ${SERVER_NAME} + ${SERVER_PORT} + + + + + /rest/getAlbumList.view + GET + true + false + true + false + false + + + + + + ALBUM_ID + /subsonic-response/albumList/album/@id + false + false + false + + + + + + + + false + ${ALBUM_ID} + = + true + id + + + + ${SERVER_NAME} + ${SERVER_PORT} + + + + + /main.view + GET + true + false + true + false + false + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + +