[Tsung] Can we have two "clients" sections in tsung config? Say one at the beginning one close to the end of config?

Nicolas Niclausse nicolas at niclux.org
Tue Apr 7 23:53:50 CEST 2015


Luis A. Serrano a écrit le 07/04/2015 22:03 :
> Hi Rodolphe, Sebastian, 
> 
> Thanks for your responses. 
> 
> I guess for now I will settle with two tsung configs. One config for
> majority of traffic and involving all client nodes. Then another config for
> a special request type  to be used only by a client node. 
> 
> 
> The reason that I need traffic coming from one machine for that special
> request is that for that particular request I have seen that using single
> load generator  works, using multiple it doesn't. 
> 
> The thing is that in the payload of a json request we put the timestamp.
> But sometimes (and I don't know why) two driver machines can do the same
> request for the same user (CSV file) and if the App Server sees same
> request 2 times it will return HTTP/409.  Using only one machine to
> generate the load, this case doesn't happen at all. Please notice that this
> doesn't happen 100%, only a very small fraction  to rise elbows :)   (we
> don't want to have failures in the tests at all)
> 
> So that is why I will have one config for  that special request executing
> only in one node. Then all the other requests running from multiple boxes
> as those other request don't have this timestamp on payload. 
> 

Hello,

You can also use a dirty trick: get the current hostname and use a 'if'
statement in the special session, like this:

  <session name="jsonrequestsession" probability="xx" type="ts_http">

    <setdynvars sourcetype="eval"
                code="fun({Pid,DynVars})->
                       {ok,Val}=ts_utils:node_to_hostname(node()),
                       Val
                      end.">
      <var name="node" />
    </setdynvars>

    <if var="node" eq="myclienthostname">
      <request>
        <http url="http://www/foo.json"/>
      </request>

     ...
    </if>





-- 
Nicolas


More information about the Tsung-users mailing list