Re: Php files with .html extension?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 25 Oct 2004 16:30:14 +0100, Graham Cossey
<graham@xxxxxxxxxxxxxxx> wrote:
> Do not forget that if you do this ALL files with the .html extension will be
> parsed by PHP whether they are PHP scripts or not which could be something
> you need to consider from a performance perspective.


I setup a simple benchmark test because I was curious how much
overhead parsing .html files as PHP files actually caused.  Here are
those results:


Server specs:

Debain Sarge (testing)
> uname -a
Linux netpc0378 2.6.7-1-686 #1 Thu Jul 8 05:36:53 EDT 2004 i686 GNU/Linux

> php4 -v
PHP 4.3.4 (cli) (built: Mar 27 2004 08:04:22)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies

> apache -v
Server version: Apache/1.3.31 (Debian GNU/Linux)
Server built:   Sep  9 2004 07:31:19

> cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 8
model name      : Celeron (Coppermine)
stepping        : 10
cpu MHz         : 997.253
cache size      : 128 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 mmx fxsr sse
bogomips        : 1978.36

> free -m
             total       used       free     shared    buffers     cached
Mem:           249        189         59          0          1         54
-/+ buffers/cache:        134        115
Swap:          486         29        456


The index.html test file is very simple:

<html>
<head>
<title>Benchmark Test</title>
</head>
<body bgcolor="white">
Benchmark Me!
</body>
</html>


Then the actual tests:


1) Apache not parsing .html files as PHP:

> ab -n10000 http://localhost/benchmark/
This is ApacheBench, Version 1.3d <$Revision: 1.73 $> apache-1.3
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 localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests
Server Software:        Apache/1.3.31
Server Hostname:        localhost
Server Port:            80

Document Path:          /benchmark/
Document Length:        270 bytes

Concurrency Level:      1
Time taken for tests:   27.134 seconds
Complete requests:      10000
Failed requests:        0
Broken pipe errors:     0
Non-2xx responses:      10000
Total transferred:      4490000 bytes
HTML transferred:       2700000 bytes
Requests per second:    368.54 [#/sec] (mean)
Time per request:       2.71 [ms] (mean)
Time per request:       2.71 [ms] (mean, across all concurrent requests)
Transfer rate:          165.48 [Kbytes/sec] received

Connnection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0     0    0.0      0     2
Processing:     1     2   19.8      1   810
Waiting:        0     2   19.8      1   810
Total:          1     2   19.8      1   810

Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      1
  80%      1
  90%      2
  95%      3
  98%      3
  99%     14
 100%    810 (last request)


2) Apache parsing .html files as PHP:

(I edited /etc/apache/mime.types and added "html" to the
application/x-httpd-php line, and then I restarted Apache.)

> ab -n10000 http://localhost/benchmark/
This is ApacheBench, Version 1.3d <$Revision: 1.73 $> apache-1.3
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 localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests
Server Software:        Apache/1.3.31
Server Hostname:        localhost
Server Port:            80

Document Path:          /benchmark/
Document Length:        270 bytes

Concurrency Level:      1
Time taken for tests:   30.215 seconds
Complete requests:      10000
Failed requests:        0
Broken pipe errors:     0
Non-2xx responses:      10000
Total transferred:      4490000 bytes
HTML transferred:       2700000 bytes
Requests per second:    330.96 [#/sec] (mean)
Time per request:       3.02 [ms] (mean)
Time per request:       3.02 [ms] (mean, across all concurrent requests)
Transfer rate:          148.60 [Kbytes/sec] received

Connnection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0     0    0.0      0     1
Processing:     1     2   23.9      1   919
Waiting:        0     2   23.9      1   918
Total:          1     2   23.9      1   919
ERROR: The median and mean for the initial connection time are more
than twice the standard
       deviation apart. These results are NOT reliable.

Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      1
  80%      1
  90%      2
  95%      3
  98%      4
  99%     15
 100%    919 (last request)


The summary results:

For 10K local requests:
27.1 seconds with .html not parsed as PHP
vs.
30.2 seconds with .html parsed as PHP.

I only ran these tests locally, and only on the one server.. so it's
definatly not very scientific.  I think we all sorta knew the results
anyway.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux