We've been curious for a while about the overhead due to array setup time, especially in the context of language files. Although Turck caches the bytecode, the interpreter still has to process that bytecode and allocate the array data structures. How long does this take?
The answer is 4ms, to load both French and English messages.
Criticism of my method would be welcome, I'll present it here in full. I used two files, slow.php:
<?php
define('MEDIAWIKI', 1); function wfSuppressWarnings() {} function wfRestoreWarnings() {}
$wgLanguageCode = 'fr'; $IP = '/apache/common/php-1.5'; ini_set('include_path', "$IP/languages"); require_once("$IP/languages/Language.php");
print time() . "\n";
?>
And fast.php, which is exactly the same except without the require_once:
<?php
define('MEDIAWIKI', 1); function wfSuppressWarnings() {} function wfRestoreWarnings() {}
$wgLanguageCode = 'fr'; $IP = '/apache/common/php-1.5'; ini_set('include_path', "$IP/languages");
print time() . "\n";
?>
Turck MMCache only works for the apache module SAPI, so I benchmarked these two files using ab. I used hypatia, which is a 3 GHz P4. It was otherwise idle. Here is the output:
[0625][tstarling@hypatia:~]$ ab -Xlocalhost:80 -n10000 http://en.wikipedia.org/w/benchmark/fast.php 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 en.wikipedia.org [through localhost:80] (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 Server Hostname: en.wikipedia.org Server Port: 80
Document Path: /w/benchmark/fast.php Document Length: 11 bytes
Concurrency Level: 1 Time taken for tests: 7.759175 seconds Complete requests: 10000 Failed requests: 0 Write errors: 0 Total transferred: 1530000 bytes HTML transferred: 110000 bytes Requests per second: 1288.80 [#/sec] (mean) Time per request: 0.776 [ms] (mean) Time per request: 0.776 [ms] (mean, across all concurrent requests) Transfer rate: 192.55 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.0 0 0 Processing: 0 0 12.0 0 851 Waiting: 0 0 12.0 0 851 Total: 0 0 12.0 0 851
Percentage of the requests served within a certain time (ms) 50% 0 66% 0 75% 0 80% 0 90% 0 95% 0 98% 0 99% 0 100% 851 (longest request)
[0628][tstarling@hypatia:/apache/common/live-1.5/benchmark]$ ab -Xlocalhost:80 -n10000 http://en.wikipedia.org/w/benchmark/slow.php 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 en.wikipedia.org [through localhost:80] (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 Server Hostname: en.wikipedia.org Server Port: 80
Document Path: /w/benchmark/slow.php Document Length: 11 bytes
Concurrency Level: 1 Time taken for tests: 47.707920 seconds Complete requests: 10000 Failed requests: 0 Write errors: 0 Total transferred: 1530000 bytes HTML transferred: 110000 bytes Requests per second: 209.61 [#/sec] (mean) Time per request: 4.771 [ms] (mean) Time per request: 4.771 [ms] (mean, across all concurrent requests) Transfer rate: 31.32 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.0 0 0 Processing: 4 4 0.5 4 29 Waiting: 0 4 0.5 4 28 Total: 4 4 0.5 4 29
Percentage of the requests served within a certain time (ms) 50% 4 66% 4 75% 4 80% 4 90% 4 95% 4 98% 4 99% 6 100% 29 (longest request)
Hi all When and how can I know if my proposal for the murcian wikipedia has been aproved or denied?
---------------------------------
Correo Yahoo! Comprueba qué es nuevo, aquí http://correo.yahoo.es
Tim Starling wrote:
We've been curious for a while about the overhead due to array setup time, especially in the context of language files. Although Turck caches the bytecode, the interpreter still has to process that bytecode and allocate the array data structures. How long does this take?
The answer is 4ms, to load both French and English messages.
Criticism of my method would be welcome, I'll present it here in full. I used two files, slow.php:
<?php define('MEDIAWIKI', 1); function wfSuppressWarnings() {} function wfRestoreWarnings() {} $wgLanguageCode = 'fr'; $IP = '/apache/common/php-1.5'; ini_set('include_path', "$IP/languages"); require_once("$IP/languages/Language.php"); print time() . "\n"; ?>
And fast.php, which is exactly the same except without the require_once:
<?php define('MEDIAWIKI', 1); function wfSuppressWarnings() {} function wfRestoreWarnings() {} $wgLanguageCode = 'fr'; $IP = '/apache/common/php-1.5'; ini_set('include_path', "$IP/languages"); print time() . "\n"; ?>
Can you use another script that just require a dummy file aka having require_once("$IP/languages/dummy.php");
with dummy.php having '<?php ?>' for content ? Might get you an idea of require_once overhead.
wikitech-l@lists.wikimedia.org