RE: [OpenSTA-devel] Duration of the viewstate encoding
Brought to you by:
dansut
|
From: Hewett, C. J <cha...@in...> - 2005-05-17 17:38:20
|
Hello,
I haven't done much work with OpenSTA lately, but at some point, I did
create a new function in OpenSTA. Some things may have changed since
3-4 years ago, but I saved a description of the steps I took to add a
new function to SCL. It's quite a few steps, but most of them are
simple. The hardest part was trying to figure out files in which I
needed to make changes--hopefully this helps with that... Please see
below.
The following are instructions for adding an integer function to SCL.
The example here is specifically the steps to create an integer function
NEG_EXP_DIST.
1) Modify the parse source file.
File: ..\scl\scl_sub_tbl.tpa
What to do: Add the following code to function INTEGER_FUNC to add
support for another function:
PSL$TRAN !NEG_EXP_DIST_FUNC, PSLTPA_EXIT
Create the function subexpression (e.g. NEG_EXP_DIST_FUNC). Look at the
LOCATE_FUNC for example. Remember that the number of parameters may be
different, as well as the parameter data type.
2) Define the new functions used in NEG_EXP_DIST_FUNC.
File: ..\scl\scl_sub_tbl_rtndef.h
What to do: Specify the two new functions.
unsigned long INI_NEG_EXP_DIST (struct tpaarg *);
unsigned long SAVE_FNC_NEG_EXP_DIST (struct tpaarg *);
File: ..\scl\scl_sav_routines.c
What to do: Create SAVE_FNC_NEG_EXP_DIST based on SAVE_FNC_LOCATE.
File: ..\scl\scl_ini_routines.c
What to do: Create INI_NEG_EXP_DIST based on (exactly copy of)
INI_LOCATE.
3) Define TOF_FNCID_NEG_EXP_DIST variable used in SAVE_FNC_NEG_EXP_DIST
function in scl_sav_routines.c.
File: ..\include\tofprmdef.h
What to do: Add/change the following definitions:
#define TOF_FNCID_NEG_EXP_DIST 3 // 2+1 to account for the new
function
static char *TOF_FNCNAM[] =3D {
"Illegal function",
"~LOCATE",
"~EXTRACT",
"~NEG_EXP_DIST"};
4) Define the runtime functions.
File: ..\TestProcess\Common\Base\CECTofTxt.h
What to do: Add the following definitions of the functions:
bool _evaluateFncNegExpDist(TContext& ctxt,
list<CECOperand>::const_iterator* itP,
string* resstrP) const;
bool _psFncNegExpDist (const string& inStr, int* pos, const bool updpos
=3D true);
File: ..\TestProcess\Common\Base\CECTofTxt.cpp
What to do: Add the following code to the switch statement in
function _evaluateOpd:
case fnc_negexpdist: // ~NEG_EXP_DIST function
{
_evaluateFncNegExpDist(ctxt, itP, &fncVal);
break;
}
Create _evaluateFncNegExpDist based on CECTofTxt::_evaluateFncLocate.
Add the following statement to CECTofTxt::_psIntFnc:
if (_psFncNegExpDist(inStr, pos, updpos)) return true;
Create _psFncNegExpDist based on
CECTofTxt::_psFncLocate.
Define the ps_fnc_negexpdist variable used in the _psFncNegExpDist
function:
const string ps_fnc_ negexpdist =3D "~NEG_EXP_DIST"; // Function
~NEG_EXP_DIST
5) Modify code to create a null operand object.
File: ..\TestProcess\Common\Base\CECOperand.h
What to do: Add the following code to the switch statement in the
CECOperand constructor:
case fnc_negexpdist:
_dTyp =3D dtyp_integer;
break;
6) For diagnostic purposes, modify two files.=20
File: ..\TestProcess\Common\Base\CECOperand.h
What to do: Modify the following code to include the new function:
enum FncCode {fnc_none, fnc_negexpdist, fnc_locate, fnc_extract};
File: CECOperand.cpp
What to do: Add the following code to the switch statement:
case fnc_negexpdist:
val_fnc =3D "~NegExpDist";
break;
7) Rebuild the Architecture and HTTP directories and create a new .msi
installer file.
Thanks,
-Charlie
-----Original Message-----
From: ope...@li...
[mailto:ope...@li...] On Behalf Of Thierry
Boullet
Sent: Tuesday, May 17, 2005 6:09 AM
To: ope...@li...
Subject: [OpenSTA-devel] Duration of the viewstate encoding
Hi,
I made some measurements of the duration of the viewstate encoding=20
because I noted that it is not negligible and that it can disturb the
tests.
I used 3 versions of OpenSTA :
OSTA142 : Release 1.4.2
OSTA143 : Release 1.4.3
MYOSTA : based on release 1.4.3 and built with VC++ 6 SP6, Platform=20
SDK February 2003, CodeMax 2.1.0.22,
OmniORB 3.0.4, SizeCBar 2.44, STLPort 4.6 and=20
ucd-snmp 4.2.6.
I used 2 methods of encoding and 2 types of viewstate (resulting from an
application which I tested) to make measurements:
METHOD1 : This is the method described in the FAQ of OpenSTA
************************************************************************
**
SUBROUTINE URLENCODE [ SB_URL ]
CONTINUE1:
Set SB_INDEX =3D ~LOCATE("+",SB_URL)
IF (SB_INDEX<>-1) THEN
Set SB_INDEX2 =3D SB_INDEX + 1
Set SB_URL =3D ~EXTRACT(0,SB_INDEX,SB_URL) + "%2B" &
+ ~EXTRACT(SB_INDEX2,65500,SB_URL)
goto CONTINUE1
ENDIF
CONTINUE2:
Set SB_INDEX =3D ~LOCATE("/",SB_URL)
IF (SB_INDEX<>-1) THEN
Set SB_INDEX2 =3D SB_INDEX + 1
Set SB_URL =3D ~EXTRACT(0,SB_INDEX,SB_URL) + "%2F" &
+ ~EXTRACT(SB_INDEX2,65500,SB_URL)
goto CONTINUE2
ENDIF
CONTINUE3:
Set SB_INDEX =3D ~LOCATE("=3D",SB_URL)
IF (SB_INDEX<>-1) THEN
Set SB_INDEX2 =3D SB_INDEX + 1
Set SB_URL =3D ~EXTRACT(0,SB_INDEX,SB_URL) + "%3D" &
+ ~EXTRACT(SB_INDEX2,65500,SB_URL)
goto CONTINUE3
ENDIF
END SUBROUTINE
************************************************************************
**
METHOD2 : This is the method which I use.
************************************************************************
**
SUBROUTINE FORM_URL_ENCODE [ STR_TO_ENC ]
SET STR_LENGTH =3D ~LENGTH(STR_TO_ENC)
SET STR_TMP =3D ""
=20
LOOP_PLUS:
SET STR_OFFSET =3D ~LOCATE("+",STR_TO_ENC)
IF (STR_OFFSET <> -1) THEN
SET STR_TMP =3D STR_TMP + ~LEFTSTR(STR_OFFSET, STR_TO_ENC) + =
"%2B"
SET STR_LENGTH =3D STR_LENGTH - STR_OFFSET -1
SET STR_TO_ENC =3D ~RIGHTSTR (STR_LENGTH, STR_TO_ENC)
GOTO LOOP_PLUS
ENDIF
IF (STR_TMP <> "") THEN
SET STR_TO_ENC =3D STR_TMP + STR_TO_ENC
ENDIF
=20
SET STR_LENGTH =3D ~LENGTH(STR_TO_ENC)
SET STR_TMP =3D ""
=20
LOOP_SLASH:
SET STR_OFFSET =3D ~LOCATE("/",STR_TO_ENC)
IF (STR_OFFSET <> -1) THEN
SET STR_TMP =3D STR_TMP + ~LEFTSTR(STR_OFFSET, STR_TO_ENC) + =
"%2F"
SET STR_LENGTH =3D STR_LENGTH - STR_OFFSET -1
SET STR_TO_ENC =3D ~RIGHTSTR (STR_LENGTH, STR_TO_ENC)
GOTO LOOP_SLASH
ENDIF
IF (STR_TMP <> "") THEN
SET STR_TO_ENC =3D STR_TMP + STR_TO_ENC
ENDIF =20
SET STR_LENGTH =3D ~LENGTH(STR_TO_ENC)
SET STR_TMP =3D ""
=20
LOOP_EQUAL:
SET STR_OFFSET =3D ~LOCATE("=3D",STR_TO_ENC)
IF (STR_OFFSET <> -1) THEN
SET STR_TMP =3D STR_TMP + ~LEFTSTR(STR_OFFSET, STR_TO_ENC) + =
"%3D"
SET STR_LENGTH =3D STR_LENGTH - STR_OFFSET -1
SET STR_TO_ENC =3D ~RIGHTSTR (STR_LENGTH, STR_TO_ENC)
GOTO LOOP_EQUAL
ENDIF
IF (STR_TMP <> "") THEN
SET STR_TO_ENC =3D STR_TMP + STR_TO_ENC
ENDIF =20
=20
END SUBROUTINE
************************************************************************
**
VIEWSTATE1 :
Size before encoding : 62936
1203 '+', 2 '/', 2 '=3D'
Size after encoding : 65350
VIEWSTATE2 :
Size before encoding : 64928
233 '+', 1 '/', 0 '=3D'
Size after encoding : 65396
My configuration :
Pentium 4, 2,66 GHz
RAM 512 Mo
OS : Windows XP Pro SP2
Results (duration of encoding for 1 VU) :
VIEWSTATE1 with METHOD1 :
- OSTA142 and OSTA143 : 6,5 s
- MYOSTA : 3,3 s
VIEWSTATE1 with METHOD2 :
- OSTA142 and OSTA143 : 5,3 s
- MYOSTA : 2,7 s
VIEWSTATE2 with METHOD1 :
- OSTA142 and OSTA143 : 1,3 s
- MYOSTA : 0,5 s
VIEWSTATE2 with METHOD2 :
- OSTA142 and OSTA143 : 1,15 s
- MYOSTA : 0,6 s
I took voluntarily large viewstate for measurements. (Like Antony=20
Marcano said within his article, applications with viewstate too large=20
should be interpreted as an early warning of some potentially serious=20
performance issues.) Even with smaller viewstate I noted than the total=20
duration of the coding of several viewstate in a script is not=20
negligible and appreciably increases the execution time of a script.
METHOD2 is a little faster than METHOD1.
The version MYOSTA is almost twice faster than Releases 1.4.2/1.4.3. The
differences seem to be the PSDK and STLport.
During the tests, I used for each measurement the same repository, the=20
same scripts and the same configuration of OpenSTA.
It would be interesting to confirm these results in order to use the=20
versions of the products which improve the speed of OpenSTA.
In any event I think that it is necessary to add an SCL command which=20
encode a string to the format "x-www-form-urlencoded".
This coding is typical to provide variables to a POST request (viewstate
or others).
I think that a native command would be much faster than a SCL
subroutine.
I can develop this functionality. I would wish to know if somebody knows
the method to add a new SCL command or if other possibilities can be=20
considered.
Any suggestions?
Thierry
Thierry Boullet
www.kereval.com
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=3D7412&alloc_id=3D16344&op=3Dclick
_______________________________________________
OpenSTA-devel mailing list
Ope...@li...
https://lists.sourceforge.net/lists/listinfo/opensta-devel
|