mirror of
https://github.com/php/presentations.git
synced 2026-03-23 23:22:22 +01:00
MySQL Conf technical talk
This commit is contained in:
55
mysql07.xml
Normal file
55
mysql07.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<presentation
|
||||
template="php2"
|
||||
navmode="html"
|
||||
titlecolor="#1111aa"
|
||||
navbarbackground="url(images/trans-ffffff.png)"
|
||||
logo1="images/php-med-trans-light.gif"
|
||||
titlesize="2em"
|
||||
navbarheight="4.1em"
|
||||
>
|
||||
<!--
|
||||
Scale, latency, and security are the key words for this year's talk. In order to build
|
||||
these bigger and faster web applications, PHP has gotten bigger and faster as well.
|
||||
This talk will explore recent PHP development and apply it to the three key words.
|
||||
-->
|
||||
|
||||
<topic>PHP</topic>
|
||||
<title>Performance and Security</title>
|
||||
<event>MySQL Conference</event>
|
||||
<location>Santa Clara</location>
|
||||
<date>Apr.24, 2007</date>
|
||||
<speaker>Rasmus Lerdorf</speaker>
|
||||
<email>rasmus@php.net</email>
|
||||
<url>http://talks.php.net/show/mysql07</url>
|
||||
|
||||
<slide>slides/intro/titlepage.xml</slide>
|
||||
|
||||
<slide>slides/intro/sls.xml</slide>
|
||||
|
||||
<!-- Performance -->
|
||||
<slide>slides/intro/performance_title.xml</slide>
|
||||
<slide>slides/intro/mysqlnd1.xml</slide>
|
||||
<slide>slides/intro/mysqlnd2.xml</slide>
|
||||
<slide>slides/intro/mysqlnd3.xml</slide>
|
||||
<slide>slides/intro/opt_callgrind.xml</slide>
|
||||
<slide>slides/intro/mysqlnd4.xml</slide>
|
||||
<slide>slides/intro/mysqlnd5.xml</slide>
|
||||
|
||||
<!-- Security -->
|
||||
<slide>slides/intro/security_title.xml</slide>
|
||||
<slide>slides/intro/xss_basic.xml</slide>
|
||||
<slide>slides/intro/xss_yrisk.xml</slide>
|
||||
<slide>slides/intro/input_filter2.xml</slide>
|
||||
<slide>slides/intro/xss_type1.xml</slide>
|
||||
<slide>slides/intro/xss_type2.xml</slide>
|
||||
<slide>slides/intro/xss_type3.xml</slide>
|
||||
<slide>slides/intro/xss_type4.xml</slide>
|
||||
<slide>slides/intro/xss_type5.xml</slide>
|
||||
<slide>slides/intro/xss_type6.xml</slide>
|
||||
<slide>slides/intro/xss_type7.xml</slide>
|
||||
<slide>slides/intro/xss_type8.xml</slide>
|
||||
<slide>slides/intro/the_web_is_broken.xml</slide>
|
||||
<slide>slides/intro/xsrf.xml</slide>
|
||||
|
||||
<slide>slides/intro/perfsec_ref.xml</slide>
|
||||
</presentation>
|
||||
BIN
slides/intro/drupal_perf.png
Normal file
BIN
slides/intro/drupal_perf.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
19
slides/intro/mysqlnd1.xml
Normal file
19
slides/intro/mysqlnd1.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<slide title="mysqlnd">
|
||||
|
||||
<break lines="1" />
|
||||
|
||||
<list marginleft="3em" fontsize="5em" title="New MySQL Native Driver" align="center">
|
||||
<bullet> PHP-specific MySQL client library</bullet>
|
||||
<bullet> Much less copying data around</bullet>
|
||||
<bullet> Better L1/L2 cache usage</bullet>
|
||||
</list>
|
||||
|
||||
<break lines="1" />
|
||||
<list marginleft="3em" fontsize="5em" title="Tight Integration with PHP" align="center">
|
||||
<bullet> Memory manager</bullet>
|
||||
<bullet> Streams</bullet>
|
||||
<bullet> Internal zval caching</bullet>
|
||||
<bullet> Persistent connections</bullet>
|
||||
</list>
|
||||
<blurb fontsize="9em" align="center">Sounds Fast!</blurb>
|
||||
</slide>
|
||||
62
slides/intro/mysqlnd2.xml
Normal file
62
slides/intro/mysqlnd2.xml
Normal file
@@ -0,0 +1,62 @@
|
||||
<slide title="mysqlnd">
|
||||
|
||||
<break lines="1" />
|
||||
|
||||
<example fontsize="1em" type="shell" title="A Drupal Page view"><![CDATA[
|
||||
7 Connect root@localhost on
|
||||
7 Init DB drupal
|
||||
7 Query SET NAMES "utf8"
|
||||
7 Query SELECT CASE WHEN status=1 THEN 0 ELSE 1 END FROM access WHERE type = 'host' AND LOWER('192.168.200.104') LIKE LOWER(mask) ORDER BY status DESC LIMIT 0, 1
|
||||
7 Query SELECT u.*, s.* FROM users u INNER JOIN sessions s ON u.uid = s.uid WHERE s.sid = '5dfc4afd45113b5b523c2e5dd9f2ca71'
|
||||
7 Query SELECT data, created, headers, expire FROM cache WHERE cid = 'variables'
|
||||
7 Query SELECT data, created, headers, expire FROM cache_page WHERE cid = 'http://drupal.lerdorf.com/'
|
||||
7 Query SELECT COUNT(pid) FROM url_alias
|
||||
7 Query SELECT name, filename, throttle, bootstrap FROM system WHERE type = 'module' AND status = 1 ORDER BY weight ASC, filename ASC
|
||||
7 Query SELECT data, created, headers, expire FROM cache_menu WHERE cid = '0:en'
|
||||
7 Query SELECT DISTINCT(p.perm) FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN (1)
|
||||
7 Query SELECT data, created, headers, expire FROM cache WHERE cid = 'views_with_inline_args:en'
|
||||
7 Query SELECT COUNT(*) FROM node_access WHERE nid = 0 AND ((gid = 0 AND realm = 'all')) AND grant_view >= 1
|
||||
7 Query SELECT COUNT(*) FROM node n WHERE n.promote = 1 AND n.status = 1
|
||||
7 Query SELECT n.nid, n.sticky, n.created FROM node n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC LIMIT 0, 10
|
||||
7 Query SELECT * FROM system WHERE type = 'theme'
|
||||
7 Query SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE n.nid = 4
|
||||
7 Query SELECT nt.type, nt.* FROM node_type nt ORDER BY nt.type ASC
|
||||
7 Query SELECT runtime, active FROM poll WHERE nid = 4
|
||||
7 Query SELECT chtext, chvotes, chorder FROM poll_choices WHERE nid = 4 ORDER BY chorder
|
||||
7 Query SELECT parent, weight FROM book WHERE vid = 4
|
||||
7 Query SELECT last_comment_timestamp, last_comment_name, comment_count FROM node_comment_statistics WHERE nid = 4
|
||||
7 Query SELECT t.* FROM term_node r INNER JOIN term_data t ON r.tid = t.tid INNER JOIN vocabulary v ON t.vid = v.vid WHERE r.nid = 4 ORDER BY v.weight, t.weight, t.name
|
||||
7 Query SELECT * FROM files f INNER JOIN file_revisions r ON f.fid = r.fid WHERE r.vid = 4 ORDER BY f.fid
|
||||
7 Query SELECT l.lid, ln.nid, url, url_md5, weight, clicks, module, l.link_title AS link_link_title, ln.link_title AS node_link_title FROM links_node ln LEFT JOIN links l ON l.lid=ln.lid WHERE ln.nid=4 AND module='links_related' ORDER BY weight, l.link_title
|
||||
7 Query SELECT * FROM variable WHERE name like 'event_nodeapi_%'
|
||||
7 Query SELECT l.lid, ln.nid, url, url_md5, weight, clicks, module, l.link_title AS link_link_title, ln.link_title AS node_link_title FROM links_node ln LEFT JOIN links l ON l.lid=ln.lid WHERE ln.nid=4 AND module='links_related' ORDER BY weight, l.link_title
|
||||
7 Query SELECT l.lid, ln.nid, url, url_md5, weight, clicks, module, l.link_title AS link_link_title, ln.link_title AS node_link_title FROM links_node ln LEFT JOIN links l ON l.lid=ln.lid WHERE ln.nid=4 AND module='links_weblink' ORDER BY weight, l.link_title
|
||||
7 Query SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE n.nid = 3
|
||||
7 Query SELECT parent, weight FROM book WHERE vid = 3
|
||||
7 Query SELECT last_comment_timestamp, last_comment_name, comment_count FROM node_comment_statistics WHERE nid = 3
|
||||
7 Query SELECT t.* FROM term_node r INNER JOIN term_data t ON r.tid = t.tid INNER JOIN vocabulary v ON t.vid = v.vid WHERE r.nid = 3 ORDER BY v.weight, t.weight, t.name
|
||||
7 Query SELECT * FROM files f INNER JOIN file_revisions r ON f.fid = r.fid WHERE r.vid = 3 ORDER BY f.fid
|
||||
7 Query SELECT data, created, headers, expire FROM cache_filter WHERE cid = '1:098f6bcd4621d373cade4e832627b4f6'
|
||||
7 Query SELECT l.lid, ln.nid, url, url_md5, weight, clicks, module, l.link_title AS link_link_title, ln.link_title AS node_link_title FROM links_node ln LEFT JOIN links l ON l.lid=ln.lid WHERE ln.nid=3 AND module='links_related' ORDER BY weight, l.link_title
|
||||
7 Query SELECT l.lid, ln.nid, url, url_md5, weight, clicks, module, l.link_title AS link_link_title, ln.link_title AS node_link_title FROM links_node ln LEFT JOIN links l ON l.lid=ln.lid WHERE ln.nid=3 AND module='links_related' ORDER BY weight, l.link_title
|
||||
7 Query SELECT l.lid, ln.nid, url, url_md5, weight, clicks, module, l.link_title AS link_link_title, ln.link_title AS node_link_title FROM links_node ln LEFT JOIN links l ON l.lid=ln.lid WHERE ln.nid=3 AND module='links_weblink' ORDER BY weight, l.link_title
|
||||
7 Query SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE n.nid = 2
|
||||
7 Query SELECT parent, weight FROM book WHERE vid = 2
|
||||
7 Query SELECT last_comment_timestamp, last_comment_name, comment_count FROM node_comment_statistics WHERE nid = 2
|
||||
7 Query SELECT t.* FROM term_node r INNER JOIN term_data t ON r.tid = t.tid INNER JOIN vocabulary v ON t.vid = v.vid WHERE r.nid = 2 ORDER BY v.weight, t.weight, t.name
|
||||
7 Query SELECT * FROM files f INNER JOIN file_revisions r ON f.fid = r.fid WHERE r.vid = 2 ORDER BY f.fid
|
||||
7 Query SELECT data, created, headers, expire FROM cache_filter WHERE cid = '1:26387103afc99f55816532529946728e'
|
||||
7 Query SELECT l.lid, ln.nid, url, url_md5, weight, clicks, module, l.link_title AS link_link_title, ln.link_title AS node_link_title FROM links_node ln LEFT JOIN links l ON l.lid=ln.lid WHERE ln.nid=2 AND module='links_related' ORDER BY weight, l.link_title
|
||||
7 Query SELECT l.lid, ln.nid, url, url_md5, weight, clicks, module, l.link_title AS link_link_title, ln.link_title AS node_link_title FROM links_node ln LEFT JOIN links l ON l.lid=ln.lid WHERE ln.nid=2 AND module='links_related' ORDER BY weight, l.link_title
|
||||
7 Query SELECT l.lid, ln.nid, url, url_md5, weight, clicks, module, l.link_title AS link_link_title, ln.link_title AS node_link_title FROM links_node ln LEFT JOIN links l ON l.lid=ln.lid WHERE ln.nid=2 AND module='links_weblink' ORDER BY weight, l.link_title
|
||||
7 Query SELECT DISTINCT b.* FROM blocks b LEFT JOIN blocks_roles r ON b.module = r.module AND b.delta = r.delta WHERE b.theme = 'garland' AND b.status = 1 AND (r.rid IN (1) OR r.rid IS NULL) ORDER BY b.region, b.weight, b.module
|
||||
7 Query SELECT * FROM system WHERE type = 'theme' AND name = 'garland'
|
||||
7 Query SELECT sid FROM sessions WHERE sid = '5dfc4afd45113b5b523c2e5dd9f2ca71'
|
||||
7 Query UPDATE sessions SET uid = 0, cache = 0, hostname = '192.168.200.104', session = '', timestamp = 1177377288 WHERE sid = '5dfc4afd45113b5b523c2e5dd9f2ca71'
|
||||
7 Quit]]></example>
|
||||
|
||||
<blurb fontsize="4em">
|
||||
That's 46 SELECTs and 1 UPDATE for a single page view.
|
||||
</blurb>
|
||||
|
||||
</slide>
|
||||
30
slides/intro/mysqlnd3.xml
Normal file
30
slides/intro/mysqlnd3.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<slide title="mysqlnd">
|
||||
|
||||
<break lines="1" />
|
||||
|
||||
<example fontsize="1.75em" type="shell" title="ext/mysql Baseline"><![CDATA[% http_load -parallel 5 -fetches 100 ~/drupal.txt
|
||||
100 fetches, 5 max parallel, 634100 bytes, in 25.5106 seconds
|
||||
6341 mean bytes/connection
|
||||
3.91994 fetches/sec, 24856.3 bytes/sec
|
||||
msecs/connect: 3.95143 mean, 34.813 max, 1.935 min
|
||||
msecs/first-response: 1242.85 mean, 25450.3 max, 234.405 min
|
||||
HTTP response codes:
|
||||
code 200 -- 100]]></example>
|
||||
|
||||
<example fontsize="1.75em" type="shell" title="ext/mysqli"><![CDATA[100 fetches, 5 max parallel, 634100 bytes, in 25.3368 seconds
|
||||
6341 mean bytes/connection
|
||||
3.94683 fetches/sec, 25026.9 bytes/sec
|
||||
msecs/connect: 2.66605 mean, 6.651 max, 1.981 min
|
||||
msecs/first-response: 1219.1 mean, 2064.9 max, 262.123 min
|
||||
HTTP response codes:
|
||||
code 200 -- 100]]></example>
|
||||
|
||||
<example fontsize="1.75em" type="shell" title="ext/mysqli-nd"><![CDATA[100 fetches, 5 max parallel, 634100 bytes, in 25.7054 seconds
|
||||
6341 mean bytes/connection
|
||||
3.89023 fetches/sec, 24667.9 bytes/sec
|
||||
msecs/connect: 2.63793 mean, 23.317 max, 1.916 min
|
||||
msecs/first-response: 1229.47 mean, 25681.7 max, 260.643 min
|
||||
HTTP response codes:
|
||||
code 200 -- 100]]></example>
|
||||
|
||||
</slide>
|
||||
24
slides/intro/mysqlnd4.xml
Normal file
24
slides/intro/mysqlnd4.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<slide title="now what?">
|
||||
|
||||
<break lines="1" />
|
||||
|
||||
<blurb fontsize="3em">
|
||||
Callgrind to the rescue!
|
||||
</blurb>
|
||||
<example fontsize="1.7em" type="shell" marginright="0.25em"><![CDATA[% valgrind --tool=callgrind --dump-instr=yes -v /usr/sbin/apache -X
|
||||
...
|
||||
% kcachegrind drupal_mysqli1.out]]></example>
|
||||
|
||||
<example fontsize="1.7em" type="shell" title="Install APC" marginright="0.25em"><![CDATA[200 fetches, 5 max parallel, 1.2682e+06 bytes, in 8.97701 seconds
|
||||
6341 mean bytes/connection
|
||||
22.2791 fetches/sec, 141272 bytes/sec
|
||||
msecs/connect: 2.56332 mean, 4.705 max, 1.937 min
|
||||
msecs/first-response: 215.859 mean, 395.53 max, 51.845 min
|
||||
HTTP response codes:
|
||||
code 200 -- 200]]></example>
|
||||
|
||||
<example fontsize="1.7em" type="shell" marginright="0.25em"><![CDATA[% valgrind --tool=callgrind --dump-instr=yes -v /usr/sbin/apache -X
|
||||
...
|
||||
% kcachegrind drupal_mysqli2.out]]></example>
|
||||
|
||||
</slide>
|
||||
37
slides/intro/mysqlnd5.xml
Normal file
37
slides/intro/mysqlnd5.xml
Normal file
@@ -0,0 +1,37 @@
|
||||
<slide title="Time to look at the code">
|
||||
|
||||
<break lines="1" />
|
||||
|
||||
<blurb fontsize="3em">
|
||||
xdebug to the rescue!
|
||||
</blurb>
|
||||
<example fontsize="1.75em" type="shell" marginright="1.25em"><![CDATA[[php.ini]
|
||||
zend_extension=/usr/local/lib/php/extensions/xdebug.so
|
||||
xdebug.profiler_enable=1
|
||||
xdebug.profiler_aggregate = On
|
||||
xdebug.profiler_output_dir=/tmp
|
||||
...
|
||||
|
||||
% kcachegrind drupal_xdebug1.out]]></example>
|
||||
|
||||
<image filename="drupal_perf.png" align="center"/>
|
||||
|
||||
<break lines="1" />
|
||||
|
||||
<example fontsize="1.75em" type="shell" title="Turn on Normal Drupal Cacheing"><![CDATA[500 fetches, 5 max parallel, 3.226e+06 bytes, in 7.7064 seconds
|
||||
6452 mean bytes/connection
|
||||
64.8812 fetches/sec, 418613 bytes/sec
|
||||
msecs/connect: 2.53989 mean, 24.502 max, 1.914 min
|
||||
msecs/first-response: 70.8044 mean, 283.488 max, 46.382 min
|
||||
HTTP response codes:
|
||||
code 200 -- 500]]></example>
|
||||
|
||||
<example fontsize="1.75em" type="shell" title="Turn on Agressive Drupal Cacheing"><![CDATA[1000 fetches, 5 max parallel, 6.452e+06 bytes, in 12.2807 seconds
|
||||
6452 mean bytes/connection
|
||||
81.4287 fetches/sec, 525378 bytes/sec
|
||||
msecs/connect: 4.79381 mean, 86.273 max, 1.9 min
|
||||
msecs/first-response: 50.7257 mean, 129.51 max, 15.991 min
|
||||
HTTP response codes:
|
||||
code 200 -- 1000]]></example>
|
||||
|
||||
</slide>
|
||||
@@ -1,8 +1,7 @@
|
||||
<slide title="Callgrind">
|
||||
<break lines="2" />
|
||||
|
||||
<example fontsize="2.25em" type="shell" title="callgrind"><![CDATA[valgrind --tool=callgrind --collect-jumps==yes \
|
||||
--dump-instr=yes --trace-jump=yes -v \
|
||||
<example fontsize="2.25em" type="shell" title="callgrind"><![CDATA[valgrind --tool=callgrind --dump-instr=yes -v \
|
||||
/usr/sbin/httpd -X]]></example>
|
||||
|
||||
<example fontsize="2.25em" type="shell" title=""><![CDATA[chmod a+rw callgrind.out.XXXX]]></example>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<slide title="Performance">
|
||||
<break lines="10" />
|
||||
<blurb fontsize="18em" align="center">Performance</blurb>
|
||||
<blurb fontsize="18em" marginleft="0.6em">Performance</blurb>
|
||||
</slide>
|
||||
|
||||
10
slides/intro/sls.xml
Normal file
10
slides/intro/sls.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<slide title="SLS">
|
||||
|
||||
<break lines="3" />
|
||||
|
||||
<blurb fontsize="13em" marginleft="3em">Scale</blurb>
|
||||
<break lines="1" />
|
||||
<blurb fontsize="13em" marginleft="3em">Latency</blurb>
|
||||
<break lines="1" />
|
||||
<blurb fontsize="13em" marginleft="3em">Security</blurb>
|
||||
</slide>
|
||||
Reference in New Issue
Block a user