lost and found ( for me ? )

varnish-perf : web stress tool

varnish-perf is http benchmark tools.
With this tool , it seems that we can emulate multiple src IPs and use multiple cores to generate http traffic.
http://code.google.com/p/varnish-perf/

- install varnish-perf on Ubuntu 12.04 64bit

# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.1 LTS
Release:        12.04
Codename:       precise

# uname -ri
3.2.0-34-generic x86_64

# gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3


install git if you have not installed it.
# apt-get install -y git

# git clone https://code.google.com/p/varnish-perf/
Cloning into 'varnish-perf'...
remote: Counting objects: 513, done.
remote: Finding sources: 100% (513/513), done.
remote: Total 513 (delta 339)
Receiving objects: 100% (513/513), 115.53 KiB, done.
Resolving deltas: 100% (339/339), done.

# cd varnish-perf/

# ls
humanize_number.c  mkdep      varnishperf.c  vcallout.h  vlck.h
humanize_number.h  README.md  vas.c          vct.c       vqueue.h
Makefile           stats.h    vas.h          vct.h       vsb.c
miniobj.h          steps.h    vcallout.c     vlck.c      vsb.h


build varnish-perf
# make depend
# make


options
# ./varnishperf
[INFO] Set Default for connect_timeout = 3
[INFO] Set Default for diag_bitmap = 0
[INFO] Set Default for linger = off
[INFO] Set Default for read_timeout = 6
[INFO] Set Default for sess_workspace = 4096
[INFO] Set Default for write_timeout = 6
[ERROR] No URLs found.
[INFO] usage: varnishperf [options] urlfile
[INFO]    -c N                         # Limits total TCP connections
[INFO]    -C N                         # Sets request number per a conn
[INFO]    -m N                         # Limits concurrent TCP connections
[INFO]    -p param=value               # set parameter
[INFO]    -r N                         # Sets rate
[INFO]    -s file                      # Sets file path containing src IP
[INFO]    -t N                         # Sets number of threads
[INFO]    -z                           # Shows all statistic fields


varnish-perf ( eth0 192.168.10.205 , eth0:0 206 , eth0:1 207 ) Apache ( 192.168.10.14 )

make HTTP requests file
# cat url_lists.txt
url -connect "192.168.10.14:80" -url "/"  -req "GET"


configure 192.168.10.206 ,207 as IP alias
# ifconfig eth0:0 192.168.10.206
# ifconfig eth0:0 192.168.10.207

# ifconfig eth0 | grep 'inet addr'
         inet addr:192.168.10.205  Bcast:192.168.10.255  Mask:255.255.255.0
# ifconfig eth0:0 | grep 'inet addr'
         inet addr:192.168.10.206  Bcast:192.168.10.255  Mask:255.255.255.0
# ifconfig eth0:1 | grep 'inet addr'
         inet addr:192.168.10.207  Bcast:192.168.10.255  Mask:255.255.255.0


make src IP lists file
# cat srcip_list.txt
192.168.10.205
192.168.10.206
192.168.10.207


run varnishperf
nnn , error .. [ERROR] Unexpected error number: 97
HTTP requests have not been generated..
# ./varnishperf –s ./srcip_list.txt ./url_lists.txt
[INFO] Set Default for connect_timeout = 3
[INFO] Set Default for diag_bitmap = 0
[INFO] Set Default for linger = off
[INFO] Set Default for read_timeout = 6
[INFO] Set Default for sess_workspace = 4096
[INFO] Set Default for write_timeout = 6
[INFO] Reading "./srcip_list.txt" SRCIP file.
[INFO] Total 2 SRCIP are loaded from "./srcip_list.txt" file.
[INFO] Reading ./url_lists.txt URL file.
[INFO] Total 1 URLs are loaded from ./url_lists.txt file.
[STAT]  time    | total    | req    | conn           | connect time          | first byte time       | body time             | tx         | tx    | rx         | rx    | errors
[STAT]          |          |        | active   total |   min     avg     max |   min     avg     max |   min     avg     max |            |       |            |       |
[STAT] ---------+----------+--------+----------------+-----------------------+-----------------------+-----------------------+------------+-------+------------+-------+-------....
[STAT] 00:00:00 |        0 |      0 |     0 /      0 | 0.000 /    na / 0.000 | 0.000 /    na / 0.000 | 0.000 /    na / 0.000 |          0 |     0 |          0 |     0 | 0 / 0
[ERROR] Unexpected error number: 97


diagnose
 * diag_bitmap=N

   Bitmap controlling diagnostics code:

   * 0x00000001 - CNT_Session states.
   * 0x00000002 - socket error messages.

   Default value is 0.


CNT_Session states.
# ./varnishperf -s ./srcip_list.txt ./url_lists.txt -p diag_bitmap=0x00000001
[INFO] Set Default for connect_timeout = 3
[INFO] Set Default for diag_bitmap = 0
[INFO] Set Default for linger = off
[INFO] Set Default for read_timeout = 6
[INFO] Set Default for sess_workspace = 4096
[INFO] Set Default for write_timeout = 6
[INFO] Reading "./srcip_list.txt" SRCIP file.
[INFO] Total 3 SRCIP are loaded from "./srcip_list.txt" file.
[INFO] Reading ./url_lists.txt URL file.
[INFO] Total 1 URLs are loaded from ./url_lists.txt file.
[STAT]  time    | total    | req    | conn           | connect time          | first byte time       | body time             | tx         | tx    | rx         | rx    | errors
[STAT]          |          |        | active   total |   min     avg     max |   min     avg     max |   min     avg     max |            |       |            |       |
[STAT] ---------+----------+--------+----------------+-----------------------+-----------------------+-----------------------+------------+-------+------------+-------+-------....
[STAT] 00:00:00 |        0 |      0 |     0 /      0 | 0.000 /    na / 0.000 | 0.000 /    na / 0.000 | 0.000 /    na / 0.000 |          0 |     0 |          0 |     0 | 0 / 0
thr 0x7fa69736d700 STP_FIRST sp 0x7fa690000d18
thr 0x7fa69736d700 STP_START sp 0x7fa690000d18
thr 0x7fa69736d700 STP_HTTP_START sp 0x7fa690000d18
thr 0x7fa69736d700 STP_HTTP_WAIT sp 0x7fa690000d18
[ERROR] Unexpected error number: 97


