How to run benchmark.py for cherrypy http server?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to run benchmark.py for cherrypy http server?

vizcayno

Hi:
In folder cherrypy/test (for cp3.0 and py25), we have the python script
"benchmark.py."
Is there a way to test the performance of cherrypy http server instead
of the apache one?
I executed the next:

python benchmark.py
.......................and got next output:
Starting CherryPy app server...
Started in 1.21799993515 seconds

Client Thread Report (1000 requests, 14 byte response body, 10 server
threads):

but then it hangs and I can not get the numerical results; when I go to
IE browser and type the address http://localhost:8080/, error "the page
cannot be displayed" issues.
What am i doing wrong?
Regards.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How to run benchmark.py for cherrypy http server?

Robert Brewer

vizcayno wrote:
> In folder cherrypy/test (for cp3.0 and py25), we have the python script
> "benchmark.py."
> Is there a way to test the performance of cherrypy http server instead
> of the apache one?

Er... by default, you are testing the CherryPy HTTP server. There's a
command-line flag to test the Apache server.

But more importantly, you must have the "ab" tool from Apache
installed. This is used on the client side to do the testing.

> I executed the next:
>
> python benchmark.py
> .......................and got next output:
> Starting CherryPy app server...
> Started in 1.21799993515 seconds
>
> Client Thread Report (1000 requests, 14 byte response body, 10 server
> threads):
>
> but then it hangs and I can not get the numerical results; when I go to
> IE browser and type the address http://localhost:8080/, error "the page
> cannot be displayed" issues.

It really hangs? Or just exits? If you don't have "ab" installed, it
just exits (it shouldn't, but it does at the moment--I'm working on a
fix).


Robert Brewer
System Architect
Amor Ministries
[hidden email]


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How to run benchmark.py for cherrypy http server?

vizcayno

Robert:
Thanks for your attention, time and your guidelines.
I am working on WIN XP SP2. From the cmd.exe I invoke benchmark.py and
it does not exit, it hangs; i.e. when I press CTRL-C (e.g.after 15
minutes) it does not respond, I must close the cmd.exe window to finish
all. I repeated this action many times with the same result, I also
rebooted my machine.
I did an experiment, I ran ORACLE Express browser which uses the same
port (8080); when the port is used by another application and I execute
benchmark.py, after a few seconds or when I press CTRL-C, the program
exits:
    % cd C:\Python25\Lib\site-packages\cherrypy\test
    % python benchmark.py
    Starting CherryPy app server...
    %

Incidentally, I did not understand well about "ab", Should I install it
despite  I am not using Apache for the test?
Thanks again.

Vizcayno


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How to run benchmark.py for cherrypy http server?

vizcayno

Robert:
I got "ab" program from Apache site (my intention was never to use
Apache so, I beg your pardon if I get confussed with the command) and
ran it in one cmd.exe session; previously I executed benchmark.py on a
second cmd.exe session. I show you the results:

benchmark.py
==========
.cd C:\Python25\Lib\site-packages\cherrypy\test

.python benchmark.py
Starting CherryPy app server...
Started in 1.14100003242 seconds

Client Thread Report (1000 requests, 14 byte response body, 10 server
threads):

threads | Completed | Failed | req/sec | msec/req | KB/sec |
     10 |      1000 |      0 |  421.05 |    2.375 |  66.95 |
     20 |      1000 |      0 |  415.58 |    2.406 |  66.08 |
     30 |      1000 |      0 |  407.64 |    2.453 |  64.82 |
     40 |      1000 |      0 |  349.73 |    2.859 |  55.61 |
     50 |      1000 |      0 |  402.52 |    2.484 |  64.00 |

Client Thread Report (1000 requests, 14 bytes via staticdir, 10 server
threads):


threads | Completed | Failed | req/sec | msec/req | KB/sec |
     10 |      1000 |      0 |  280.70 |    3.563 |  57.54 |
     20 |      1000 |      0 |  290.91 |    3.438 |  59.35 |
     30 |      1000 |      0 |  285.71 |    3.500 |  58.29 |
     40 |      1000 |      0 |  288.29 |    3.469 |  58.81 |
     50 |      1000 |      0 |  259.11 |    3.859 |  52.86 |

Size Report (1000 requests, 50 client threads, 10 server threads):

    bytes | Completed | Failed | req/sec | msec/req |   KB/sec |
       10 |      1000 |      0 |  338.62 |    2.953 |    52.49 |
      100 |      1000 |      0 |  335.08 |    2.984 |    81.76 |
     1000 |      1000 |      0 |  290.91 |    3.438 |   326.98 |
    10000 |      1000 |      0 |  304.76 |    3.281 |  3021.41 |
   100000 |      1000 |      0 |  181.82 |    5.500 | 17782.73 |
