{"id":1099,"date":"2014-10-13T01:18:07","date_gmt":"2014-10-12T16:18:07","guid":{"rendered":"http:\/\/tech.akat.info\/?p=1099"},"modified":"2014-10-13T12:40:17","modified_gmt":"2014-10-13T03:40:17","slug":"php-conference-2014%e3%81%ab%e5%8f%82%e5%8a%a0%e3%81%97%e3%81%be%e3%81%97%e3%81%9f-%e3%81%9d%e3%81%ae%e3%81%ab","status":"publish","type":"post","link":"https:\/\/tech.akat.info\/?p=1099","title":{"rendered":"PHP Conference 2014\u306b\u53c2\u52a0\u3057\u307e\u3057\u305f-\u305d\u306e\u306b-"},"content":{"rendered":"<p>\u3056\u3063\u304f\u308a\u307e\u3068\u3081\u3001\u305d\u306e\u5f8c\u81ea\u5206\u3067\u3084\u3063\u3066\u307f\u305f\u3053\u3068\u3082\u542b\u3080\u3001\u307b\u307c\u30d1\u30af\u30ea<\/p>\n<h1>mysqlnd \u5fb9\u5e95\u89e3\u8aac do_aki\u3055\u3093<\/h1>\n<div class=\"oceanwp-oembed-wrap clr\"><iframe loading=\"lazy\" src=\"https:\/\/www.slideshare.net\/slideshow\/embed_code\/key\/LoBujepbSPbJsx\" width=\"427\" height=\"356\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" style=\"border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;\" allowfullscreen> <\/iframe> <\/p>\n<div style=\"margin-bottom:5px\"> <strong> <a href=\"https:\/\/www.slideshare.net\/do_aki\/20141011-mastering-mysqlnd\" title=\"20141011 mastering mysqlnd\" target=\"_blank\">20141011 mastering mysqlnd<\/a> <\/strong> from <strong><a href=\"http:\/\/www.slideshare.net\/do_aki\" target=\"_blank\">do_aki<\/a><\/strong> <\/div>\n<\/div>\n<h2>mysqlnd\u306b\u3064\u3044\u3066<\/h2>\n<p>MySQL client library\u306f\u305f\u304f\u3055\u3093(ZendDB\u3001PEAR_DB&#8230;)\u3042\u308b\u304c\u3001\u5fc5\u305a<br \/>\n\u30fbmysql extension\uff1aphp4\u306e\u6642\u4ee3\u304b\u3089\u4f7f\u3048\u305f\u53e4\u304f\u304b\u3089\u3042\u308b\u62e1\u5f35<br \/>\n\u30fbmysqli extension\uff1amysql \u62e1\u5f35\u3092\u5237\u65b0\u3059\u308b\u5f62\u3067php5\u304b\u3089\u5229\u7528\u53ef\u80fd\u306a\u30e2\u30b8\u30e5\u30fc\u30eb<br \/>\n\u30fbpdo extension\uff1a\u305d\u308c\u81ea\u8eab\u304cDB \u62bd\u8c61\u5c64\u3067\u3042\u308a\u3001\u914d\u4e0b\u306b\u591a\u304f\u306e DBMS \u306b\u5bfe\u5fdc\u3057\u305f\u30c9\u30e9\u30a4\u30d0\u304c\u5b58\u5728\u3001\u305d\u306e\u306a\u304b\u306e\u3072\u3068\u3064\u304cmysql<br \/>\n\u3092\u547c\u3073\u51fa\u3057\u3066\u3044\u308b<br \/>\n\u3053\u308c\u3089\u304cMySQL\u3068\u76f4\u63a5\u3084\u308a\u53d6\u308a\u3059\u308b\u304b\u3068\u3044\u3048\u3070\u305d\u3046\u3067\u3082\u306a\u304f<br \/>\nmysqlnd \/ libmysql \u2192\u3000\u30a2\u30af\u30bb\u30b9\u3084\u30d7\u30ed\u30c8\u30b3\u30eb\u5224\u65ad\u306a\u3069<br \/>\nmysql \/ mysqli \/ pdo\u3000\u2192\u3000\u5b9f\u969b\u306b\u63a5\u7d9a<br \/>\n\u3068\u306a\u308a\u3001\u8a73\u3057\u304f\u306f\u4e0b\u56f3<br \/>\n<a href=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/10\/Screenshot-2014-10-13-at-02.36.06.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/10\/Screenshot-2014-10-13-at-02.36.06.png\" alt=\"Screenshot 2014-10-13 at 02.36.06\" width=\"741\" height=\"617\" class=\"alignnone size-full wp-image-1102\" \/><\/a><\/p>\n<h2>mysqlnd vs libmysql<\/h2>\n<p>\u30fblibmysql\u306fMySQL\u5074\u304c\u7528\u610f\u3057\u3066\u3044\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3001MySQL\u5229\u7528\u8005\u306b\u5bfe\u3057\u3066C\u8a00\u8a9e\u30ec\u30d9\u30eb\u3067\u306eAPI\u3092\u63d0\u4f9b\u3059\u308b\u3001Oracle(MySQL AB)\u304b\u3089\u3042\u308b\u67af\u308c\u305f\u6280\u8853\u3001\u3057\u304b\u3057GPLv2\u30e9\u30a4\u30bb\u30f3\u30b9<br \/>\n\u30fbmysqlnd\u306fZend Engine\u5185\u306b\u5b58\u5728\u3059\u308b\u3002MySQL Native Driver\u3068\u3044\u3046\u3001PHP\u306e\u62e1\u5f35\u30e2\u30b8\u30e5\u30fc\u30eb\u3068\u3057\u3066\u5b9f\u88c5\u3055\u308c\u305f\u3001MySQL\u306e\u30cd\u30a4\u30c6\u30a3\u30d6\u30af\u30e9\u30a4\u30a2\u30f3\u30c8<br \/>\n\u3000\u6bd4\u8f03\u7684\u65b0\u3057\u304fmysql4.1\u4ee5\u524d\u306b\u306f\u63a5\u7d9a\u3067\u304d\u306a\u3044<br \/>\n\u3000\u307e\u305flibmysql\u3068\u9055\u3044\u3001my.cnf\u3092\u8aad\u307f\u8fbc\u307e\u306a\u3044\u305f\u3081\u3001\u8a2d\u5b9a\u306b\u3088\u3063\u3066\u306f\u6587\u5b57\u30b3\u30fc\u30c9\u3067\u5f71\u97ff\u304c\u3042\u308b\u304b\u3082\u3002\u30d7\u30e9\u30b0\u30a4\u30f3(mysqlnd_ms)\u3067\u30ed\u30fc\u30c9\u30d0\u30e9\u30f3\u30b7\u30f3\u30b0\u53ef\u80fd\u3001\u554f\u984c\u306a\u304f\u52d5\u4f5c\u3059\u308b\u3089\u3057\u3044<br \/>\n<a href=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/10\/Screenshot-2014-10-13-at-02.46.30.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/10\/Screenshot-2014-10-13-at-02.46.30.png\" alt=\"Screenshot 2014-10-13 at 02.46.30\" width=\"747\" height=\"619\" class=\"alignnone size-full wp-image-1104\" \/><\/a><\/p>\n<p>php5.4\u79fb\u884c\u306fmysqlnd\u304c\u30c7\u30d5\u30a9\u30eb\u30c8\u3068\u306a\u308a\u3001libmysql\u306f\u30aa\u30d7\u30b7\u30e7\u30f3\u3068\u306a\u3063\u305f<br \/>\n(libmysql\u306f\u975e\u63a8\u5968\u3068\u306a\u3063\u305f\u308f\u3051\u3067\u306f\u306a\u3044)<\/p>\n<pre class=\"brush: plain; title: \u3069\u3061\u3089\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\u65b9\u6cd5\u3002debian\u306f\u30d1\u30c3\u30b1\u30fc\u30b8\u3060\u3068php5-mysql\u304bphp5-mysqlnd\u3067\u6c7a\u307e\u308b; notranslate\" title=\"\u3069\u3061\u3089\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\u65b9\u6cd5\u3002debian\u306f\u30d1\u30c3\u30b1\u30fc\u30b8\u3060\u3068php5-mysql\u304bphp5-mysqlnd\u3067\u6c7a\u307e\u308b\">\r\nroot@hostname:\/etc\/apt# php -i | grep mysqlnd \r\nAdditional .ini files parsed =&gt; \/etc\/php5\/cli\/conf.d\/10-mysqlnd.ini,\r\nClient API version =&gt; mysqlnd 5.0.10 - 20111026 - $Id: b0b3b15c693b7f6aeb3aa66b646fee339f175e39 $\r\nClient API library version =&gt; mysqlnd 5.0.10 - 20111026 - $Id: b0b3b15c693b7f6aeb3aa66b646fee339f175e39 $\r\nmysqlnd\r\nmysqlnd =&gt; enabled\r\nVersion =&gt; mysqlnd 5.0.10 - 20111026 - $Id: b0b3b15c693b7f6aeb3aa66b646fee339f175e39 $\r\nLoaded plugins =&gt; mysqlnd,example,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password\r\nmysqlnd statistics =&gt;  \r\nClient API version =&gt; mysqlnd 5.0.10 - 20111026 - $Id: b0b3b15c693b7f6aeb3aa66b646fee339f175e39 $\r\n<\/pre>\n<h2>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306b\u3064\u3044\u3066<\/h2>\n<p><a href=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/10\/Screenshot-2014-10-13-at-11.40.14.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/10\/Screenshot-2014-10-13-at-11.40.14.png\" alt=\"Screenshot 2014-10-13 at 11.40.14\" width=\"741\" height=\"602\" class=\"alignnone size-full wp-image-1109\" \/><\/a><\/p>\n<p>\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u306fmysqlnd\u306e\u307b\u3046\u304c\u5c11\u306a\u3044<br \/>\nmysqlnd\u306b\u3064\u3044\u3066\u306fmysqli\/pdo\u3092\u7d4c\u7531\u3057\u306a\u3044\u305f\u3081\u3001\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u304c\u534a\u5206\u306b\u306a\u308b<br \/>\nmemory_get_usage\u3067\u306fmysqli\/pdo\u3067\u306e\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u306f\u8a08\u4e0a\u3059\u308b\u304c\u3001libmysql\u306b\u3066\u306e\u30e1\u30e2\u30ea\u3092\u8a08\u4e0a\u3057\u306a\u3044\u305f\u3081\u3001\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u304c\u5909\u308f\u3089\u306a\u3044\u3088\u3046\u306b\u307f\u3048\u308b<\/p>\n<p>\u305f\u3060\u3057mysqlnd\u306b\u3064\u3044\u3066\u3001\u5927\u304d\u306a\u30c6\u30fc\u30d6\u30eb\u3092\u4e57\u305b\u308b\u3068\u30e1\u30e2\u30ea\u4f7f\u7528\u9577\u304c\u5927\u304d\u304f\u306a\u308b\u305f\u3081\u6ce8\u610f<br \/>\n\u3053\u308c\u306f\u4ed5\u69d8\u3068\u3055\u308c\u3066\u304a\u308a\u3001php5.6\u304b\u3089\u306f\u56de\u907f\u53ef\u80fd\u3001\u3057\u304b\u3057mysqli\u3092\u5229\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b<\/p>\n<h2>\u3069\u3061\u3089\u304c\u65e9\u3044\u304b\u3084\u3063\u3066\u307f\u305f<\/h2>\n<p>php5-mysql vs php5-mysqlnd<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nroot@hostname:\/usr\/local\/src# wget -d http:\/\/php5.up.seesaa.net\/web\/T01Prefecture.zip\r\n...\r\nroot@hostname:\/usr\/local\/src# unzip T01Prefecture.zip \r\nArchive:  T01Prefecture.zip\r\n  inflating: T01Prefecture.sql \r\nroot@hostname:\/usr\/local\/src# mysql -uroot SampleDB050 &lt; T01Prefecture.sql \r\nroot@hostname:\/usr\/local\/src# cat \/var\/www\/htdocs\/index.php \r\n&lt;?php\r\n  $url = &quot;localhost&quot;;\r\n  $user = &quot;root&quot;;\r\n  $pass = &quot;&quot;;\r\n  $db = &quot;SampleDB050&quot;;\r\n\r\n  $start = microtime(true);\r\n  $max = 1000;\r\n\r\n  for($i = 0; $i &lt; $max; $i++) {   \r\n  \/\/ MySQL\u3078\u63a5\u7d9a\u3059\u308b\r\n  $link = mysql_connect($url,$user,$pass) or die(&quot;MySQL\u3078\u306e\u63a5\u7d9a\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002&quot;);\r\n  \/\/ \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u9078\u629e\u3059\u308b\r\n  $sdb = mysql_select_db($db,$link) or die(&quot;\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u9078\u629e\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002&quot;);\r\n  \/\/ \u30af\u30a8\u30ea\u3092\u9001\u4fe1\u3059\u308b\r\n  $sql = &quot;SELECT * FROM T01Prefecture&quot;;\r\n  $result = mysql_query($sql, $link) or die(&quot;\u30af\u30a8\u30ea\u306e\u9001\u4fe1\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002&lt;br \/&gt;SQL:&quot;.$sql);\r\n  \/\/\u7d50\u679c\u30bb\u30c3\u30c8\u306e\u884c\u6570\u3092\u53d6\u5f97\u3059\u308b\r\n  $rows = mysql_num_rows($result);\r\n  \/\/\u7d50\u679c\u4fdd\u6301\u7528\u30e1\u30e2\u30ea\u3092\u958b\u653e\u3059\u308b\r\n  mysql_free_result($result);\r\n  \/\/ MySQL\u3078\u306e\u63a5\u7d9a\u3092\u9589\u3058\u308b\r\n  mysql_close($link) or die(&quot;MySQL\u5207\u65ad\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002&quot;);\r\n  }\r\n\r\n  $end = microtime(true);\r\n  $tm = $end - $start;\r\n  echo $tm;\r\n?&gt;\r\n#####\r\n\u5b9f\u884c\u3057\u305f\u3068\u3053\u308dphp5-mysql\u304c0.5\u79d2\u524d\u5f8c\u3001php5-mysqlnd\u304c0.7\u79d2\u524d\u5f8c\u3068php5-mysql\u304c\u65e9\u3044\u3068\u3044\u3046\u5207\u306a\u3044\u7d50\u679c\u306b\u7d42\u308f\u3063\u305f\r\n\u304a\u305d\u3089\u304f\u63a5\u7d9a\u65b9\u6cd5(mysql_connect)\u306b\u3088\u308b\u3082\u306e\u3060\u3068\u601d\u308f\u308c\u308b\r\n#####\r\n\r\nroot@hostname:\/usr\/local\/src# cat \/var\/www\/htdocs\/index2.php \r\n&lt;?php\r\n  $url = &quot;localhost&quot;;\r\n  $user = &quot;root&quot;;\r\n  $pass = &quot;&quot;;\r\n  $db = &quot;SampleDB050&quot;;\r\n\r\n  $start = microtime(true);\r\n  $max = 1000;\r\n\r\n  for($i = 0; $i &lt; $max; $i++) {   \r\n  \/\/ MySQL\u3078\u63a5\u7d9a\u3059\u308b\r\n  $mysqli = new mysqli($url,$user,$pass,$db);\r\n  if (mysqli_connect_error()) {\r\n  die('\u63a5\u7d9a\u5931\u6557\u3067\u3059\u3002'.mysqli_connect_error());\r\n  }\r\n  \/\/ MySQL\u3078\u306e\u63a5\u7d9a\u3092\u9589\u3058\u308b\r\n  $mysqli-&gt;close();\r\n  }\r\n\r\n  $end = microtime(true);\r\n  $tm = $end - $start;\r\n  echo $tm;\r\n?&gt;\r\n\r\n#####\r\n\u5b9f\u884c\u3057\u305f\u3068\u3053\u308dphp5-mysql\u304c0.30\u79d2\u524d\u5f8c\u3001php5-mysqlnd\u304c0.35\u79d2\u524d\u5f8c\u3068php5-mysql\u304c\u5c11\u3057\u65e9\u3044\u3068\u3044\u3046\u5207\u306a\u3044\u7d50\u679c\u306b\u7d42\u308f\u3063\u305f\r\nPG\u529b\u306e\u306a\u3055\u304c\u51fa\u3066\u3044\u308b\u305f\u3081\u3001\u307e\u305f\u6a5f\u4f1a\u304c\u3042\u308c\u3070\u8a66\u3059\r\n#####\r\n<\/pre>\n<h1>\u53c2\u8003URL<\/h1>\n<p>MySQL \u3068 PHP \u306e\u9593\u3092\u8a73\u3057\u304f\u898b\u3066\u307f\u308b<br \/>\nhttp:\/\/d.hatena.ne.jp\/do_aki\/20111214\/1323831558<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3056\u3063\u304f\u308a\u307e\u3068\u3081\u3001\u305d\u306e\u5f8c\u81ea\u5206\u3067\u3084\u3063\u3066\u307f\u305f\u3053\u3068\u3082\u542b\u3080\u3001\u307b\u307c\u30d1\u30af\u30ea mysqlnd \u5fb9\u5e95\u89e3\u8aac do_aki\u3055\u3093 20141011 mastering mysqlnd from do_aki mysqlnd\u306b\u3064\u3044\u3066 MySQL  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[14,9],"tags":[],"_links":{"self":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/1099"}],"collection":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1099"}],"version-history":[{"count":11,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/1099\/revisions"}],"predecessor-version":[{"id":1113,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/1099\/revisions\/1113"}],"wp:attachment":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1099"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1099"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1099"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}