investigating apache benchmark failed request

前端 未结 3 1844
温柔的废话
温柔的废话 2021-02-03 17:46

I am just start using AB just today. Read couple of AB tutorial on new and thought give it a try for load testing my site.

After using it couple of time I got huge numbe

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-03 18:10

    Martin is correct. More helpfully, I ran a quick curl against our production servers:

    {user@staging:~}$ for i in `seq 1 10`; do curl -sk https://app.copperegg.com/login >    /tmp/lb$i.txt ; done
    {user@staging:~}$ wc /tmp/lb*
       74   239  3316 /tmp/lb1.txt
       74   239  3324 /tmp/lb10.txt
       74   239  3320 /tmp/lb2.txt
       74   239  3316 /tmp/lb3.txt
       74   239  3316 /tmp/lb4.txt
       74   239  3316 /tmp/lb5.txt
       74   239  3320 /tmp/lb6.txt
       74   239  3316 /tmp/lb7.txt
       74   239  3316 /tmp/lb8.txt
       74   239  3316 /tmp/lb9.txt
      740  2390 33176 total
    {user@staging:~}$ diff /tmp/lb1.txt /tmp/lb10.txt  
    7c7
    <   var g_time_offset = new Date().getTime() - 1318965621000;
    ---
    >   var g_time_offset = new Date().getTime() - 1318965622000;
    15c15
    < 
    ---
    > 
    23c23
    <   
    --- >
    {user@staging:~}$ diff /tmp/lb1.txt /tmp/lb2.txt 7c7 < var g_time_offset = new Date().getTime() - 1318965621000; --- > var g_time_offset = new Date().getTime() - 1318965622000; 9,10c9,10 < < --- > > 15c15 < --- > 23c23 <
    --- >
    {user@staging:~}$

    Notice that we're seeing a "content" string that has a nice ugly string of characters. Notice that the '/' character is in the "form" line, but in the "meta" line, it's replaced with "/". This accounts for the 4 or 8 character difference between my request lengths.

    It's irritating that apachebench isn't smart able to account for this, but at least we can see the cause.

提交回复
热议问题