[httperf] How to set Cookies?

Martin Arlitt arlitt at hpl.hp.com
Fri Nov 26 07:02:56 PST 2004


Paula

httperf doesn't allow you to specify the cookie, but it does allow you to
use the cookie the server assigns.  to do this, use the --session-cookie
option.  here is the description of that option (from the man page):

       --session-cookie
              When this option is turned on, cookie managment  is
              enabled on a per-session basis.  What this means is
              that if a reply to a request that was generated  by
              session  X  contains  a  cookie,  then  all  future
              requests sent by session X will include this cookie
              as well.  At present, the cookie manager in httperf
              supports only one cookie per session.  If a  second
              cookie  is  received, the new cookie overwrites the
              existing one and a warning message  is  printed  if
              ``--debug 1'' is on.

the following command will generate two sessions to the server
cars.kelkoo.co.uk.

$ bin/httperf --server=cars.kelkoo.co.uk --wsesslog=2,0,kelkoo_session.txt --session-cookie --print-request=header --print-reply=header > kelkoo.out

the first parameter to --wsesslog is the number of sessions to
generate.  for this example, 2 sessions are generated. the second
parameter is the default think time (in this case 0), if you do not
specify the think time in the input file.  the third parameter is the
name of the input file, which includes the definitions of one or more
sessions.  if you try to generate more sessions than are defined in
the input file, httperf will loop through the defined sessions.

the urls requested in each session are identical, because I have only
defined one session in the session file (kelkoo_session.txt).  each
session consists of three requests (this is the contents of
kelkoo_session.txt):

/b/a/c_172601_cars_motors.html think=5.0
/b/a/sbs/173101/9147353.html think=7.0
/b/a/sbs/173601/10496800.html

because I did not specify the rate at which new sessions are to be
generated, the sessions are generated sequentially (i.e., the second
starts after the first completes).  to change this you can use the
--rate option (please refer to the man page for more information).

I used the --print-request and --print-reply options to observe the
cookie behaviour.  if I were using httperf for a stress test, I would
not use these options.  the man page gives a thorough description of
how to interpret the output associated with these options.  for now,
all you need to know is that SH0 lines are the headers for the initial
request, RH0 the headers for the initial response, SH1 for the second
request, and so on.

the first session includes requests SH0, SH1, and SH2.  if you look
through the SH0 lines you'll see that no cookie is sent.  thus, the
server issues a Set-Cookie header in the RH0 lines.  httperf then
includes that cookie in the remaining requests in this session (SH1
and SH2).  The second session is made up of requests SH3, SH4 and SH5.
If you look at these headers and the associated response headers you
will see that no cookie is included with SH3, so the server again
issues a Set-Cookie header.  httperf then includes this cookie with
SH4 and SH5.

