mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-18 17:47:54 +08:00
Initial roughing out of some profiling context
wcat binaries (http://www.iis.net/community/default.aspx?tabid=34&g=6&i=1466) Orchard.Profiling project to hold some wcat scripts for generating stress-style load and specflow features for generating fixed sets of requests "add profiling data" command in Orchard.DevTools to create a number of samples page and blog content items "build.cmd profiling" target creates build\Profiling web dir from clean build, and execs baseline setup and population via orchard cmdline --HG-- branch : dev
This commit is contained in:
37
lib/wcat/doc/readme.txt
Normal file
37
lib/wcat/doc/readme.txt
Normal file
@@ -0,0 +1,37 @@
|
||||
Getting Started with WCAT
|
||||
======================================
|
||||
|
||||
Documentation
|
||||
It is suggested that you read the documentation for WCAT in order to understand
|
||||
the environment and configuration needed. Documentation can be found under the
|
||||
doc folder in the directory that you installed WCAT to.
|
||||
|
||||
Installing WCAT
|
||||
Prerequisite: all machines that will run WCAT must have the administrator account
|
||||
enabled and must all share a common password.
|
||||
|
||||
1. Log into the WCAT Controller as administrator.
|
||||
2. Install wcat.msi on the machine to be used as a WCAT Controller.
|
||||
3. If any WCAT extension DLLs will be used, copy them to the WCAT installation
|
||||
directory. (typically c:\Program Files\WCAT)
|
||||
4. Open a command prompt; navigate to the WCAT installation directory.
|
||||
5. Run <20>cscript //H:Cscript<70>
|
||||
6. Run <20>wcat.wsf <20>terminate <20>update <20>clients {comma separated list of WCAT client
|
||||
machines}<7D> where the <20>clients<74> parameter accepts a comma separated list (no
|
||||
spaces) of the machines you plan on using as WCAT Client machines. Note: If
|
||||
the WCAT Controller machine will also be used as a WCAT Client, include
|
||||
<20>localhost<73> OR the name of the WCAT Controller machine in the list of clients.
|
||||
|
||||
NOTE: If WCAT has never been installed on the WCAT Client machines before,
|
||||
this will cause the machines to reboot.
|
||||
|
||||
Running WCAT
|
||||
1. Log into the WCAT Controller as administrator.
|
||||
2. Install wcat.msi on the machine to be used as a WCAT Controller.
|
||||
3. Open a command prompt, navigate to the WCAT installation directory (typically
|
||||
c:\Program Files\WCAT)
|
||||
4. Run <20>wcat.wsf <20>terminate <20>run <20>clients {comma separated client list} <20>t
|
||||
{scenario file} <20>f {settings file} <20>s {name of the Web Server} <20>singleip -x
|
||||
5. Output will be generated in the current directory, <20>log.xml<6D>. To change this,
|
||||
use the <20>-o<> flag. For more help on options to pass to wcat.wsf type
|
||||
<20>wcctl.exe -?<3F>
|
BIN
lib/wcat/doc/wcat.doc
Normal file
BIN
lib/wcat/doc/wcat.doc
Normal file
Binary file not shown.
1786
lib/wcat/report.xsl
Normal file
1786
lib/wcat/report.xsl
Normal file
File diff suppressed because it is too large
Load Diff
66
lib/wcat/samples/scripts/home.ubr
Normal file
66
lib/wcat/samples/scripts/home.ubr
Normal file
@@ -0,0 +1,66 @@
|
||||
scenario
|
||||
{
|
||||
name = "IIS Home Page";
|
||||
|
||||
warmup = 30;
|
||||
duration = 120;
|
||||
cooldown = 10;
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// All requests inherit the settings from the default request.
|
||||
// Defaults are overridden if specified in the request itself.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////
|
||||
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;
|
||||
}
|
||||
|
||||
//
|
||||
// This script is made for IIS7
|
||||
//
|
||||
transaction
|
||||
{
|
||||
id = "Default Web Site Homepage";
|
||||
weight = 1;
|
||||
|
||||
request
|
||||
{
|
||||
url = "/";
|
||||
statuscode = 200;
|
||||
}
|
||||
|
||||
request
|
||||
{
|
||||
url = "/welcome.png";
|
||||
statuscode = 200;
|
||||
}
|
||||
|
||||
//
|
||||
// specifically close the connection after both files are requested
|
||||
//
|
||||
close
|
||||
{
|
||||
method = reset;
|
||||
}
|
||||
}
|
||||
}
|
102
lib/wcat/samples/scripts/settings.ubr
Normal file
102
lib/wcat/samples/scripts/settings.ubr
Normal file
@@ -0,0 +1,102 @@
|
||||
settings
|
||||
{
|
||||
//--------------------------------------------------------------------------
|
||||
// General controller settings
|
||||
//
|
||||
// clientfile - specifies the client file, relative to working dir
|
||||
// server - host name of the webserver
|
||||
// virtualclients - number of 'threads' per physical client
|
||||
// clients - number of physical webcat client machines
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
// Example:
|
||||
//
|
||||
// clientfile = "ubr\lcw2.light.ubr";
|
||||
// server = "webserver";
|
||||
// clients = 10;
|
||||
// virtualclients = 100;
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Performance counters (pass '-x' option to wcctl.exe to enable)
|
||||
//
|
||||
// interval - polling interval in seconds (default=10)
|
||||
// host - host name of machine to monitor (default=webserver)
|
||||
// counter - path of counter to monitor
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
// Optional:
|
||||
//
|
||||
// Additional machines can be monitored by adding more counters blocks.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// counters {
|
||||
// host = "sqlserver"; // name of remote machine
|
||||
// interval = 5;
|
||||
// counter = "...";
|
||||
// }
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
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 Key Monitors (pass '-x' option to wcctl.exe to enable)
|
||||
//
|
||||
// path - registry path, relative to HKLM
|
||||
// name - name of registry key
|
||||
// type - type of value (REG_SZ | REG_DWORD)
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
// Optional:
|
||||
//
|
||||
// Additional registry keys can be monitored on the web server by
|
||||
// adding more registry blocks to this file. Note that simple strings and
|
||||
// dwords are all that webcat currently supports.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// registry {
|
||||
// path = "System\\CurrentControlSet\\Services\\Tcpip\\Parameters";
|
||||
// name = "DhcpDomain";
|
||||
// type = REG_SZ;
|
||||
// }
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
registry
|
||||
{
|
||||
path = "System\\CurrentControlSet\\Control\\FileSystem";
|
||||
name = "NtfsDisableLastAccessUpdate";
|
||||
type = REG_DWORD;
|
||||
}
|
||||
|
||||
registry
|
||||
{
|
||||
path = "System\\CurrentControlSet\\Services\\Tcpip\\Parameters";
|
||||
name = "SynAttackProtect";
|
||||
type = REG_DWORD;
|
||||
}
|
||||
}
|
14
lib/wcat/samples/src/precomp.h
Normal file
14
lib/wcat/samples/src/precomp.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef _PRECOMP_H
|
||||
#define _PRECOMP_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include <ws2tcpip.h>
|
||||
#include <mswsock.h>
|
||||
|
||||
#endif // _PRECOMP_H
|
186
lib/wcat/samples/src/viewstate.c
Normal file
186
lib/wcat/samples/src/viewstate.c
Normal file
@@ -0,0 +1,186 @@
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
#include "precomp.h"
|
||||
|
||||
#define MAX_VIEWSTATE (1024)
|
||||
#define VIEWSTATE "__VIEWSTATE"
|
||||
#define VIEWSTATE_LEN (10)
|
||||
#define MAX_TAG_NAME (128)
|
||||
|
||||
#define WCATRESULT_ERROR (-1)
|
||||
#define WCATRESULT_SUCCESS (0)
|
||||
#define WCATRESULT_MORE_DATA_NEEDED (1)
|
||||
#define WCATRESULT_NEXT_PACKET (2)
|
||||
|
||||
typedef enum _USER_STATE
|
||||
{
|
||||
UserStateFindViewState,
|
||||
UserStateFindValue,
|
||||
UserStateFindEqual,
|
||||
UserStateFindFirstQuote,
|
||||
UserStateGetValue,
|
||||
UserStateFinished
|
||||
} USER_STATE;
|
||||
|
||||
typedef struct _USER_DATA
|
||||
{
|
||||
USER_STATE state;
|
||||
char viewstate[MAX_VIEWSTATE];
|
||||
} USER_DATA, *PUSER_DATA;
|
||||
|
||||
BOOL WINAPI DllMain(
|
||||
IN HINSTANCE hinstDll,
|
||||
IN DWORD dwReason,
|
||||
IN LPVOID lpvContext
|
||||
)
|
||||
{
|
||||
switch( dwReason ) {
|
||||
|
||||
case DLL_PROCESS_ATTACH:
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DWORD GetViewstate(PVOID *context, DWORD argc, PCHAR argv[], PCHAR *result)
|
||||
{
|
||||
PUSER_DATA user;
|
||||
|
||||
if (*context == NULL)
|
||||
{
|
||||
*result = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
user = *context;
|
||||
|
||||
*result = user->viewstate;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD ResponseFilter(PVOID *context, DWORD argc, PCHAR argv[], PCHAR packet, ULONG_PTR len, ULONG_PTR sequence)
|
||||
{
|
||||
PCHAR buffer = packet;
|
||||
DWORD i = 0;
|
||||
PUSER_DATA user = NULL;
|
||||
|
||||
if (*context == NULL)
|
||||
{
|
||||
*context = calloc(1, sizeof(USER_DATA));
|
||||
|
||||
if (NULL == *context)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
user = *context;
|
||||
|
||||
if (sequence == 0)
|
||||
{
|
||||
user->state = UserStateFindViewState;
|
||||
user->viewstate[0] = '\0';
|
||||
}
|
||||
|
||||
//
|
||||
// fastpath for when we don't have any work to do
|
||||
//
|
||||
if (user->state == UserStateFinished)
|
||||
{
|
||||
return WCATRESULT_SUCCESS;
|
||||
}
|
||||
|
||||
while (len && *buffer)
|
||||
{
|
||||
switch (user->state)
|
||||
{
|
||||
case UserStateFindViewState:
|
||||
if (*buffer == '_')
|
||||
{
|
||||
if (len < VIEWSTATE_LEN)
|
||||
{
|
||||
return WCATRESULT_MORE_DATA_NEEDED;
|
||||
}
|
||||
|
||||
if (_strnicmp(buffer, VIEWSTATE, VIEWSTATE_LEN) == 0)
|
||||
{
|
||||
len -= VIEWSTATE_LEN-1;
|
||||
buffer += VIEWSTATE_LEN-1;
|
||||
|
||||
user->state = UserStateFindValue;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case UserStateFindValue:
|
||||
if (*buffer == 'v' || *buffer == 'V')
|
||||
{
|
||||
if (len < 5)
|
||||
{
|
||||
return WCATRESULT_MORE_DATA_NEEDED;
|
||||
}
|
||||
|
||||
if (_strnicmp(buffer, "value", 5) == 0)
|
||||
{
|
||||
len -= 4;
|
||||
buffer += 4;
|
||||
|
||||
user->state = UserStateFindEqual;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case UserStateFindEqual:
|
||||
if (*buffer == '=')
|
||||
{
|
||||
user->state = UserStateFindFirstQuote;
|
||||
}
|
||||
|
||||
break;
|
||||
case UserStateFindFirstQuote:
|
||||
if (*buffer == '"')
|
||||
{
|
||||
user->state = UserStateGetValue;
|
||||
}
|
||||
|
||||
break;
|
||||
case UserStateGetValue:
|
||||
i = 0;
|
||||
|
||||
for (i=0; len && *buffer && *buffer != '"'; i++, len--, buffer++)
|
||||
{
|
||||
if (i > MAX_VIEWSTATE)
|
||||
{
|
||||
return WCATRESULT_ERROR;
|
||||
}
|
||||
|
||||
user->viewstate[i] = *buffer;
|
||||
}
|
||||
|
||||
if (len == 0 || *buffer != '"')
|
||||
{
|
||||
return WCATRESULT_MORE_DATA_NEEDED;
|
||||
}
|
||||
|
||||
user->viewstate[i] = '\0';
|
||||
|
||||
user->state = UserStateFinished;
|
||||
break;
|
||||
case UserStateFinished:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
len--; buffer++;
|
||||
}
|
||||
|
||||
return WCATRESULT_SUCCESS;
|
||||
}
|
7
lib/wcat/samples/src/viewstate.def
Normal file
7
lib/wcat/samples/src/viewstate.def
Normal file
@@ -0,0 +1,7 @@
|
||||
; MYTESTSERVICE.def : declares the module parameters for the DLL.
|
||||
|
||||
LIBRARY "Viewstate"
|
||||
|
||||
EXPORTS
|
||||
GetViewstate
|
||||
ResponseFilter
|
9
lib/wcat/samples/src/wcat.h
Normal file
9
lib/wcat/samples/src/wcat.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef _WCAT_H
|
||||
#define _WCAT_H
|
||||
|
||||
#define WCATRESULT_ERROR (-1)
|
||||
#define WCATRESULT_SUCCESS (0)
|
||||
#define WCATRESULT_MORE_DATA_NEEDED (1)
|
||||
#define WCATRESULT_NEXT_PACKET (2)
|
||||
|
||||
#endif // define _WCAT_H
|
1134
lib/wcat/wcat.wsf
Normal file
1134
lib/wcat/wcat.wsf
Normal file
File diff suppressed because it is too large
Load Diff
BIN
lib/wcat/wcclient.exe
Normal file
BIN
lib/wcat/wcclient.exe
Normal file
Binary file not shown.
BIN
lib/wcat/wcctl.exe
Normal file
BIN
lib/wcat/wcctl.exe
Normal file
Binary file not shown.
BIN
lib/wcat/wcutil.exe
Normal file
BIN
lib/wcat/wcutil.exe
Normal file
Binary file not shown.
Reference in New Issue
Block a user