From 89bf49b569ef4f1c0744d451a7e6b7bedb75d9ca Mon Sep 17 00:00:00 2001 From: DABURON Vincent Date: Tue, 12 May 2026 11:56:14 +0200 Subject: [PATCH] Update documentation. Add some links to dzone article and github projects. Correct markdown list and a
. --- site/dat/wiki/HttpSimpleTableServer.md | 178 ++++++++++++++----------- 1 file changed, 97 insertions(+), 81 deletions(-) diff --git a/site/dat/wiki/HttpSimpleTableServer.md b/site/dat/wiki/HttpSimpleTableServer.md index 6161b1e43..7567d0991 100644 --- a/site/dat/wiki/HttpSimpleTableServer.md +++ b/site/dat/wiki/HttpSimpleTableServer.md @@ -2,13 +2,16 @@ [ Download](/?search=jpgc-sts) -Performance testing with JMeter can be done with several JMeter injectors (on a remote host) and one JMeter controller (with GUI or CLI, on your local host). -Scripts are sent to JMeter injectors using RMI protocol. -Results are brought back periodically to the JMeter controller. -Unfortunately the dataset and csv files aren't transferred from the controller to injectors. +Performance testing with JMeter can be done with several JMeter injectors (on a remote host) and one JMeter controller (with GUI or CLI, on your local host).
+Scripts are sent to JMeter injectors using RMI protocol.
+Results are brought back periodically to the JMeter controller.
+Unfortunately the dataset and csv files aren't transferred from the controller to injectors.
The main idea is to use a tiny http server in JMeter Plugins to manage the dataset files with simple commands to get / find / add rows of data in files. +An article about this tool : https://dzone.com/articles/jmeter-plugin-http-simple-table-server
+"Take an in-depth look to discover some of the possibilities of using the HTTP Simple Table Server a JMeter Plugin in this short manual." + ## Configuration In jmeter.properties file, STS properties are : @@ -32,23 +35,23 @@ jmeterPlugin.sts.initFileAtStartupRegex=true ``` -Do not use '\' in the path directory, it doesn't work well, use '/' or '\\\\' instead. +Do not use '\\' in the path directory, it doesn't work well, use '/' or '\\\\' instead.
It is also recommended to use UTF-8 as the encoding: ``` sampleresult.default.encoding=UTF-8 ``` -If you want automatically start a Simple Table Server on JMeter STARTUP simply add jsr223.init.file=simple-table-server.groovy in jmeter.properties -Be sure that simple-table-server.groovy file is in your JMETER_HOME/bin directory. +If you want automatically start a Simple Table Server on JMeter STARTUP simply add jsr223.init.file=simple-table-server.groovy in jmeter.properties
+Be sure that simple-table-server.groovy file is in your JMETER_HOME/bin directory. -The Simple Table Server is a tiny http server which can send http GET/POST requests on port 9191 (by default). -You can set a custom port through the graphical user interface or by overriding the jmeterplugin.sts.port property. +The Simple Table Server is a tiny http server which can send http GET/POST requests on port 9191 (by default).
+You can set a custom port through the graphical user interface or by overriding the jmeterplugin.sts.port property.
## Distributed architecture for JMeter -The Simple Table Server runs on the JMeter controller (master) and load generators/injectors (slaves) make calls to the STS to get or add some data. -At the beginning of the test, the first load injector will load data in memory (initial call) and at the end of the test it asks the STS saving values in a file. +The Simple Table Server runs on the JMeter controller (master) and load generators/injectors (slaves) make calls to the STS to get or add some data.
+At the beginning of the test, the first load injector will load data in memory (initial call) and at the end of the test it asks the STS saving values in a file.
All the load injectors ask data from the same STS which is started on the JMeter controller. ![](/img/wiki/http_sts_jmeter_archi_distributed_v4.0.png) @@ -59,14 +62,14 @@ All the load injectors ask data from the same STS which is started on the JMeter There are different ways to start the STS: - - 1) with JMeter GUI: +1. with JMeter GUI: ![](/img/wiki/http_simple_table_server.png) - - 2) with simple-table-server.cmd (.sh for UNIX) script located in your JMETER_HOME/bin directory. Parameters are read in the jmeter.properties or you could also set parameters like simple-table-server.cmd -DjmeterPlugin.sts.addTimestamp=true -DjmeterPlugin.sts.datasetDirectory=D:/jmeter/dataset, set jmeterPlugin.sts.daemon=true when you want launch the STS with the nohup linux command like process daemon, the STS will not waiting the key to stop. - - 3) on JMeter CLI startup (Windows : jmeter-n.cmd or Linux jmeter -n) following properties in jmeter.properties file or in user.properties : +2. With simple-table-server.cmd (.sh for UNIX) script located in your JMETER_HOME/bin directory. Parameters are read in the jmeter.properties or you could also set parameters like simple-table-server.cmd -DjmeterPlugin.sts.addTimestamp=true -DjmeterPlugin.sts.datasetDirectory=D:/jmeter/dataset, set jmeterPlugin.sts.daemon=true when you want launch the STS with the nohup linux command like process daemon, the STS will not waiting the key to stop. +3. On JMeter CLI startup (Windows : jmeter-n.cmd or Linux jmeter -n) following properties in jmeter.properties file or in user.properties : -``` +```text jmeterPlugin.sts.loadAndRunOnStartup=true jmeterPlugin.sts.port=9191 @@ -75,16 +78,30 @@ jmeterPlugin.sts.daemon=false jsr223.init.file=simple-table-server.groovy ``` + +**Calls are synchronized, all commands are executed ONE BY ONE** (no concurrent access to datas) + + +## HELP +**Show a html page to explain parameters and examples.**
+``` +http://hostname:port/sts/ +``` When the STS is running go to `http://:/sts/` to **see all available commands** and a short help. Usually `http://localhost:9191/sts/` -**Calls are synchronized, all commands are executed ONE BY ONE.** +## INITFILE +**Load file in memory. Lines are stored in a linked list, 1 line = 1 element** + +The filename is limited to 128 characters maxi and must not contain characters \\ / : or .. + +This limits are for security reasons (E.g: NOT read "/etc/passwd" or ../../../tomcat/conf/server.xml). Example of a dataset file logins.csv: -``` +```text login1;password1 login2;password2 login3;password3 @@ -92,19 +109,13 @@ login4;password4 login5;password5 ``` -## INITFILE - -**Load file in memory. Lines are stored in a linked list, 1 line = 1 element** - -The filename is limited to 128 characters maxi and must not contains characters \ / : or .. - -This limits are for security reasons (E.g: NOT read "/etc/passwd" or ../../../tomcat/conf/server.xml). +Load the file "logins.csv" in memory (linked list) ``` http://hostname:port/sts/INITFILE?FILENAME=logins.csv ``` -HTML format: +Result in HTML format: ```html OK @@ -114,7 +125,7 @@ HTML format: Linked list after this command: -``` +```text login1;password1 login2;password2 login3;password3 @@ -138,12 +149,12 @@ jmeterPlugin.sts.initFileAtStartupRegex=true jmeterPlugin.sts.initFileAtStartup=file\d+\.csv ``` -jmeterPlugin.sts.initFileAtStartupRegex=false and jmeterPlugin.sts.initFileAtStartup=file1.csv,file2.csv,otherfile.csv +jmeterPlugin.sts.initFileAtStartupRegex=false and jmeterPlugin.sts.initFileAtStartup=file1.csv,file2.csv,otherfile.csv
read csv files with comma separator (not a regular expression), e.g : read file1.csv and file2.csv and otherfile.csv OR -jmeterPlugin.sts.initFileAtStartupRegex=true and jmeterPlugin.sts.initFileAtStartup=.+\.csv +jmeterPlugin.sts.initFileAtStartupRegex=true and jmeterPlugin.sts.initFileAtStartup=.+\\.csv
read all csv files in the dataset directory the jmeterPlugin.sts.initFileAtStartup value is a regular expression ## READ @@ -165,17 +176,17 @@ HTML format: ``` Available options: - - READ_MODE=FIRST => login1;password1 - - READ_MODE=LAST => login5;password5 - - READ_MODE=RANDOM => login?;password? - - KEEP=TRUE => the data is kept and put to the end of list - - KEEP=FALSE => the data is removed +- READ_MODE=FIRST => login1;password1 +- READ_MODE=LAST => login5;password5 +- READ_MODE=RANDOM => login?;password? +- KEEP=TRUE => the data is kept and put to the end of list +- KEEP=FALSE => the data is removed KEEP=TRUE, READ_MODE=FIRST => login1;password1 Linked list after this command: -``` +```text login2;password2 login3;password3 login4;password4 @@ -187,7 +198,7 @@ KEEP=TRUE, READ_MODE=LAST => login5;password5 Linked list after this command: -``` +```text login1;password1 login2;password2 login3;password3 @@ -199,7 +210,7 @@ KEEP=TRUE, READ_MODE=RANDOM => login2;password2 Linked list after this command: -``` +```text login1;password1 login3;password3 login4;password4 @@ -211,7 +222,7 @@ KEEP=FALSE (delete mode), READ_MODE=FIRST => login1;password1 Linked list after this command: -``` +```text login2;password2 login3;password3 login4;password4 @@ -222,7 +233,7 @@ KEEP=FALSE, READ_MODE=LAST => login5;password5 Linked list after this command: -``` +```text login1;password1 login2;password2 login3;password3 @@ -233,7 +244,7 @@ KEEP=FALSE, READ_MODE=RANDOM => login2;password2 Linked list after this command: -``` +```text login1;password1 login3;password3 login4;password4 @@ -245,12 +256,12 @@ login5;password5 **Get multi lines from list in one request** Available options: - - NB_LINES=Number of lines to read : 1 \<= Nb lines (Integer) and Nb lines \<= list size - - READ_MODE=FIRST =>start to read at the first line - - READ_MODE=LAST => start to read at the last line (reverse) - - READ_MODE=RANDOM => read n lines randomly - - KEEP=TRUE => the data is kept and put to the end of list - - KEEP=FALSE => the data is removed +- NB_LINES=Number of lines to read : 1 \<= Nb lines (Integer) and Nb lines \<= list size +- READ_MODE=FIRST =>start to read at the first line +- READ_MODE=LAST => start to read at the last line (reverse) +- READ_MODE=RANDOM => read n lines randomly +- KEEP=TRUE => the data is kept and put to the end of list +- KEEP=FALSE => the data is removed GET Protocol @@ -260,7 +271,7 @@ http://hostname:port/sts/READMULTI?FILENAME=logins.csv&NB_LINES={Nb lines to rea GET parameters : FILENAME=logins.csv, NB\_LINES=Nb lines to read (Integer), READ\_MODE=FIRST (Default) or LAST or RANDOM, KEEP=TRUE (Default) or FALSE -E.g : Read first 3 lines, http://hostname:port/sts/READMULTI?FILENAME=logins.csv&NB1\_LINES=3&READ\_MODE=FIRST&KEEP=true +E.g : Read first 3 lines, `http://hostname:port/sts/READMULTI?FILENAME=logins.csv&NB_LINES=3&READ_MODE=FIRST&KEEP=true` NB\_LINES=3, KEEP=TRUE, READ\_MODE=FIRST, KEEP=TRUE => result @@ -304,7 +315,6 @@ http://hostname:port/sts/ADD?FILENAME=dossier.csv&LINE=D0001123&ADD_MODE={FIRST, GET Parameters : FILENAME=dossier.csv&LINE=D0001123&ADD_MODE={FIRST, LAST}&UNIQUE={FALSE, TRUE} - POST Protocol ``` @@ -322,11 +332,11 @@ HTML format: ``` Available options: - - ADD_MODE=FIRST => add to the top - - ADD_MODE=LAST => add to the end - - FILENAME=dossier.csv => if doesn't already exist it creates a LinkedList in memory - - LINE=1234;98763 => the line to add - - UNIQUE=TRUE => do not add line if the list already contains such line (if already exits then return title KO and don't add the same line) +- ADD_MODE=FIRST => add to the top +- ADD_MODE=LAST => add to the end +- FILENAME=dossier.csv => if doesn't already exist it creates a LinkedList in memory +- LINE=1234;98763 => the line to add +- UNIQUE=TRUE => do not add line if the list already contains such line (if already exits then return title KO and don't add the same line) POST Protocol with parameters ![](/img/wiki/http_sts_add_request.png) @@ -336,10 +346,10 @@ POST Protocol with parameters **Find a line in a file (GET OR POST HTTP protocol)** The LINE to find is for FIND_MODE : - - A string this SUBSTRING (Default, ALineInTheFile contains the stringToFind ) or EQUALS (stringToFind == ALineInTheFile) - - A regular expression with REGEX\_FIND (contains) and REGEX\_MATCH (entire region the pattern) - - KEEP=TRUE => the data is kept and put to the end of list - - KEEP=FALSE => the data is removed +- A string this SUBSTRING (Default, ALineInTheFile contains the stringToFind ) or EQUALS (stringToFind == ALineInTheFile) +- A regular expression with REGEX\_FIND (contains) and REGEX\_MATCH (entire region the pattern) +- KEEP=TRUE => the data is kept and put to the end of list +- KEEP=FALSE => the data is removed GET Protocol @@ -355,7 +365,7 @@ POST Protocol http://hostname:port/sts/FIND ``` -POST Parameters : FILENAME=colors.txt, LINE=BLUE|RED or LINE=BLUE or LINE=B.\* or LINE=.\**E.\** ,FIND\_MODE=SUBSTRING (Default),EQUALS,REGEX\_FIND or REGEX\_MATCH, KEEP=TRUE (Default) or FALSE +POST Parameters : FILENAME=colors.txt, LINE=BLUE|RED or LINE=BLUE or LINE=B.\* or LINE=.\*E.\* ,FIND\_MODE=SUBSTRING (Default),EQUALS,REGEX\_FIND or REGEX\_MATCH, KEEP=TRUE (Default) or FALSE If find return the first line finded, start reading at first line in the file (linked list) @@ -417,7 +427,7 @@ The charset use to write the file is set with jmeterPlugin.sts.charsetEncodingWr http://hostname:port/sts/SAVE?FILENAME=logins.csv ``` -If jmeterPlugin.sts.addTimestamp is set to true then a timestamp will be add to the filename, +If jmeterPlugin.sts.addTimestamp is set to true then a timestamp will be add to the filename,
the file is stored in the custom directory specified by editing the jmeterPlugin.sts.datasetDirectory property or in JMETER_HOME/bin directory by default: ``` @@ -463,7 +473,7 @@ Always returns title OK even if the file did not exist http://hostname:port/sts/STOP ``` -When the jmeterPlugin.sts.daemon=true, you need to call http://hostname:port/sts/STOP or kill the process to stop the STS +When the jmeterPlugin.sts.daemon=true, you need to call `http://hostname:port/sts/STOP` or kill the process to stop the STS ## CONFIG @@ -477,7 +487,7 @@ http://hostname:port/sts/CONFIG Initialize file using a "setUp Thread Group" by calling URL with one or more HTTP Request Sampler or with jmeterPlugin.sts.initFileAtStartup property to read file at JMeter startup. -Reading a row of data is done by calling READ method at each iteration by a HTTP Request Sampler. +Reading a row of data is done by calling READ method at each iteration by a HTTP Request Sampler.
Then you can use a Regular Expression Extractor to parse the response data. Reading login: @@ -493,7 +503,7 @@ At the end of your Test Plan you can save remaining/adding data with a HTTP Requ If you need to parse more than 2 columns, you could use a Post-Processeur groovy JSR223 like : -```python +```groovy // E.g. read line = COL1VALUE;COL2VALUE;COL3VALUE;COL4VALUE;COL5VALUE // column separator = ';' String lineData = org.apache.commons.lang3.StringUtils.substringBetween(prev.getResponseDataAsString(),"",""); @@ -514,12 +524,12 @@ else { ## Examples - - Put the logins.csv file in your JMETER_HOME/bin directory: +- Put the logins.csv file in your JMETER_HOME/bin directory: [Download logins.csv file](/img/examples/logins.csv) - - Run the Simple Table Server manually with the simple-table-server.cmd file or automatically with groovy configuration. - - Run one of the following scripts: +- Run the Simple Table Server manually with the simple-table-server.cmd file or automatically with groovy configuration. +- Run one of the following scripts: In a loop, read random values from a file containing a login and a password at each row: @@ -546,16 +556,16 @@ When the test is done the first injector save the values in a file with a timest [Download Example Test Plan 4](/img/examples/demo_sts_read_random_for2slaves.jmx) Multi JMeter injectors and save list examples You can override STS settings using command-line options: - - -DjmeterPlugin.sts.port=\ - - -DjmeterPlugin.sts.loadAndRunOnStartup=\ - - -DjmeterPlugin.sts.datasetDirectory=\ - - -DjmeterPlugin.sts.addTimestamp=\ - - -DjmeterPlugin.sts.daemon=\ - - -DjmeterPlugin.sts.charsetEncodingHttpResponse=\ - - -DjmeterPlugin.sts.charsetEncodingReadFile=\ - - -DjmeterPlugin.sts.charsetEncodingWriteFile=\ - - -DjmeterPlugin.sts.initFileAtStartup=\ - - -DjmeterPlugin.sts.initFileAtStartupRegex=false=\ +- -DjmeterPlugin.sts.port=\ +- -DjmeterPlugin.sts.loadAndRunOnStartup=\ +- -DjmeterPlugin.sts.datasetDirectory=\ +- -DjmeterPlugin.sts.addTimestamp=\ +- -DjmeterPlugin.sts.daemon=\ +- -DjmeterPlugin.sts.charsetEncodingHttpResponse=\ +- -DjmeterPlugin.sts.charsetEncodingReadFile=\ +- -DjmeterPlugin.sts.charsetEncodingWriteFile=\ +- -DjmeterPlugin.sts.initFileAtStartup=\ +- -DjmeterPlugin.sts.initFileAtStartupRegex=false=\ ``` @@ -566,21 +576,21 @@ When it's done see results in the Listener Tree View. ## JMETER MAVEN PLUGIN If you want to use the Http Simple Server with the **JMeter Maven plugin**, you could : - - Put your csv files in /src/test/jmeter directory (e.g : logins.csv) - - Put the simple-table-server.groovy (groovy script) in /src/test/jmeter directory - - Put the your jmeter script in /src/test/jmeter directory (e.g : test_login.jmx) - - Declare in the maven build section, in the configuration > jmeterExtensions > declare the artifact kg.apc:jmeter-plugins-table-server: - - Declare user properties for STS configuration and automatic start +- Put your csv files in /src/test/jmeter directory (e.g : logins.csv) +- Put the simple-table-server.groovy (groovy script) in /src/test/jmeter directory +- Put the your jmeter script in /src/test/jmeter directory (e.g : test_login.jmx) +- Declare in the maven build section, in the configuration > jmeterExtensions > declare the artifact kg.apc:jmeter-plugins-table-server: +- Declare user properties for STS configuration and automatic start Extract pom.xml dedicated to Http Simple Table Server : -```python +```xml com.lazerycode.jmeter jmeter-maven-plugin - 3.7.0 + 3.8.0 ... @@ -600,6 +610,12 @@ Extract pom.xml dedicated to Http Simple Table Server : ``` +Link to JMeter Maven plugin : https://github.com/jmeter-maven-plugin/jmeter-maven-plugin + +## STS ALONE +The Http Simple Table Server (STS) exist in external tool (.jar) without the need of JMeter.
+https://github.com/vdaburon/simple-table-server-alone
+Alone because this tool don't need Apache JMeter, it works by itself or alone. ## VERSIONS