Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Variable multiple replacement

jesantos
jesantos Posts: 12

I have an XML response with 300 tags that need to be all unique at response side (everytime it is hit all 300 unique). I have tried creating a variable with a Data Generator Tool using the current time hhmmssSSS and replace it accordingly as ${time}001, ${time}002...${time}300 in the response, it works just fine, the problem is that at runtime (at around 500tps) it is having a bad performance, I guess due the multiple replaces of the variable taking place, since the pva has too many entries and this is the only one taking long from them all.
Any good way to achieve my response without having to replace my variable too many times?

Comments

  • jesantos
    jesantos Posts: 12

    I had the same problem with a JSON response, for that I attached an Extension Tool to the Outgoing payload and used the following with JavaScript (Oracle Nashorn):

    function newResponse(input, context)
    {
    var jsonObject = JSON.parse(input.toString());
    var count = jsonObject.ResponseData.myId.length;

    for(var i = 0; i < count; i++)
    {
        var random = Math.floor(Math.random() * 10000000000)
        jsonObject.ResponseData.myId[i].value = random;
    }
    
    return JSON.stringify(jsonObject);
    

    }

    That worked great, however I can't find a way to play the same way with the response being an XML.

  • williammccusker
    williammccusker Posts: 642 ✭✭✭

    Hi,

    For performance tuning a server this documentation page has several steps that should be followed.

    https://docs.parasoft.com/display/VIRT20222/Performance+Tuning+a+Virtualize+Server

    Make sure that Event Monitoring is turned off! As far as the asset configuration the multiple replacements shouldn't be a performance issue. What mode is the response tab in? Form Input, Form XML, or Literal? The recommendation for the best performance is to use Literal.

  • jesantos
    jesantos Posts: 12

    Yes, we have monitoring set off, else the servers immediately go crazy during the test. We also use literal response at response tab.

    I am thinking that those replacements may be an issue as this PVA has almost 60 entries and this is one of the only entries that is having a high response time as per the Hit Statistics report we get from CTP

    Thanks for your comments

  • williammccusker
    williammccusker Posts: 642 ✭✭✭

    Hi,

    Could you provide an example pva?

    Replacing variables takes minimal amount of processing so it should not be slowing down the response or creating a bottleneck. The overall response size does affect the throughput based on network speeds but its interesting that you saw a performance increase using a script to replace the ids since script execution typically has a higher overhead.