cvs: presentations /slides/intro numbers.xml php_bench1.xml php_bench2.xml php_profiling.xml php_tuning1.xml phpstats.png

From: Date: Sun, 21 Sep 2003 15:50:33 +0000
Subject: cvs: presentations /slides/intro numbers.xml php_bench1.xml php_bench2.xml php_profiling.xml php_tuning1.xml phpstats.png
Groups: php.pres 
Request: Send a blank email to pres+get-822@lists.php.net to get a copy of this message
rasmus Sun Sep 21 11:50:33 2003 EDT Modified files: /presentations/slides/intro numbers.xml php_bench1.xml php_bench2.xml php_profiling.xml php_tuning1.xml phpstats.png Log: Update numbers

Index: presentations/slides/intro/numbers.xml diff -u presentations/slides/intro/numbers.xml:1.13 presentations/slides/intro/numbers.xml:1.14 --- presentations/slides/intro/numbers.xml:1.13 Sat Jun 14 17:10:59 2003 +++ presentations/slides/intro/numbers.xml Sun Sep 21 11:50:33 2003 @@ -1,27 +1,28 @@ <slide title="PHP is Big!"> <list> -<title>June 2003 Netcraft Report</title> -<bullet>40,936,076 Domains queried</bullet> -<bullet> 12,749,410 Domains. 1,317,425 IP addresses</bullet> -<bullet>PHP installed on 31% of all domains</bullet> +<title>September 2003 Netcraft Report</title> +<bullet>43,144,374 Domains queried</bullet> +<bullet> 13,717,527 Domains. 1,310,849 IP addresses</bullet> +<bullet>PHP installed on 32% of all domains</bullet> </list> <image filename="phpstats.png" align="center"/> <link href="http://www.netcraft.com" leader="Source: " align="right" marginright="6em">Netcraft</link> <list> -<title>March 2003 Apache Module Report</title> -<bullet>%6,813,534 Apache Servers surveyed%</bullet> -<bullet>%3,510,294 (51.52\%) PHP%</bullet> -<bullet>%2,075,828 (30.47\%) OpenSSL%</bullet> -<bullet>%2,007,598 (29.46\%) mod_ssl%</bullet> -<bullet>%1,486,868 (21.82\%) Frontpage%</bullet> -<bullet>%1,407,732 (20.66\%) mod_perl%</bullet> -<bullet>% 401,097 (5.89\%) DAV%</bullet> -<bullet>% 348,856 (5.12\%) mod_throttle%</bullet> -<bullet>% 206,122 (3.03\%) mod_jk%</bullet> -<bullet>% 175,924 (2.87\%) AuthMySQL%</bullet> -<bullet>% 190,290 (2.79\%) mod_log_bytes%</bullet> -<bullet>% 185,076 (2.72\%) mod_bwlimited%</bullet> +<title>August 2003 Apache Module Report</title> +<bullet>%7,705,536 Apache Servers surveyed%</bullet> +<bullet>%4,028,942 (52.29\%) PHP%</bullet> +<bullet>%2,382,063 (30.91\%) OpenSSL%</bullet> +<bullet>%2,305,879 (29.92\%) mod_ssl%</bullet> +<bullet>%1,693,807 (21.98\%) Frontpage%</bullet> +<bullet>%1,520,160 (19.73\%) mod_perl%</bullet> +<bullet>% 396,190 (5.14\%) DAV%</bullet> +<bullet>% 353,222 (4.58\%) mod_throttle%</bullet> +<bullet>% 296,228 (3.84\%) mod_jk%</bullet> +<bullet>% 264,732 (3.44\%) mod_log_bytes%</bullet> +<bullet>% 259,171 (3.36\%) mod_bwlimited%</bullet> +<bullet>% 237,822 (3.09\%) mod_fastcgi%</bullet> +<bullet>% 205,158 (2.66\%) AuthMySQL%</bullet> </list> <link href="http://www.securityspace.com/s_survey/data/index.html" leader="Source: ">SecuritySpace.com</link> Index: presentations/slides/intro/php_bench1.xml diff -u presentations/slides/intro/php_bench1.xml:1.1 presentations/slides/intro/php_bench1.xml:1.2 --- presentations/slides/intro/php_bench1.xml:1.1 Sat Apr 26 13:52:13 2003 +++ presentations/slides/intro/php_bench1.xml Sun Sep 21 11:50:33 2003 @@ -1,27 +1,136 @@ <slide title="Benchmarking"> <blurb> -Let's have a look at how we might benchmark and subsequently tune a PHP server. +Let's have a look at how we might benchmark and subsequently tune a PHP server. +We will use two machines. A client machine to run our HTTP load program +(%http_load% from acme.com) and a P4 1.7G server with 256M of RAM. We will also +be using 3 freely available opcode caches: </blurb> -<link href="http://apc.communityconnect.com/sources/apc-cvs.tar.gz">http://apc.communityconnect.com/sources/apc-cvs.tar.gz</link> +<link href="http://cvs.php.net/cvs.php/pear/PECL/apc">http://cvs.php.net/cvs.php/pear/PECL/apc</link> +<link href="http://www.turckware.ru/en/e_mmc.htm">http://www.turckware.ru/en/e_mmc.htm</link> <link href="http://www.ioncube.com/">http://www.ioncube.com</link> -<example type="shell" fontsize="1.5em"> -CPU: Pentium III 700MHz -RAM: 128M -</example> - -<blurb>Our test script includes 2 files, defines 3 functions, loops a bit and outputs about %6k% of data. -</blurb> - -<blurb>For testing I am using %http_load% from acme.com and the default SendBufferSize</blurb> - -<example type="shell"> +<example title="Don't blow your io buffers!" type="shell"> # To change this on Linux, cat a larger number # into /proc/sys/net/core/wmem_max in your # httpd startup script SendBufferSize 65535 </example> + +<example title="This is our benchmark script" fontsize="1.5em"><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><title>Simple PHP Benchmark</title></head> +<body> +<h1>String Manipulation</h1> +<p> +<?php +$str = 'This is just a silly benchmark that doesn\'t do anything useful.'; +$str .= 'Here we are just uppercasing the first two characters of every word '; +$str .= 'in this long string'; +$parts = explode(' ',$str); +foreach($parts as $part) { + $new[] = strtoupper(substr($part,0,2)).substr($part,2); +} +echo implode(' ',$new); +?> +</p> +<h1>Including 2 files</h1> +<p> +<?php +include './bench_include1.inc'; +include './bench_include2.inc'; +?> +</p> +<h1>for-loop and calling a function many times</h1> +<p> +<?php +$a = range(1,200); +$b = range(200,1); +for($i=0; $i<200; $i++) { + echo foo($a[$i],$b[$i]); +} +?> +</p> +<h1>Define and Instantiate an object and call some methods</h2> +<p> +<?php +class test_class { + var $test_var1; + var $test_var2; + var $test_var3; + var $test_var4; + + function test_class($arg1, $arg2) { + echo "Constructor args: $arg1, $arg2<br />\n"; + } + + function set_var1($value) { + $this->test_var1 = $value; + echo "test_var1 property set to $value<br />\n"; + return true; + } + function set_var2($value) { + $this->test_var2 = $value; + echo "test_var2 property set to $value<br />\n"; + return true; + } + function set_var3($value) { + $this->test_var3 = $value; + echo "test_var3 property set to $value<br />\n"; + return true; + } + function set_var4($value) { + $this->test_var4 = $value; + echo "test_var4 property set to $value<br />\n"; + return true; + } + function disp() { + echo "<pre>"; + var_dump($this); + echo "</pre>"; + } +} +$obj = new test_class(1,'arg2'); +$obj->set_var1('test1'); +$obj->set_var2(123); +$obj->set_var3($a); /* Array from previous test */ +$obj->set_var4(array(1,2,3,4,5,6,7,8,9)); +$obj->disp(); +?> +</p> +</body> +</html>]]></example> + +<example title="bench_include1.inc" fontsize="1.5em"><![CDATA[<?php +function foo($arg1, $arg2) { + if($arg1>$arg2) return $arg1; + elseif($arg1<$arg2) return $arg2; + else return 'xxx'; +} +?>]]></example> + +<example title="bench_include2.inc" fontsize="1.5em"><![CDATA[This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br /> +This is just a bunch of plain text in an include file.<br />]]></example> </slide> Index: presentations/slides/intro/php_bench2.xml diff -u presentations/slides/intro/php_bench2.xml:1.1 presentations/slides/intro/php_bench2.xml:1.2 --- presentations/slides/intro/php_bench2.xml:1.1 Sat Apr 26 13:52:13 2003 +++ presentations/slides/intro/php_bench2.xml Sun Sep 21 11:50:33 2003 @@ -1,109 +1,88 @@ <slide title="Benchmarking Results"> <example type="shell" title="An http_load run" fontsize="1.5em"> -% http_load -parallel 5 -fetches 5000 url.txt -5000 fetches, 5 max parallel, 2.954e+07 bytes, in 12.5082 seconds -5908 mean bytes/connection -399.739 fetches/sec, 2.36166e+06 bytes/sec -msecs/connect: 0.242907 mean, 9.246 max, 0.195 min -msecs/first-response: 10.7645 mean, 130.136 max, 2.114 min +2500 fetches, 5 max parallel, 1.962e+07 bytes, in 15.9486 seconds +7848 mean bytes/connection +156.753 fetches/sec, 1.2302e+06 bytes/sec +msecs/connect: 1.40331 mean, 2999.44 max, 0.171 min +msecs/first-response: 29.4603 mean, 648.731 max, 6.005 min HTTP response codes: - code 200 -- 5000 + code 200 -- 2500 </example> -<table columns="2" border="0" width="100%" align="center" fontsize="3em"> -<cell>No Opcode cache</cell><cell>254 requests/sec</cell> -<cell>With APC2 cache</cell><cell>399 requests/sec</cell> -<cell>With IonCube (phpa) cache</cell><cell>350 requests/sec</cell> -</table> - -<blurb>It is also interesting to look at what your server is doing while you -hammer it with http_load:</blurb> - -<example type="shell" title="Load without opcode cache" fontsize="1.5em" marginleft="0em" marginright="0em"> - procs memory swap io system cpu - r b w swpd free buff cache si so bi bo in cs us sy id -11 0 0 90000 3844 4928 73152 0 0 0 0 2854 450 87 13 0 -11 0 1 90000 5280 4944 73128 0 8 0 160 2934 450 88 12 0 -13 0 0 90000 3928 4944 73164 0 0 0 0 3002 595 87 13 0 -12 0 1 90000 3892 4944 73184 0 0 0 0 2928 515 82 18 0 - 9 0 0 90000 3896 4944 73200 0 0 0 0 2970 602 79 21 0 -12 0 1 90000 3840 4952 73220 0 0 0 12 2948 517 80 20 0 -11 0 1 90000 3956 4952 73240 0 0 0 0 2916 522 91 9 0 - 9 0 1 90000 3952 4952 73256 0 0 0 0 2996 547 89 11 0 -11 0 1 90000 3916 4952 73276 0 0 0 0 2949 534 81 19 0 -13 0 1 90000 3896 4952 73296 0 0 0 0 2886 516 86 14 0 -11 0 1 90000 3876 4960 73312 0 0 0 12 2887 547 90 10 0 -11 0 1 90000 3864 4960 73332 0 0 0 0 2931 531 85 15 0 -12 0 1 90000 3844 4960 73348 0 0 0 0 3013 579 89 11 0 -12 0 1 90000 3952 4960 73368 0 0 0 0 2999 508 87 13 0 -12 0 1 90000 3928 4968 73388 0 0 0 12 3022 600 79 21 0 +<blurb>Whenever you do any sort of load testing, you need look beyond just the +raw numbers and have a look at what your server is actually doing. Use %vmstat%: +</blurb> + +<example type="shell" title="Base PHP Load" fontsize="1.5em" marginleft="0em" marginright="0em"> + procs memory page disks faults cpu + r b w avm fre flt re pi po fr sr ad0 ac0 in sy cs us sy id +25 0 0 149472 17572 26 0 0 0 0 0 0 0 1663 12390 4391 80 20 0 + 5 0 0 149472 17532 27 0 0 0 0 0 0 0 1665 12322 4444 77 23 0 + 7 0 0 149472 17492 24 0 0 0 0 0 2 0 1657 12409 4771 74 26 0 + 5 0 0 149472 17452 28 0 0 0 0 0 0 0 1687 12520 4856 82 18 0 +25 0 0 149472 17412 28 0 0 0 0 0 0 0 1649 12413 4756 78 22 0 + 5 0 0 149472 17372 23 0 0 0 0 0 0 0 1645 12199 4417 77 23 0 + 5 0 0 149084 17332 27 0 0 0 0 0 1 0 1679 12564 4385 76 24 0 + 5 0 0 149464 17304 26 0 0 0 3 0 1 0 1663 12336 4551 79 21 0 + 5 0 0 149464 17264 27 0 0 0 0 0 0 0 1662 12480 4663 82 18 0 </example> -<example type="shell" title="Load with APC2 cache" fontsize="1.5em" marginleft="0em" marginright="0em"> - procs memory swap io system cpu - r b w swpd free buff cache si so bi bo in cs us sy id -11 0 0 90000 3904 4712 72212 0 0 0 0 4494 596 78 22 0 -10 0 1 90000 5280 4680 72160 0 0 0 0 4422 596 77 23 0 -11 0 1 90000 5176 4688 72192 0 0 0 12 4500 791 85 15 0 - 9 0 0 90000 5224 4688 72092 0 0 0 0 4541 702 79 21 0 -11 0 1 90000 5152 4688 72120 0 0 0 0 4495 885 88 12 0 -10 0 1 90000 5216 4688 72020 0 0 0 0 4513 674 73 27 0 -11 0 1 90000 5132 4688 72048 0 0 0 0 4477 794 82 18 0 -11 0 1 90000 5200 4688 71952 0 0 0 128 4476 701 80 20 0 -10 0 1 90000 5296 4688 71852 0 0 0 0 4486 770 76 24 0 -11 0 1 90000 5224 4688 71880 0 0 0 0 4524 698 82 18 0 -11 0 0 90000 5144 4688 71908 0 0 0 0 4481 788 78 22 0 -11 0 1 90000 5196 4688 71808 0 0 0 0 4504 684 74 26 0 -11 0 1 90000 5116 4688 71836 0 0 0 128 4463 792 80 20 0 -10 0 1 90000 5172 4688 71740 0 0 0 0 4539 681 80 20 0 -12 0 1 90000 5228 4688 71640 0 0 0 0 4503 747 74 26 0 +<example type="shell" title="Load with APC cache" fontsize="1.5em" marginleft="0em" marginright="0em"> + procs memory page disks faults cpu + r b w avm fre flt re pi po fr sr ad0 ac0 in sy cs us sy id + 5 0 0 150140 11936 29 0 0 0 0 0 0 0 1629 12203 4687 75 25 0 + 5 0 0 150140 11888 28 0 0 0 0 0 0 0 1619 12007 4579 79 21 0 + 5 0 0 150140 11848 28 0 0 0 0 0 0 0 1640 12305 4252 76 24 0 + 5 0 0 150140 11808 25 0 0 0 0 0 1 0 1630 12006 4628 84 16 0 +25 0 0 150140 11776 27 0 0 0 0 0 0 0 1635 12304 4118 88 12 0 + 5 0 0 150140 11736 26 0 0 0 0 0 0 0 1627 12059 4381 80 20 0 + 5 0 0 150528 11696 22 0 0 0 0 0 11 0 1635 12178 4685 83 17 0 + 5 0 0 150528 11656 26 0 0 0 0 0 0 0 1624 12027 4651 84 16 0 </example> <example type="shell" title="Load with IonCube cache" fontsize="1.5em" marginleft="0em" marginright="0em"> - procs memory swap io system cpu - r b w swpd free buff cache si so bi bo in cs us sy id -11 0 1 86084 5196 6284 54104 0 0 0 4 4078 632 75 25 0 -12 0 1 86084 5132 6284 54132 0 0 0 0 4024 593 78 22 0 -12 0 1 86084 5204 6284 54052 32 4 32 4 3996 705 66 34 0 -12 0 1 86084 5180 6292 54076 0 0 0 140 3979 678 74 26 0 -11 0 1 86084 5148 6292 54104 0 0 0 0 3980 740 70 30 0 -10 0 1 86084 5256 6292 54000 0 0 0 0 3945 660 82 18 0 -10 0 1 86084 5228 6292 54024 0 0 0 0 4025 663 75 25 0 -12 0 1 86084 5200 6292 54052 0 0 0 0 3967 692 82 18 0 -11 0 1 86084 5180 6292 54076 0 0 0 0 3994 688 76 24 0 -11 0 1 86084 5156 6292 54100 0 0 0 0 4023 641 71 29 0 -11 0 1 86144 5264 6292 54012 0 0 0 0 3993 719 78 22 0 -10 0 1 86144 5232 6292 54036 0 0 0 0 3967 655 80 20 0 -12 0 1 86144 5208 6292 54060 0 0 0 0 3946 732 78 22 0 -11 0 0 86144 5180 6292 54088 0 0 0 128 4011 637 76 24 0 -10 0 1 86144 3856 6292 54112 0 0 0 0 3983 664 80 20 0 -11 0 1 86160 3976 6292 54080 0 28 0 28 3932 639 80 20 0 + procs memory page disks faults cpu + r b w avm fre flt re pi po fr sr ad0 ac0 in sy cs us sy id + 5 0 0 127996 14516 28 0 0 0 0 0 0 0 1608 19343 4382 77 23 0 + 5 0 0 127996 14476 25 0 0 0 0 0 0 0 1601 19416 4628 82 18 0 + 8 0 0 127616 14436 23 0 0 0 0 0 1 0 1600 19181 4604 76 24 0 +26 0 0 127616 14400 24 0 0 0 1 0 1 0 1605 19439 3940 84 16 0 + 5 0 0 127616 14360 26 0 0 0 0 0 0 0 1612 19416 4582 79 21 0 + 5 0 0 128956 14328 25 0 0 0 0 0 1 0 1599 19336 4559 72 28 0 + 6 0 0 128956 14288 26 0 0 0 0 0 0 0 1598 19390 4444 79 21 0 +</example> + +<example type="shell" title="Load with Turck MMCache" fontsize="1.5em" marginleft="0em" marginright="0em"> + procs memory page disks faults cpu + r b w avm fre flt re pi po fr sr ad0 ac0 in sy cs us sy id + 3 0 0 136696 13284 29 0 0 0 0 0 0 0 1694 14846 4748 79 21 0 + 5 0 0 136696 13244 33 0 0 0 0 0 1 0 1711 14815 4472 74 26 0 + 5 0 0 136308 13204 28 0 0 0 0 0 0 0 1696 14824 4771 83 17 1 + 5 0 0 136688 13164 27 0 0 0 0 0 0 0 1692 14590 4880 83 17 0 + 6 0 0 136688 13116 26 0 0 0 0 0 1 0 1687 14762 4010 83 17 0 + 5 0 0 135696 13004 25 0 0 0 0 0 0 0 1693 14759 4840 79 21 0 + 7 0 0 135696 12956 26 0 0 0 0 0 1 0 1676 14477 4643 74 25 1 </example> <blurb> Our benchmark test was deliberately designed to have quite a bit of PHP processing -and not a whole lot of output. 6k is somewhat small for a web page. If instead +and not a whole lot of output. 7k is somewhat small for a web page. If instead we have a whole lot of output, chances are we will be io-bound instead of cpu-bound. If you are io-bound, there is little sense in optimizing at the PHP level. </blurb> <example type="shell" title="Evidence of an io-bound test" fontsize="1.5em" marginleft="0em" marginright="0em"> - procs memory swap io system cpu - r b w swpd free buff cache si so bi bo in cs us sy id - 4 0 0 94928 5204 2228 29812 0 0 0 0 4813 1660 19 24 58 - 7 0 0 94928 5200 2228 29812 0 0 0 0 4828 1614 7 33 60 - 6 0 0 94928 5176 2248 29812 0 0 4 24 4823 1688 13 20 68 - 7 0 0 94928 5172 2248 29816 0 0 0 0 4815 1670 8 38 54 - 5 0 0 94928 5168 2248 29816 0 0 0 0 4840 1647 12 23 66 - 5 0 0 94928 5168 2248 29816 0 0 0 0 4821 1663 12 28 60 - 5 0 0 94928 5164 2248 29820 0 0 0 0 4843 1664 11 25 64 - 5 0 0 94928 5152 2256 29820 0 0 0 12 4791 1687 9 26 65 - 4 0 0 94936 5276 2256 29820 0 8 0 8 4853 1665 14 25 62 - 6 0 0 94936 5284 2256 29824 0 0 0 0 4805 1670 7 28 65 - 6 0 0 94936 5268 2256 29824 0 0 0 0 4823 1676 8 25 67 - 6 0 0 94936 5244 2256 29824 24 0 24 0 4803 1700 9 32 59 - 5 0 0 94936 5228 2264 29824 0 0 0 12 4865 1762 12 23 66 + procs memory page disks faults cpu + r b w avm fre flt re pi po fr sr ad0 ac0 in sy cs us sy id + 4 0 0 132860 15724 1033 0 0 0 0 0 0 0 4457 954 3704 2 25 74 + 5 0 0 132860 15724 1009 0 0 0 0 0 0 0 4436 714 3597 3 24 73 + 6 0 0 132860 15716 980 0 0 0 0 0 0 0 4446 925 3603 5 23 72 + 2 0 0 132860 15716 1028 0 0 0 0 0 6 0 4514 720 3696 2 24 73 + 3 0 0 132472 15716 1018 0 0 0 0 0 2 0 4501 946 3673 2 22 76 + 4 0 0 132472 15716 1039 0 0 0 0 0 0 0 4565 737 3718 2 26 73 + 3 0 0 132472 15708 1010 0 0 0 0 0 2 0 4498 938 3639 2 24 75 + 2 0 0 132472 15708 1012 0 0 0 0 0 0 0 4543 730 3665 5 25 70 </example> <example type="shell" title="Things to try if you are io-bound"> Index: presentations/slides/intro/php_profiling.xml diff -u presentations/slides/intro/php_profiling.xml:1.1 presentations/slides/intro/php_profiling.xml:1.2 --- presentations/slides/intro/php_profiling.xml:1.1 Sat Apr 26 13:52:13 2003 +++ presentations/slides/intro/php_profiling.xml Sun Sep 21 11:50:33 2003 @@ -7,7 +7,7 @@ </blurb> <blurb title="How?"> -PEAR/Pecl to the rescue! +PECL to the rescue! </blurb> <example type="shell"><![CDATA[ @@ -26,57 +26,104 @@ install ok: apd 0.4p1 ]]></example> -<blurb>Woohoo!</blurb> +<blurb>Then in your %php.ini% file:</blurb> +<example><![CDATA[zend_extension = "/usr/local/lib/php/apd.so" +apd.dumpdir = /tmp +]]></example> + +<blurb>It isn't completely transparent. You need to tell the profiler +when to start profiling. At the top of a script you want to profile, add this call: +</blurb> +<example><![CDATA[<?php +apd_set_pprof_trace(); +?> +]]></example> + +<blurb> +The use the command-line tool called %pprofp%: +</blurb> -<example type="shell" fontsize="1.2em"><![CDATA[ -www:~> pear info apd -About apd-0.4p1 -=============== -+-----------------+--------------------------------------------------+ -| Package | apd | -| Summary | A full-featured engine-level profiler/debugger | -| Description | APD is a full-featured profiler/debugger that is | -| | loaded as a zend_extension. It aims to be an | -| | analog of C's gprof or Perl's Devel::DProf. | -| Maintainers | George Schlossnagle <george@omniti.com> (lead) | -| Version | 0.4p1 | -| Release Date | 2002-11-25 | -| Release License | PHP License | -| Release State | stable | -| Release Notes | Fix for pre-4.3 versions of php | -| Last Modified | 2002-12-02 | -+-----------------+--------------------------------------------------+ -]]></example> - -<example type="shell" fontsize="1em"><![CDATA[ -www:~> pear config-show -Configuration: -============== -+----------------------+-----------------+-------------------------------------+ -| PEAR executables | bin_dir | /usr/local/bin | -| directory | | | -| PEAR documentation | doc_dir | /usr/local/lib/php/docs | -| directory | | | -| |ffff11|PHP extension| | |ffff11|ext_dir| | |ffff11|/usr/local/lib/php/extensions/no-de| | -| |ffff11|directory| | | |ffff11|bug-non-zts-20020429| | -| PEAR directory | php_dir | /usr/local/lib/php | -| PEAR Installer cache | cache_dir | /tmp/pear/cache | -| directory | | | -| PEAR data directory | data_dir | /usr/local/lib/php/data | -| PEAR test directory | test_dir | /usr/local/lib/php/tests | -| Cache TimeToLive | cache_ttl | <not set> | -| Preferred Package | preferred_state | stable | -| State | | | -| Unix file mask | umask | 18 | -| Debug Log Level | verbose | 1 | -| HTTP Proxy Server | http_proxy | <not set> | -| Address | | | -| PEAR server | master_server | pear.php.net | -| PEAR password (for | password | <not set> | -| maintainers) | | | -| PEAR username (for | username | <not set> | -| maintainers) | | | -+----------------------+-----------------+-------------------------------------+ +<example type="shell" fontsize="1.2em" marginleft="1em" marginright="1em"><![CDATA[wwww: ~> pprofp +pprofp <flags> <trace file> + Sort options + -a Sort by alphabetic names of subroutines. + -l Sort by number of calls to subroutines + -m Sort by memory used in a function call. + -r Sort by real time spent in subroutines. + -R Sort by real time spent in subroutines (inclusive of child calls). + -s Sort by system time spent in subroutines. + -S Sort by system time spent in subroutines (inclusive of child calls). + -u Sort by user time spent in subroutines. + -U Sort by user time spent in subroutines (inclusive of child calls). + -v Sort by average amount of time spent in subroutines. + -z Sort by user+system time spent in subroutines. (default) + Display options + -c Display Real time elapsed alongside call tree. + -i Suppress reporting for php builtin functions + -O <cnt> Specifies maximum number of subroutines to display. (default 15) + -t Display compressed call tree. + -T Display uncompressed call tree. ]]></example> + +<example type="shell" fontsize="1em" marginleft="1em" marginright="1em"><![CDATA[ +% pprofp -z /tmp/pprof.48478 + +Trace for /home/y/share/htdocs/bench_main.php +Total Elapsed Time = 0.01 +Total System Time = 0.01 +Total User Time = 0.01 + + + Real User System secs/ cumm +%Time (excl/cumm) (excl/cumm) (excl/cumm) Calls call s/call Memory Usage Name +-------------------------------------------------------------------------------------- +100.0 0.00 0.00 0.01 0.01 0.01 0.01 200 0.0001 0.0001 0 foo + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 1 0.0000 0.0000 0 test_class->set_var2 + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 1 0.0000 0.0000 0 test_class->set_var1 + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 1 0.0000 0.0000 0 test_class->set_var3 + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 1 0.0000 0.0000 0 test_class->set_var4 + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 1 0.0000 0.0000 0 var_dump + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 1 0.0000 0.0000 0 test_class->disp + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 1 0.0000 0.0000 0 test_class->test_class + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 1 0.0000 0.0000 0 main + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 26 0.0000 0.0000 0 strtoupper + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 52 0.0000 0.0000 0 substr + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 1 0.0000 0.0000 0 implode + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 2 0.0000 0.0000 0 include + 0.0 0.01 0.01 0.00 0.00 0.00 0.00 2 0.0000 0.0000 0 range + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 1 0.0000 0.0000 0 explode +]]></example> + +<example type="shell" fontsize="1em" marginleft="1em" marginright="1em"><![CDATA[ +Trace for /home/rasmus/phpweb/index.php +Total Elapsed Time = 0.69 +Total System Time = 0.01 +Total User Time = 0.08 + + Real User System secs/ cumm +%Time (excl/cumm) (excl/cumm) (excl/cumm) Calls call s/call Memory Usage Name +-------------------------------------------------------------------------------------- + 33.3 0.11 0.13 0.02 0.03 0.01 0.01 7 0.0043 0.0057 298336 require_once + 22.2 0.02 0.02 0.02 0.02 0.00 0.00 183 0.0001 0.0001 -33944 feof + 11.1 0.01 0.01 0.01 0.01 0.00 0.00 3 0.0033 0.0033 -14808 define + 11.1 0.04 0.04 0.01 0.01 0.00 0.00 182 0.0001 0.0001 112040 fgetcsv + 11.1 0.25 0.25 0.01 0.01 0.00 0.00 6 0.0017 0.0017 3768 getimagesize + 11.1 0.01 0.01 0.01 0.01 0.00 0.00 55 0.0002 0.0002 2568 sprintf + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 7 0.0000 0.0000 -136 printf + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 1 0.0000 0.0000 136 htmlspecialchars + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 1 0.0000 0.0000 -16 mirror_provider_url + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 7 0.0000 0.0000 112 spacer + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 10 0.0000 0.0000 -552 delim + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 1 0.0000 0.0000 112 mirror_provider + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 20 0.0000 0.0000 -624 print_link + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 1 0.0000 0.0000 24 have_stats + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 1 0.0000 0.0000 -72 make_submit + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 2 0.0000 0.0000 112 strrchr + 0.0 0.08 0.08 0.00 0.00 0.00 0.00 2 0.0000 0.0000 168 filesize + 0.0 0.00 0.00 0.00 0.00 0.00 0.00 1 0.0000 0.0000 -16 commonfooter + 0.0 0.00 0.11 0.00 0.00 0.00 0.00 2 0.0000 0.0000 0 download_link + 0.0 0.00 0.25 0.00 0.01 0.00 0.00 6 0.0000 0.0017 208 make_image +]]></example> + </slide> Index: presentations/slides/intro/php_tuning1.xml diff -u presentations/slides/intro/php_tuning1.xml:1.1 presentations/slides/intro/php_tuning1.xml:1.2 --- presentations/slides/intro/php_tuning1.xml:1.1 Sat Apr 26 13:52:13 2003 +++ presentations/slides/intro/php_tuning1.xml Sun Sep 21 11:50:33 2003 @@ -5,8 +5,10 @@ <item>Don't go overboard on OOP. Use where appropriate.</item> <item>Same goes for Layers. Abstraction, Indirection, abstract classes.</item> <item>Everything has a cost</item> +<item>Use an opcode cache</item> <item>Watch your regular expressions!</item> <item>Cache! Cache! Cache!</item> +<item>If you have plenty of CPU but limited bandwidth, turn on output compression</item> </list> </slide> Index: presentations/slides/intro/phpstats.png
« previous php.pres (#822) next »