Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Ticket #571 (enhancement)

Opened 2 years ago

Last modified 1 month ago

Make CP static file performance comparable to Apache

Status: assigned

Reported by: fumanchu Assigned to: fumanchu (accepted)
Priority: normal Milestone:
Component: CherryPy code Keywords:
Cc:

I can dream, can't I?

Change History

09/27/06 21:27:46: Modified by fumanchu

  • description changed.

12/30/06 12:37:53: Modified by fumanchu

  • status changed from new to assigned.
  • description changed.

Here's a benchmark run against Apache 2.0.47 (1000 requests, 14 byte static file (sitting in DocumentRoot), ThreadsPerChild 250, MaxRequestsPerChild 0):

threads | Completed | Failed |  req/sec | msec/req |  KB/sec |
     10 |      1000 |      0 |  1296.84 |    0.771 |  430.55 |
     20 |      1000 |      0 |  1232.79 |    0.811 |  410.52 |
     30 |      1000 |      0 |  1174.78 |    0.851 |  395.90 |
     40 |      1000 |      0 |  1203.09 |    0.831 |  403.03 |
     50 |      1000 |      0 |  1134.73 |    0.881 |  383.54 |
Average |    1000.0 |    0.0 | 1208.446 |    0.829 | 404.708 |

Here's a run of the full CP stack (1000 requests, 14 bytes via staticdir, 10 server threads):

threads | Completed | Failed | req/sec | msec/req | KB/sec |
     10 |      1000 |      0 |  308.20 |    3.245 |  62.87 |
     20 |      1000 |      0 |  301.68 |    3.315 |  61.54 |
     30 |      1000 |      0 |  302.59 |    3.305 |  61.73 |
     40 |      1000 |      0 |  295.43 |    3.385 |  60.27 |
     50 |      1000 |      0 |  298.97 |    3.345 |  60.99 |
Average |    1000.0 |    0.0 | 301.374 |    3.319 |  61.48 |

And here's a run with the CP3 WSGI server, using a bare-bones static-file WSGI app (see below):

threads | Completed | Failed | req/sec | msec/req | KB/sec |
     10 |      3000 |      0 | 1222.73 |    0.818 | 195.64 |
     20 |      3000 |      0 | 1198.27 |    0.835 | 191.72 |
     30 |      3000 |      0 | 1198.27 |    0.835 | 191.72 |
     40 |      3000 |      0 | 1184.07 |    0.845 | 189.45 |
     50 |      3000 |      0 | 1152.19 |    0.868 | 184.35 |
    def simple_app(environ, start_response):
        """Simplest possible application object"""
        f = open(r'D:\htdocs\summary.txt')
        body = f.read()
        f.close()
        status = '200 OK'
        response_headers = [('Content-type','text/plain'),
                            ('Content-Length', str(len(body)))]
        start_response(status, response_headers)
        return [body]

So we can come close. Using sendfile/TransmitFile might help.

05/24/08 00:54:22: Modified by fumanchu

Some code added to a branch in [1964].

Hosted by WebFaction

Log in as guest/cpguest to create tickets