Re: FAQ 3.19 How can I make my CGI script more efficient?
- From: Brian Wakem <no@xxxxxxxxx>
- Date: Mon, 07 Nov 2005 10:42:51 +0000
Purl Gurl wrote:
Brian Wakem wrote:
Purl Gurl wrote:
Gunnar Hjalmarsson wrote:
Purl Gurl wrote:
(snipped)
Serving up pages via cgi is significantly more efficient than static html pages; increase in Apache speed is amazing. Apache is relieved of parsing for content such as html versus plaintext, relieved of producing content headers, relieved of parsing for server side includes, on and on. Apache runs lots faster.
This is absolute pish-posh. Apache running all bell and whistles (SSI etc) will serve static pages *at least* 100 times faster than mod_cgi served pages, and twice as fast as mod_perl served pages.
If this is not the case on your machine then you have serious config problems.
I have done much benchmarking on these issues.
Honestly and truly? I believe you are full of mule manure.
URL measured: http://www.purlgurl.net/~callgirl/index.cgi Page speed: 1.89 sec (see details below) Compare to: 2.49 sec (average speed of all our benchmarks)
Page downloading steps (as seen by Microsoft Internet Explorer):
Seconds Status Activity URL 0.00 Loading Begin Navigation http://www.purlgurl.net/~callgirl/index.cgi 0.00 Loading Begin Download 0.33 Loading End Navigation 1.90 Interactive End Download 1.90 Complete Document Complete
***
URL measured: http://www.purlgurl.net/~godzilla/index.html Page speed: 6.50 sec (see details below) Compare to: 2.49 sec (average speed of all our benchmarks)
Page downloading steps (as seen by Microsoft Internet Explorer):
Seconds Status Activity URL 0.00 Loading Begin Navigation http://www.purlgurl.net/~godzilla/index.html 0.03 Loading Begin Download 3.94 Loading End Navigation 6.48 Interactive End Download 6.50 Complete Document Complete
Hold on, you are benchmarking with Internet Explorer? I'm not sure I should diginify that with a response.
OK, 1000 requests, concurrency of 10, SSI's on.
# ab -n 1000 -c 10 www.mysite.co.uk/index.html
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
Benchmarking www.mysite.co.uk (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Finished 1000 requests
Server Software: Apache/2.0.52 Server Hostname: www.mysite.co.uk Server Port: 80
Document Path: /index.html Document Length: 55080 bytes
Concurrency Level: 10 Time taken for tests: 0.521083 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 55405720 bytes HTML transferred: 55245240 bytes Requests per second: 1919.08 [#/sec] (mean) Time per request: 5.211 [ms] (mean) Time per request: 0.521 [ms] (mean, across all concurrent requests) Transfer rate: 103835.67 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 2
Processing: 2 4 1.1 5 9
Waiting: 0 3 1.1 3 8
Total: 2 4 1.1 5 9Percentage of the requests served within a certain time (ms) 50% 5 66% 5 75% 5 80% 5 90% 6 95% 6 98% 7 99% 7 100% 9 (longest request)
Now same test using a mod_perl served page (which uses CGI.pm for what it's worth).
# ab -n 1000 -c 10 www.mysite.co.uk/cgi-bin/index.cgi
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
Benchmarking www.mysite.co.uk (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Finished 1000 requests
Server Software: Apache/2.0.52 Server Hostname: www.mysite.co.uk Server Port: 80
Document Path: /cgi-bin/index.cgi Document Length: 16666 bytes
Concurrency Level: 10 Time taken for tests: 0.845462 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 16842618 bytes HTML transferred: 16699332 bytes Requests per second: 1182.79 [#/sec] (mean) Time per request: 8.455 [ms] (mean) Time per request: 0.845 [ms] (mean, across all concurrent requests) Transfer rate: 19453.27 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.3 0 3
Processing: 3 7 2.1 8 14
Waiting: 0 7 2.0 7 14
Total: 3 7 2.1 8 15Percentage of the requests served within a certain time (ms) 50% 8 66% 9 75% 9 80% 9 90% 10 95% 11 98% 12 99% 13 100% 15 (longest request)
Still 1200/second.
Now I can't bench a mod_cgi script on this machine as I no longer run any, but previous benchmarking showed max throughput at about 30 requests/second.
With a bear bones mod_perl scripts I can get 3000/sec, and 5000/sec for a small HTML page.
-- Brian Wakem Email: http://homepage.ntlworld.com/b.wakem/myemail.png .
- Follow-Ups:
- Re: FAQ 3.19 How can I make my CGI script more efficient?
- From: Purl Gurl
- Re: FAQ 3.19 How can I make my CGI script more efficient?
- References:
- FAQ 3.19 How can I make my CGI script more efficient?
- From: PerlFAQ Server
- Re: FAQ 3.19 How can I make my CGI script more efficient?
- From: Matt Garrish
- Re: FAQ 3.19 How can I make my CGI script more efficient?
- From: Brian Wakem
- Re: FAQ 3.19 How can I make my CGI script more efficient?
- From: Gunnar Hjalmarsson
- Re: FAQ 3.19 How can I make my CGI script more efficient?
- From: Purl Gurl
- FAQ 3.19 How can I make my CGI script more efficient?
- Prev by Date: threads in perl
- Next by Date: Re: Can't get group to match - please help
- Previous by thread: Re: FAQ 3.19 How can I make my CGI script more efficient?
- Next by thread: Re: FAQ 3.19 How can I make my CGI script more efficient?
- Index(es):
Relevant Pages
|