socket error messages.
# ./varnishperf -s ./srcip_list.txt ./url_lists.txt -p diag_bitmap=0x00000002
[INFO] Set Default for connect_timeout = 3
[INFO] Set Default for diag_bitmap = 0
[INFO] Set Default for linger = off
[INFO] Set Default for read_timeout = 6
[INFO] Set Default for sess_workspace = 4096
[INFO] Set Default for write_timeout = 6
[INFO] Reading "./srcip_list.txt" SRCIP file.
[INFO] Total 3 SRCIP are loaded from "./srcip_list.txt" file.
[INFO] Reading ./url_lists.txt URL file.
[INFO] Total 1 URLs are loaded from ./url_lists.txt file.
[STAT]  time    | total    | req    | conn           | connect time          | first byte time       | body time             | tx         | tx    | rx         | rx    | errors
[STAT]          |          |        | active   total |   min     avg     max |   min     avg     max |   min     avg     max |            |       |            |       |
[STAT] ---------+----------+--------+----------------+-----------------------+-----------------------+-----------------------+------------+-------+------------+-------+-------....
[STAT] 00:00:00 |        0 |      0 |     0 /      0 | 0.000 /    na / 0.000 | 0.000 /    na / 0.000 | 0.000 /    na / 0.000 |          0 |     0 |          0 |     0 | 0 / 0
[ERROR] Unexpected error number: 97
[ERROR] bind(2) with 192.168.10.205 error: 97 Address family not supported by protocol
[STAT] 00:00:01 |        0 |      0 |     0 /      1 |    na /    na /    na |    na /    na /    na |    na /    na /    na |          0 |     0 |          0 |     0 | 0 / 0
[ERROR] Unexpected error number: 97
[ERROR] bind(2) with 192.168.10.206 error: 97 Address family not supported by protocol
[STAT] 00:00:02 |        0 |      0 |     0 /      1 |    na /    na /    na |    na /    na /    na |    na /    na /    na |          0 |     0 |          0 |     0 | 0 / 0
[ERROR] Unexpected error number: 97
[ERROR] bind(2) with 192.168.10.207 error: 97 Address family not supported by protocol


nnn , I can not find the root cause on this…

when I used one src IP ( remove –s option ) instead of multiple src IPs , I was able to run varnish-perf
# ./varnishperf  ./url_lists.txt -p diag_bitmap=0x00000002
[INFO] Set Default for connect_timeout = 3
[INFO] Set Default for diag_bitmap = 0
[INFO] Set Default for linger = off
[INFO] Set Default for read_timeout = 6
[INFO] Set Default for sess_workspace = 4096
[INFO] Set Default for write_timeout = 6
[INFO] Reading ./url_lists.txt URL file.
[INFO] Total 1 URLs are loaded from ./url_lists.txt file.
[STAT]  time    | total    | req    | conn           | connect time          | first byte time       | body time             | tx         | tx    | rx         | rx    | errors
[STAT]          |          |        | active   total |   min     avg     max |   min     avg     max |   min     avg     max |            |       |            |       |
[STAT] ---------+----------+--------+----------------+-----------------------+-----------------------+-----------------------+------------+-------+------------+-------+-------....
[STAT] 00:00:00 |        0 |      0 |     0 /      0 | 0.000 /    na / 0.000 | 0.000 /    na / 0.000 | 0.000 /    na / 0.000 |          0 |     0 |          0 |     0 | 0 / 0
[STAT] 00:00:01 |        1 |      1 |     0 /      1 | 0.002 / 0.002 / 0.002 | 0.001 / 0.001 / 0.001 | 0.000 / 0.000 / 0.000 |         37 |    37 |        500 |   500 | 0 / 0
[STAT] 00:00:02 |        2 |      1 |     0 /      1 | 0.001 / 0.001 / 0.001 | 0.001 / 0.001 / 0.001 | 0.000 / 0.000 / 0.000 |         37 |    37 |        500 |   500 | 0 / 0
[STAT] 00:00:03 |        3 |      1 |     0 /      1 | 0.001 / 0.001 / 0.001 | 0.001 / 0.001 / 0.001 | 0.000 / 0.000 / 0.000 |         37 |    37 |        500 |   500 | 0 / 0
^C[STAT] ---------+----------+--------+----------------+-----------------------+-----------------------+-----------------------+------------+-------+------------+-------+-------....
[STAT] Summary:
[STAT]    1                    threads    g # N worker threads
[STAT]    4                    reqs       c # N requests
[STAT]    4                    reqs       c # Successful HTTP request
[STAT]    4                    conns      c # Total TCP connected
[STAT]    2000                 bytes      c # Total bytes varnishperf got
[STAT]    148                  bytes      c # Total bytes varnishperf send
[STAT]    0.004668             seconds    c # Total time used for connect(2)
[STAT]    0.003974             seconds    c # Total time used for waiting the first byte after sending HTTP request
[STAT]    0.000032             seconds    c # Total time used for receiving the body
[STAT]    4                    times      c # straight response with Content-Length
[STAT]    4                    times      c # HTTP response status for 4XX


Regarding socket error when specifying multiple Src IPs , I’ll look into the root cause when I have time.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.