100000000 |      1000 |      1 |  112.87 |    8.859 | 11094.46 |


ab.exe
=====
.ab.exe -n 1000 http://localhost:8080/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd,
http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
apr_socket_recv: An existing connection was forcibly closed by the
remote host.
  (730054)
Total of 96 requests completed

.ab.exe -n 1000 http://localhost:8080/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd,
http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
apr_socket_recv: An existing connection was forcibly closed by the
remote host.
  (730054)

.ab.exe -n 1000 http://localhost:8080/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd,
http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 100 requests
apr_socket_recv: An existing connection was forcibly closed by the
remote host.
  (730054)
Total of 136 requests completed

.ab.exe -n 1000 http://localhost:8080/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd,
http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 100 requests
Completed 200 requests
apr_socket_recv: An existing connection was forcibly closed by the
remote host.
  (730054)
Total of 234 requests completed

.ab.exe -n 1000 http://localhost:8080/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd,
http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
apr_socket_recv: An existing connection was forcibly closed by the
remote host.
  (730054)

.ab.exe -n 1000 http://localhost:8080/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd,
http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)

Test aborted after 10 failures

apr_socket_connect(): No connection could be made because the target
machine act
ively refused it.   (730061)

Conclusions:
-----------------
-Benchmark.py continues hung but shows the results I attached.
-Sometimes ab.exe terminates normally but after a few new attempts
generates the same error message: apr_socket_connect(): No connection
could be made because the target machine actively refused it.
(730061).
-Web page http://localhost:8080/ continues showing the msg "Internet
Explorer cannot display the webpage".

What do you think is happening?
Thanks again.


Thanks again.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How to run benchmark.py for cherrypy http server?

Robert Brewer

vizcayno wrote:
> I got "ab" program from Apache site (my intention was never to use
> Apache so, I beg your pardon if I get confussed with the command) and
> ran it in one cmd.exe session; previously I executed benchmark.py on a
> second cmd.exe session. I show you the results:

Yeah, the detail you seem to be missing is that benchmark.py RUNS AB
FOR YOU. So you don't need to run ab yourself, but you do have to have
it installed. Now that you *do* have it installed, benchmark.py finds
it and uses it to generate the tables of response statistics you saw.

> -Benchmark.py continues hung but shows the results I attached.

This was a problem until very recently:
http://www.cherrypy.org/changeset/1561. So if you have a copy of CP 3
that's even a week old, I expect it to hang. Just hit "Ctrl-C" after
the 3 report tables are printed, and it'll terminate normally.

> -Web page http://localhost:8080/ continues showing the msg "Internet
> Explorer cannot display the webpage".

I can't explain that one, unless you're trying to access the page after
the reports have all printed (and the server has shut down).

It looks like you're 99% of the way there.


Robert Brewer
System Architect
Amor Ministries
[hidden email]


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How to run benchmark.py for cherrypy http server?

vizcayno

Robert:
It is me again.
I would like to share about some work I did with the benchmark.py in
the intention to find the reasons because I cannot cancel the script
after it finishes and, the reason I have errors in the Browser during
the execution of the benchmark.

1) The last line of the script is:
cherrypy.engine.start_with_callback(run), when I change to
cherrypy.engine.start_with_callback(run()) it executes faster than the
first option and I get best results. However, I cannot avoid the
hanging problem and I do not know if the change is correct indeed.

2) In script  _cpserver.py -> class Server -> method stop there is next
condition:
                if isinstance(bind_addr, tuple):
                    wait_for_free_port(*bind_addr)
     If I change to:
                if isinstance(bind_addr, tuple):
                    pass #wait_for_free_port(*bind_addr)
    It is possible (at least for me) to press CTRL-C and fisnish the
benchmark.

3) About the problem (is it really??) in the browser:
    a) Using IE7 and during benchmark execution, I get error HTTP404.
When benchmark finishes, I refresh the web page and get error:
"Internet Explorer cannot display the webpage"
    b) Using Firefox and during benchmark execution, I get a blank page
(no error messsage). When benchmark terminates, I refresh the web page
and get error: "Firefox can't establish a connection to the server at
localhost:8080."

I would really like to know your feedback about this. May be it only
happens in my machine.

Thank you again for your attention, help ... and time.
Vizcayno.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---