Sunday, September 15, 2013

Using WCAT Scenario Creator

Stress and Load testing on Windows used to be done using a utility called WCAT - Web Capacity Analysis Tool. This tool is powerful and it requires more manual scripting to get the performance results.  The current version of WCAT is 6.3 and can be downloaded from the following location: http://www.iis.net/downloads/default.aspx?tabid=34

 

setup and test

1.       Download the file

2.       Run the installation package

3.       Read the introduction to WCAT included in the installation   

c:\program files\wcat\doc\wcat.doc

1.       Once you have reviewed the basics you will need to install it on your client machines. (client are machines that will actually issue the commands to the server simulating your web clients).

1.       open a command prompt (as administrator if on vista)

2.       cd c:\program files\wcat\

3.       cscript //H:Cscript

4.       wcat.wsf -terminate -update -clients localhost

5.       machine will reboot

2.       To run the software you will first need to edit the client (scenario.ubr) and settings.ubr files to match the requests you wish to test. A simple HTTP get request for the scenario should suffice

3.       Save these two files to your WCAT directory

4.       Run your test with the following commands:

wcat.wsf -clients yourclientmachineip -run -t scenario.ubr -f settings.ubr -s yourserverip  -p yourserverport

5.       To view the results open log.xml

scenario.ubr

scenario
{
    name    = "HTTP Request Test";

    warmup      = 5; //seconds
    duration    = 10; //seconds
    cooldown    = 5; //seconds

    default
    {
        // send keep-alive header
        setheader
        {
            name    = "Connection";
            value   = "keep-alive";
        }

        // set the host header
        setheader
        {
            name    = "Host";
            value   = server();
        }

        // HTTP1.1 request
        version     = HTTP11;

        // keep the connection alive after the request
        close       = ka;
    }

    transaction
    {
        id = "simple scenario";
        weight = 1;

        request
        {
            url         = "/";
        secure      = true;
        statuscode  = 200;
        }


        close
        {
            method      = reset;
        }
    }
}

settings.ubr

settings
{   
    server         = "yourserveripaddresshere";
    clients        = 2;
    virtualclients = 5;

    counters
    {
        interval = 10;

        counter = "Processor(_Total)\\% Processor Time";
        counter = "Processor(_Total)\\% Privileged Time";
        counter = "Processor(_Total)\\% User Time";
        counter = "Processor(_Total)\\Interrupts/sec";

        counter = "Memory\\Available KBytes";
        counter = "Process(w3wp)\\Working Set";

        counter = "System\\Context Switches/sec";
        counter = "System\\System Calls/sec";

        counter = "Web Service(_Total)\\Bytes Received/sec" ; 
        counter = "Web Service(_Total)\\Bytes Sent/sec" ; 
        counter = "Web Service(_Total)\\Connection Attempts/sec" ; 
        counter = "Web Service(_Total)\\Get Requests/sec" ; 
    }

    registry
    {
        path = "System\\CurrentControlSet\\Control\\FileSystem";
        name = "NtfsDisableLastAccessUpdate";
        type = REG_DWORD;
    }

    registry
    {
        path = "System\\CurrentControlSet\\Services\\Tcpip\\Parameters";
        name = "SynAttackProtect";
        type = REG_DWORD;
    }
}

more complicated scenarios and tests

Since building more complex scripts can be a pain and time consuming, it is recommended to download the following two pieces of software that will help automate the building of the scenario scripts.

Downloads:
1. Fiddler 2.0
http://www.fiddler2.com/Fiddler2/version.asp

2. WCAT Scenario Creator
http://fiddler2wcat.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=35356
You will need to download WCATScenarioGenerator.dll

Installation:
1. Install Fiddler2
2. Save WCATScenarioGenerator.dll to the Fiddler2 scripts folder

Use:

1.       Open fiddler and click the launch IE button from within Fiddler2

2.       It will start recording a list of sessions along the left side

3.       After you've got a sequence on the left you want to save to a scenario for WCAT do the following:

4.       In fiddler 2 in the bottom left you should see a black rectangle.  This is where you can type commands for the WCAT extension

1.       Type wcat reset then carriage return

2.       type wcat addtrans then carriage return

3.       type wcat save

5.       you will now have a file called fiddler.wcat in your fiddler2 install folder

6.       open fiddler.wcat and save it to your c:\program files\wcat\ as newscenarioname.ubr

7.       run wcat and execute your new scenario file
wcat.wsf -clients yourclientmachineip -run -t newscenarioname.ubr -f settings.ubr -s yourserverip  -p yourserverport