csv HTTP简单表服务器
HTTP Simple Table ServerPerformance testing with JMeter can be done with several JMeter injectors (on a remote host) and one JMeter controller (with GUI, 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 / add rows of data in files. 使用JMeter进行性能测试可以使用多个JMeter注入器(在远程主机上)和一个JMeter控制器(在本地主机上使用GUI)完成。使用RMI协议将脚本发送到JMeter注入器。结果定期返回JMeter控制器。遗憾的是,数据集和csv文件不会从控制器传输到喷射器。 主要思想是在JMeter插件中使用一个微小的http服务器来管理数据集文件,使用简单的命令来获取/添加文件中的数据行。 组态在jmeter.properties文件中: ConfigurationIn jmeter.properties file: jmeterPlugin.sts.port=9191 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: 不要在路径目录中使用'\',它不能很好地工作,而是使用'/'或'\'。还建议使用UTF-8作为编码: sampleresult.default.encoding=UTF-8 If you want automatically start a Simple Table Server on JMeter STARTUP simply add "simple-table-server.bsh" in the "beanshell.init.file" property. Be sure that simple-table-server.bsh 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. 如果要在JMeter STARTUP上自动启动简单表服务器,只需在“beanshell.init.file”属性中添加“simple-table-server.bsh”即可。确保simple-table-server.bsh文件位于JMETER_HOME / bin目录中。 Simple Table Server是一个很小的http服务器,它可以在端口9191上发送http GET / POST请求(默认情况下)。您可以通过图形用户界面或通过覆盖jmeterplugin.sts.port属性来设置自定义端口。 JMeter的分布式架构简单表服务器在JMeter控制器(主服务器)上运行,负载生成器(从服务器)调用STS来获取或添加一些数据。在测试开始时,第一个负载生成器将在内存中加载数据(初始调用),并在测试结束时询问STS在文件中保存值。所有负载生成器都会询问来自JMeter控制器上启动的同一STS的数据。 Distributed architecture for JMeterThe Simple Table Server runs on the JMeter controller (master) and load generators (slaves) make calls to the STS to get or add some data. At the beginning of the test, the first load generator 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 generators ask data from the same STS which is started on the JMeter controller. Getting StartedThere are different ways to start the STS:
jmeterPlugin.sts.loadAndRunOnStartup=true When the STS is running go to http://<HOST>:<PORT>/sts/ to see all available commands. Calls are synchronized, all commands are executed one by one. Example of a dataset file logins.csv: 当STS运行时,转到http:// <HOST>:<PORT> / sts /以查看所有可用命令。 呼叫是同步的,所有命令都是逐个执行的。 数据集文件logins.csv的示例: login1;password1 INITFILELoad 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 .. 在内存中加载文件。行存储在链表中,1行= 1个元素 文件名限制为128个字符maxi,不得包含字符\ /:或.. http://hostname:port/sts/INITFILE?FILENAME=logins.csv HTML format:
Linked list after this command: login1;password1 READGet one line from list http://hostname:port/sts/READ?READ_MODE={FIRST, LAST, RANDOM}&KEEP={TRUE, FALSE}&FILENAME=logins.csv HTML format:
Available options:
KEEP=TRUE, READ_MODE=FIRST => login1;password1 Linked list after this command: login2;password2 KEEP=TRUE, READ_MODE=LAST => login5;password5 Linked list after this command: login1;password1 KEEP=TRUE, READ_MODE=RANDOM => login2;password2 Linked list after this command: login1;password1 KEEP=FALSE (delete mode), READ_MODE=FIRST => login1;password1 Linked list after this command: login2;password2 KEEP=FALSE, READ_MODE=LAST => login5;password5 Linked list after this command: login1;password1 KEEP=FALSE, READ_MODE=RANDOM => login2;password2 Linked list after this command: login1;password1 ADDAdd a line into a file: (GET OR POST HTTP protocol) GET Protocol http://hostname:port/sts/ADD?FILENAME=dossier.csv&LINE=D0001123&ADD_MODE={FIRST, LAST}&UNIQUE={FALSE, TRUE} GET Parameters : FILENAME=dossier.csv&LINE=D0001123&ADD_MODE={FIRST, LAST}&UNIQUE={FALSE, TRUE} POST Protocol http://hostname:port/sts/ADD POST Parameters : FILENAME=dossier.csv, LINE=D0001123, ADD_MODE={FIRST, LAST}, UNIQUE={FALSE, TRUE} HTML format:
Available options:
POST Protocol with parameters LENGTHReturn the number of remaining lines of a linked list 返回链表的剩余行数 http://hostname:port/sts/LENGTH?FILENAME=logins.csv HTML format:
STATUS显示已加载文件的列表以及每个链接列表的剩余行数 Display the list of loaded files and the number of remaining lines for each linked list http://hostname:port/sts/STATUS HTML format:
SAVESave the specified linked list in a file to the specified location 将文件中指定的链接列表保存到指定位置 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, the file is stored in the custom directory specified by editing the jmeterPlugin.sts.datasetDirectory property or in JMETER_HOME/bin directory by default: 如果jmeterPlugin.sts.addTimestamp设置为true,则会将时间戳添加到文件名,该文件存储在通过编辑jmeterPlugin.sts.datasetDirectory属性指定的自定义目录中,或默认情况下存储在JMETER_HOME / bin目录中: 20140520T16h33m27s.logins.csv HTML format:
RESETRemove all of the elements from the specified list http://hostname:port/sts/RESET?FILENAME=logins.csv HTML format:
STOPShutdown the Simple Table Server http://hostname:port/sts/STOP 有关详细信息,请参阅以下示例 在测试计划中使用STS通过使用一个或多个HTTP请求采样器调用URL,使用“setUp线程组”初始化文件。 读取一行数据是通过HTTP请求采样器在每次迭代时调用READ方法完成的。然后,您可以使用正则表达式提取器来解析响应数据。 阅读登录 See examples below for further information. Using STS in a Test PlanInitialize file using a "setUp Thread Group" by calling URL with one or more 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: Reading password: At the end of your Test Plan you can save remaining/adding data with a HTTP Request Sampler in a "tearDown Thread Group". Example
In a loop, read random values from a file containing a login and a password at each row: Read value from a file containing a login and a password at each row, each value is unique and cannot be read anymore: Add rows in a new linked list and save it in a file when the test is done: Read in a random mode a dataset located on the controller machine with severals slaves. The first injector loads the dataset in memory while the other injectors are waiting few seconds. The different injectors read randomly the data containing logins and passwords. When the test is done the first injector save the values in a file with a timestamp as prefix: You can override STS settings using command-line options:
jmeter.bat -DjmeterPlugin.sts.loadAndRunOnStartup=true -DjmeterPlugin.sts.port=9191 -DjmeterPlugin.sts.datasetDirectory=d:/data -n –t testdemo.jmx When it's done see results in the Listener Tree View. |
在测试计划结束时,您可以使用“泪滴线程组”中的HTTP请求采样器保存剩余/添加数据。
例
- 将logins.csv文件放在JMETER_HOME / bin目录中:
- 使用simple-table-server.cmd文件手动运行Simple Table Server,或使用beanShell配置自动运行。
- 运行以下脚本之一:
在循环中,从包含每行的登录名和密码的文件中读取随机值:
从包含每行的登录名和密码的文件中读取值,每个值都是唯一的,不能再读取:
在新链接列表中添加行并在测试完成后将其保存在文件中:
以随机模式读取位于控制器机器上的具有多个从站的数据集。第一个喷射器将数据集加载到内存中,而其他喷射器等待几秒钟。不同的注射器随机读取包含登录名和密码的数据。测试完成后,第一个注入器将值保存在一个文件中,时间戳为前缀:
您可以使用命令行选项覆盖STS设置:
- -DjmeterPlugin.sts.port = <端口号>
- -DjmeterPlugin.sts.loadAndRunOnStartup = <真/假>
- -DjmeterPlugin.sts.datasetDirectory = <路径/到/你的/目录>
- -DjmeterPlugin.sts.addTimestamp = <真/假>
csv HTTP简单表服务器的更多相关文章
- Socket网络编程--简单Web服务器(1)
这一次的Socket系列准备讲Web服务器.就是编写一个简单的Web服务器,具体怎么做呢?我也不是很清楚流程,所以我找来了一个开源的小的Web服务器--tinyhttpd.这个服务器才500多行的代码 ...
- python socket 实现的简单http服务器
预备知识: 关于http 协议的基础请参考这里. 关于socket 基础函数请参考这里. 关于python 网络编程基础请参考这里. 一.python socket 实现的简单http服务器 废话 ...
- PHP -- 简单表单提交
网上看博文,一步步入门~~ 简单表单,简单提交 @_@!! <?php //php代码部分开始 echo "<html>"; echo "<hea ...
- Pandas对于CSV的简单操作
Pandas对于CSV的简单操作 最近在研究pandas对于csv文件的读取以及一些操作,网上的信息比较乱,写篇博客记录一下,毕竟自己写的才是最适合自己的用法. 首先我们应该都知道,pandas是一个 ...
- C#中使用Socket实现简单Web服务器
上一篇博客中介绍了怎样使用socket访问web服务器.关键有两个: 熟悉Socket编程: 熟悉HTTP协议. 上一篇主要是通过socket来模拟浏览器向(任何)Web服务器发送(HTTP)请求,重 ...
- 用nodejs搭建一个简单的服务器
使用nodejs搭建一个简单的服务器 nodejs优点:性能高(读写文件) 数据操作能力强 官网:www.nodejs.org 验证是否安装成功:cmd命令行中输入node -v 如果显示版本号表示安 ...
- 初学Node(六)搭建一个简单的服务器
搭建一个简单的服务器 通过下面的代码可以搭建一个简单的服务器: var http = require("http"); http.createServer(function(req ...
- 搭建无限制权限的简单git服务器使用git-daemon脚本
如果想要用ubantu架设无限制权限(即不适用gitosis)的简单git服务器,实现git库下载clone,push等简单的基本功能, 可以直接使用git-daemon脚本(非常不安全,建议项目代码 ...
- 运用socket实现简单的服务器客户端交互
Socket解释: 网络上的两个程序通过一个双向的通信连接实现数据的交换,这个连接的一端称为一个socket. Socket的英文原义是“孔”或“插座”.作为BSD UNIX的进程通信机制,取后一种意 ...
随机推荐
- 问题:sqlserver有没有类似Oracle的LISTAGG;结果: 灵活运用 SQL SERVER FOR XML PATH
灵活运用 SQL SERVER FOR XML PATH FOR XML PATH 有的人可能知道有的人可能不知道,其实它就是将查询结果集以XML形式展现,有了它我们可以简化我们的查询语句实现一些以前 ...
- spring-boot 热加载实现替换Jrebel
导读: 本文主要说说,在玩spring-boot时,我们经常要遇到重启服务这种浪费时间的事情,为了割掉这个痛点,我们一般有2中方式实现. 一个是springload , 另外一个是 spring-bo ...
- JAVA之数组队列
package xxj.datastructure0810; import java.util.Random; public class DataStructure { /** * @param ar ...
- Android排错: has leaked window com.android.internal.policy.impl.PhoneWindow$ that was originally added here
异常场景: 经常在应用中需要处理一些耗时的工作,诸如读取大文件.访问网络资源等.为了避免因程序假死而带来的糟糕用户体验,通常我们可以通过线程+Handler或者Android提供的AsyncTask来 ...
- memcache windows64 位安装
--环境: windows 2008 R2 64位 wampserver2.2e-php5.3.13-httpd2.2.22-mysql5.5.24-x64 --目标: 实现 php 用memcach ...
- 框架之 hibernate之各种查询
1. Hibernate的查询方式 2. Hibernate的查询策略 案例:使用Hibernate完成查询所有联系人功能 需求分析 1. 完成所有的联系人的查询 技术分析之Hibernate框架的查 ...
- SWT简介
--------------siwuxie095 SWT 简介: SWT(Standard Widget Toolkit) 也是基于一个对等体实 ...
- 已看1.熟练的使用Java语言进行面向对象程序设计,有良好的编程习惯,熟悉常用的Java API,包括集合框架、多线程(并发编程)、I/O(NIO)、Socket、JDBC、XML、反射等。[泛型]\
1.熟练的使用Java语言进行面向对象程序设计,有良好的编程习惯,熟悉常用的Java API,包括集合框架.多线程(并发编程).I/O(NIO).Socket.JDBC.XML.反射等.[泛型]\1* ...
- #pragma pack()用法详解
博客转载自:http://blog.csdn.net/lime1991/article/details/44536343 1.什么是对齐?为什么要对齐? 现代计算机中内存空间都是按照byte划分的,从 ...
- bzoj4391 [Usaco2015 dec]High Card Low Card
传送门 分析 神奇的贪心,令f[i]表示前i个每次都出比对方稍微大一点的牌最多能赢几次 g[i]表示从i-n中每次出比对方稍微小一点的牌最多赢几次 ans=max(f[i]+g[i+1]) 0< ...