httperf --print-reply=header --print-request=header --client=0/1 --server=cars.kelkoo.co.uk --port=80 --uri=/ --send-buffer=4096 --recv-buffer=16384 --session-cookies --wsesslog=2,0.000,kelkoo_session.txt
SH0:GET /b/a/c_172601_cars_motors.html HTTP/1.1
SH0:User-Agent: httperf/0.8
SH0:Host: cars.kelkoo.co.uk
SH0:
SS0: header 97 content 0
RH0:HTTP/1.1 200 OK
RH0:Date: Fri, 26 Nov 2004 14:41:53 GMT
RH0:Server: Apache/1.3.27 (Unix) ApacheJServ/1.1.2
RH0:P3P: CP="NOI DSP CURa ADMa DEVa PSAa PSDa OUR IND UNI",policyref="http://www.kelkoo.co.uk/w3c/p3p.xml"
RH0:Set-Cookie: JServSessionIduk=ksz8hv9qw1.CH2uk; domain=.kelkoo.co.uk; path=/
RH0:Transfer-Encoding: chunked
RH0:Content-Type: text/html
RH0:
RS0: header 338 content 31774 footer 2
SH1:GET /b/a/sbs/173101/9147353.html HTTP/1.1
SH1:User-Agent: httperf/0.8
SH1:Host: cars.kelkoo.co.uk
SH1:Cookie: JServSessionIduk=ksz8hv9qw1.CH2uk
SH1:
SS1: header 138 content 0
RH1:HTTP/1.1 200 OK
RH1:Date: Fri, 26 Nov 2004 14:41:59 GMT
RH1:Server: Apache/1.3.27 (Unix) ApacheJServ/1.1.2
RH1:P3P: CP="NOI DSP CURa ADMa DEVa PSAa PSDa OUR IND UNI",policyref="http://www.kelkoo.co.uk/w3c/p3p.xml"
RH1:Transfer-Encoding: chunked
RH1:Content-Type: text/html
RH1:
RS1: header 261 content 57438 footer 2
SH2:GET /b/a/sbs/173601/10496800.html HTTP/1.1
SH2:User-Agent: httperf/0.8
SH2:Host: cars.kelkoo.co.uk
SH2:Cookie: JServSessionIduk=ksz8hv9qw1.CH2uk
SH2:
SS2: header 139 content 0
SH2:GET /b/a/sbs/173601/10496800.html HTTP/1.1
SH2:User-Agent: httperf/0.8
SH2:Host: cars.kelkoo.co.uk
SH2:Cookie: JServSessionIduk=ksz8hv9qw1.CH2uk
SH2:
SS2: header 139 content 0
RH2:HTTP/1.1 200 OK
RH2:Date: Fri, 26 Nov 2004 14:42:07 GMT
RH2:Server: Apache/1.3.27 (Unix) ApacheJServ/1.1.2
RH2:P3P: CP="NOI DSP CURa ADMa DEVa PSAa PSDa OUR IND UNI",policyref="http://www.kelkoo.co.uk/w3c/p3p.xml"
RH2:Transfer-Encoding: chunked
RH2:Content-Type: text/html
RH2:
RS2: header 261 content 117453 footer 2
SH3:GET /b/a/c_172601_cars_motors.html HTTP/1.1
SH3:User-Agent: httperf/0.8
SH3:Host: cars.kelkoo.co.uk
SH3:
SS3: header 97 content 0
RH3:HTTP/1.1 200 OK
RH3:Date: Fri, 26 Nov 2004 14:42:10 GMT
RH3:Server: Apache/1.3.27 (Unix) ApacheJServ/1.1.2
RH3:P3P: CP="NOI DSP CURa ADMa DEVa PSAa PSDa OUR IND UNI",policyref="http://www.kelkoo.co.uk/w3c/p3p.xml"
RH3:Set-Cookie: JServSessionIduk=geobc49r51.CO1uk; domain=.kelkoo.co.uk; path=/
RH3:Transfer-Encoding: chunked
RH3:Content-Type: text/html
RH3:
RS3: header 338 content 31765 footer 2
SH4:GET /b/a/sbs/173101/9147353.html HTTP/1.1
SH4:User-Agent: httperf/0.8
SH4:Host: cars.kelkoo.co.uk
SH4:Cookie: JServSessionIduk=geobc49r51.CO1uk
SH4:
SS4: header 138 content 0
RH4:HTTP/1.1 200 OK
RH4:Date: Fri, 26 Nov 2004 14:42:15 GMT
RH4:Server: Apache/1.3.27 (Unix) ApacheJServ/1.1.2
RH4:P3P: CP="NOI DSP CURa ADMa DEVa PSAa PSDa OUR IND UNI",policyref="http://www.kelkoo.co.uk/w3c/p3p.xml"
RH4:Transfer-Encoding: chunked
RH4:Content-Type: text/html
RH4:
RS4: header 261 content 57441 footer 2
SH5:GET /b/a/sbs/173601/10496800.html HTTP/1.1
SH5:User-Agent: httperf/0.8
SH5:Host: cars.kelkoo.co.uk
SH5:Cookie: JServSessionIduk=geobc49r51.CO1uk
SH5:
SS5: header 139 content 0
SH5:GET /b/a/sbs/173601/10496800.html HTTP/1.1
SH5:User-Agent: httperf/0.8
SH5:Host: cars.kelkoo.co.uk
SH5:Cookie: JServSessionIduk=geobc49r51.CO1uk
SH5:
SS5: header 139 content 0
RH5:HTTP/1.1 200 OK
RH5:Date: Fri, 26 Nov 2004 14:42:23 GMT
RH5:Server: Apache/1.3.27 (Unix) ApacheJServ/1.1.2
RH5:P3P: CP="NOI DSP CURa ADMa DEVa PSAa PSDa OUR IND UNI",policyref="http://www.kelkoo.co.uk/w3c/p3p.xml"
RH5:Transfer-Encoding: chunked
RH5:Content-Type: text/html
RH5:
RS5: header 261 content 117456 footer 2
Maximum connect burst length: 1

Total: connections 4 requests 8 replies 6 test-duration 35.307 s

Connection rate: 0.1 conn/s (8826.8 ms/conn, <=2 concurrent connections)
Connection time [ms]: min 2937.2 avg 8826.8 max 13773.5 median 5121.5 stddev 5612.1
Connection time [ms]: connect 134.7
Connection length [replies/conn]: 1.500

Request rate: 0.2 req/s (4413.4 ms/req)
Request size [B]: 163.0

Reply rate [replies/s]: min 0.0 avg 0.1 max 1.0 stddev 0.4 (35 samples)
Reply time [ms]: response 338.6 transfer 1456.0
Reply size [B]: header 286.0 content 68887.0 footer 2.0 (total 69175.0)
Reply status: 1xx=0 2xx=6 3xx=0 4xx=0 5xx=0

CPU time [s]: user 11.28 system 24.03 (user 31.9% system 68.1% total 100.0%)
Net I/O: 11.5 KB/s (0.1*10^6 bps)

Errors: total 2 client-timo 0 socket-timo 0 connrefused 0 connreset 2
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0

Session rate [sess/s]: min 0.00 avg 0.06 max 1.00 stddev 0.17 (2/2)
Session: avg 2.00 connections/session
Session lifetime [s]: 17.7
Session failtime [s]: 0.0
Session length histogram: 0 0 0 2

I hope this helps.  please note that currently httperf does not
support multiple cookies per session, nor does it support issuing
requests to multiple servers within the same session.  these
functionalities would require modifications to httperf.

Martin


On Fri, 26 Nov 2004, Paula Rincon wrote:

> Hi all,
> As I understood, httperf supports cookies; could you please send me an
> example to launch httperf with several sessions and a cookie associated
> to each session?
> Thanks
> Paula
>
> >
> >
>
> _______________________________________________
> httperf mailing list
> httperf at linux.hpl.hp.com
> http://www.hpl.hp.com/hosted/linux/mail-archives/httperf/
>


More information about the httperf mailing list