performance - 宗。具有变量值的 contents_from_file 属性

标签 performance scalability benchmarking load-testing tsung

我在使用 tsung 时遇到问题:

我在一个目录中有几个文件,我必须发送到服务器。一世
使用此文件列表(完整路径)创建文件并添加一个选项
tsung 配置:

 <option name="file_server" id="xml_files" value="/home/ubuntu/.tsung/files"></option>

我的目标是从此文件中选择一个随机文件路径并发送到
服务器。为此,我编写了这部分配置:
  <setdynvars sourcetype="file" fileid="xml_files" delimiter=";"
order="random">
       <var name="file_name" />
     </setdynvars>

     <request subst="true">
           <http url="/" version="1.1" method="POST"
contents_from_file="%%_file_name%%"></http>
     </request>

但这不起作用。当我将 attr contents_from_file 设置为常量时
一切正常。
有没有办法用变量来做到这一点?

最佳答案

我得到了类似的东西,我正在使用 tsung 1.5.0。您可能想尝试:

<request subst="true">
           <http url="/" version="1.1" method="POST"
contents="%%readafile:readrnd%%"></http>
     </request>

其中 readfafile 是您自己的导出 readrnd 函数的模块。
readrnd 应该返回随机文件的内容。
注意:从文件源读取时,文件名将是二进制文件,您可能需要序列化。

代替:
<request subst="true">
           <http url="/" version="1.1" method="POST"
contents_from_file="%%_file_name%%"></http>
     </request> 

关于performance - 宗。具有变量值的 contents_from_file 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4669095/

相关文章:

javascript - 动态更新数百万 DOM 元素样式的最快方法

sql - 如何有效刷新昂贵查询的结果?

scala - 在云中部署和托管 scala?

node.js - 如何设计分布式 node.js Web 服务器

python - Python 中的基准运行时间

sql - SQL Server 中的 INNER JOIN 与 LEFT JOIN 性能

c# - 将 DataRowCollection 转换为 DataRow[]

php - 如何提高频繁插入率的MySQL查询性能?

php - Web CMS 性能 : pages/second (Joomla, Drupal、Plone、WP)

go - 如何使用 pprof 工具分析基准?