最先端PHPフレームワークLithiumのチュートリアルを実際に体験してみました。
MongoDB等のデータベースを使用したPHPフレームワークが無いかと調べたところ、通称CakePHP3と呼ばれるフレームワークLithiumがあるのを知り、実際にインストールしてみる事にしました。
チュートリアル(ブログの様な記事投稿システム)もあるので今回実際に体験してみましたので、簡単に流れを記事にしました。
チュートリアル
http://rad-dev.org/lithium/wiki/drafts/blog-tutorial
lithiumのダウンロード&解凍
最新版はlithium-0.9になりますね。
wget http://d10xg45o6p6dbl.cloudfront.net/projects/l/lithium/lithium-0.9.zip unzip lithium-0.9.zip mv lithium-0.9 lithium
apacheのドキュメントルート設定を、解凍したディレクトリ内にあるapp/webrootに設定します。
(apacheのrestartも忘れずに)
また、MongoDBをインストールしMongoDBのプロセスも立ち上げておきます。
0.8と若干画面が変わりましたね。
チュートリアルその1
まず、さきほどの初期画面に表示されている指示に従います。
chmod -R 0777 /var/www/lithium/app/resources
その後チュートリアルに戻り下記のコマンドでphpからMongoDBを操作するプラグインをインストールします。
sudo pecl install mongo
app/config/connections.phpに下記を追加します。
// MongoDB Connection Connections::add('default', array('type' => 'MongoDb', 'database' => 'blog', 'host' => 'localhost'));
app/config/bootstrap.phpの46行目のコメントを外します。
require __DIR__ . '/connections.php';
すると初期画面が下記のようになり、初期設定が完了した事がわかります。
チュートリアルその2
実際にMVCを作成するプロセスです。
まずはModelを作成します。
app/models/Post.phpを作成し下記の記述をします。
<?php namespace app\models; class Post extends \lithium\data\Model { }
これでModelの作成完了です。
次にControllerの作成です。
app/controllers/PostsController.phpを作成し下記の記述をします。
<?php namespace app\controllers; use app\models\Post; class PostsController extends \lithium\action\Controller { public function index() { $posts = Post::all(); return compact('posts'); } public function add() { $success = false; if ($this->request->data) { $post = Post::create($this->request->data); $success = $post->save(); } return compact('success'); } }
これでControllerの作成完了です。
次にViewを作成します。
まずブログの記事一覧を表示する、index.html.phpを作成します。
app/views/posts/index.html.php
<?php foreach($posts as $post): ?> <article> <h1><?=$post->title ?></h1> <p><?=$post->body ?></p> </article> <?php endforeach; ?>
次にブログの書込み用の画面を作成します。
app/views/posts/add.html.php
<?php if ($success): ?> <p>Post Successfully Saved</p> <?php endif; ?> <?=$this->form->create(); ?> <?=$this->form->field('title');?> <?=$this->form->field('body', array('type' => 'textarea'));?> <?=$this->form->submit('Add Post'); ?> <?=$this->form->end(); ?>
チュートリアル(その3)
MVCの作成は終わりました。
実際にブラウザからアクセスしてみたいと思います。
http://sample.com/posts/add
下記の様な投稿画面が表示されました。
綺麗なフォームが簡単に生成されるヘルパーの様ですね。
入力欄が大きいので、iPhoneからの投稿も楽でした。
http://sample.com/posts
下記は記事一覧画面ですね。
まとめ
Lithiumはファイル数やディレクトリの配置を見てとても軽量で薄い印象を受けましたが、それと同時にパワフルなフレームワークだなと思いました。
MongoDBを採用しているのも評価出来ます。
後は日本語のノウハウが欲しいところです!
時間がある時に少しずつ勉強していきたいと思います。
[PR]Spreeの情報を集めています。
ECを持ちたい方、仕事でECを使いたい方向けのコミュニティサイトです。
このサイトでは世界で最も使用されているECの1つであるSpreeについての情報を提供しています。
http://spreecommerce.jp/
MongoDB,CouchDB,MySQL,memcacheデータをPHPから読み込み&書き込み速度を検証してみました!(その2)
前回、MongoDB,CouchDB,MySQL,memcacheの読み込み&書き込み速度を検証してみました。
MongoDB,CouchDB,MySQL,memcacheデータをPHPから読み込み&書き込み速度を検証してみました! - @camelmasaの開発日記
下記の原因で予想していたような結果を出す事が出来ませんでした。
・MongoDBでコネクションプーリングをしていなかった。
・CouchDBのHTTPリクエスト方法が遅かった。
id:yssk22さんのコメントにより上記の部分を修正する事が出来ましたので再度検証してみました。
gt
CouchDB:0.10.1
MySQL:5.1.43
memcache:1.2.8
CPU:AMD(の何か)
メモリ:4GB
(ざっくり検証です。)
読み込み時のソース
前回と一緒で"test"データベースの"test"テーブル(コレクション)の"test"データをphpから読み込みするプログラムです。
<?php $ch = curl_init("http://192.168.0.30:5984/"); $fp = fopen("test/1ab25e328d1f36b2895671666491e48f", "w"); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch);
前回、PEARパッケージであるHTTP_Requestを用いて検証して物凄く遅かったのですが、cURL関数を使って通信する事で速度が飛躍的に向上する事が期待できます。
mongodb.php
<?php $mongo = new Mongo(); $db = $mongo->selectDB("test"); $col = $db->selectCollection("test"); $cursor = $col->findOne();
前回コネクションプーリングしていなかったので今回はコネクションプーリングして検証します。
コンストラクタの第3引数にtrueをする事でプーリングを確保出来ます。
<?php <?php $link = mysql_pconnect('localhost', 'user', 'pass'); mysql_select_db('mytest', $link); $result = mysql_query('SELECT `test` FROM `test` LIMIT 0,1;');
memcache.php
<?php $memcache = new Memcache; $memcache->connect('localhost', 11211) or die ("Could not connect"); $memcache->get('test');
読み込み結果
ab -c 100 -n 1000 'http://192.168.0.30/couchdb.php' Server Software: Apache/2.2.3 Server Hostname: 192.168.0.30 Server Port: 80 Document Path: /couchdb.php Document Length: 41 bytes Concurrency Level: 100 Time taken for tests: 3.152094 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 232000 bytes HTML transferred: 41000 bytes Requests per second: 317.25 [#/sec] (mean) Time per request: 315.209 [ms] (mean) Time per request: 3.152 [ms] (mean, across all concurrent requests) Transfer rate: 71.70 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 2 7.9 0 31 Processing: 26 302 112.4 248 813 Waiting: 26 302 112.5 248 813 Total: 26 305 112.7 248 813 Percentage of the requests served within a certain time (ms) 50% 248 66% 262 75% 349 80% 443 90% 515 95% 525 98% 534 99% 538 100% 813 (longest request)
mongodb.php
ab -c 100 -n 1000 'http://192.168.0.30/mongodb.php' Benchmarking 192.168.0.30 (be patient) Server Software: Apache/2.2.3 Server Hostname: 192.168.0.30 Server Port: 80 Document Path: /mongodb.php Document Length: 0 bytes Concurrency Level: 100 Time taken for tests: 1.404074 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 190570 bytes HTML transferred: 0 bytes Requests per second: 712.21 [#/sec] (mean) Time per request: 140.407 [ms] (mean) Time per request: 1.404 [ms] (mean, across all concurrent requests) Transfer rate: 132.47 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 2 7.2 0 30 Processing: 10 129 88.5 124 844 Waiting: 9 128 88.4 124 843 Total: 29 131 88.9 124 865 Percentage of the requests served within a certain time (ms) 50% 124 66% 125 75% 130 80% 130 90% 145 95% 152 98% 191 99% 750 100% 865 (longest request)
ab -c 100 -n 1000 'http://192.168.0.30/mysql.php' Benchmarking 192.168.0.30 (be patient) Server Software: Apache/2.2.3 Server Hostname: 192.168.0.30 Server Port: 80 Document Path: /mysql.php Document Length: 0 bytes Concurrency Level: 100 Time taken for tests: 1.533586 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 190000 bytes HTML transferred: 0 bytes Requests per second: 652.07 [#/sec] (mean) Time per request: 153.359 [ms] (mean) Time per request: 1.534 [ms] (mean, across all concurrent requests) Transfer rate: 120.63 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 3 6.2 0 25 Processing: 13 142 125.8 135 1512 Waiting: 9 141 126.1 134 1510 Total: 20 146 126.1 138 1528 Percentage of the requests served within a certain time (ms) 50% 138 66% 147 75% 149 80% 151 90% 155 95% 159 98% 165 99% 182 100% 1528 (longest request)
memcache.php
Benchmarking 192.168.0.30 (be patient) Server Software: Apache/2.2.3 Server Hostname: 192.168.0.30 Server Port: 80 Document Path: /memcache.php Document Length: 0 bytes Concurrency Level: 100 Time taken for tests: 1.305582 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 190950 bytes HTML transferred: 0 bytes Requests per second: 765.94 [#/sec] (mean) Time per request: 130.558 [ms] (mean) Time per request: 1.306 [ms] (mean, across all concurrent requests) Transfer rate: 142.47 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 4 6.7 1 28 Processing: 26 121 30.1 129 188 Waiting: 25 116 29.5 124 187 Total: 26 126 33.2 132 193 Percentage of the requests served within a certain time (ms) 50% 132 66% 141 75% 148 80% 153 90% 164 95% 171 98% 179 99% 183 100% 193 (longest request)
読み込み結果検証
Time taken for testsが
memcache>MOngoDB>MySQL>CouchDB
の順番になりましたね。
これは納得がいく順番ですね。
前回同じ条件でのcouchdb.phpが9.587989 secondsでしたが、今回は3.152094 secondsと飛躍的に増加しました!
又MongoDBをコネクションプーリングする事でも処理が早くなりました。
下記が接続時のログですが、1000回のアクセスにも係わらず21回しか新規の接続をしていない事が確認できます。
Fri Feb 26 12:25:52 db version v1.2.2, pdfile version 4.5 Fri Feb 26 12:25:52 git version: 8a4fb8b1c7cb78648c55368d806ba35054f6be54 Fri Feb 26 12:25:52 sys info: Linux domU-12-31-39-01-70-B4 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_37 Fri Feb 26 12:25:52 waiting for connections on port 27017 Fri Feb 26 12:27:02 connection accepted from 192.168.0.30:51154 #1 Fri Feb 26 12:27:02 connection accepted from 192.168.0.30:51155 #2 Fri Feb 26 12:27:03 connection accepted from 192.168.0.30:51156 #3 Fri Feb 26 12:27:03 connection accepted from 192.168.0.30:51157 #4 Fri Feb 26 12:27:03 connection accepted from 192.168.0.30:51158 #5 Fri Feb 26 12:27:03 connection accepted from 192.168.0.30:51159 #6 Fri Feb 26 12:27:03 connection accepted from 192.168.0.30:51160 #7 Fri Feb 26 12:27:03 connection accepted from 192.168.0.30:51161 #8 Fri Feb 26 12:27:03 connection accepted from 192.168.0.30:51162 #9 Fri Feb 26 12:27:03 connection accepted from 192.168.0.30:51163 #10 Fri Feb 26 12:27:03 connection accepted from 192.168.0.30:51164 #11 Fri Feb 26 12:27:03 connection accepted from 192.168.0.30:51165 #12 Fri Feb 26 12:27:03 connection accepted from 192.168.0.30:51166 #13 Fri Feb 26 12:27:03 connection accepted from 192.168.0.30:51167 #14 Fri Feb 26 12:27:03 connection accepted from 192.168.0.30:51168 #15 Fri Feb 26 12:27:03 connection accepted from 192.168.0.30:51169 #16 Fri Feb 26 12:27:03 connection accepted from 192.168.0.30:51170 #17 Fri Feb 26 12:27:03 connection accepted from 192.168.0.30:51171 #18 Fri Feb 26 12:27:03 connection accepted from 192.168.0.30:51172 #19 Fri Feb 26 12:27:03 connection accepted from 192.168.0.30:51173 #20 Fri Feb 26 12:27:03 connection accepted from 192.168.0.30:51442 #21 Fri Feb 26 12:27:04 end connection 192.168.0.30:51161
次は書き込み時の検証してみます。
書き込み時のソース
<?php $ch = curl_init("http://192.168.0.30:5984/"); $fp = fopen("test", "w"); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, '{"test":"test"}'); curl_exec($ch);
mongodb_write.php
<?php $mongo = new Mongo('192.168.0.30:27017',true,true); $db = $mongo->selectDB("test"); $col = $db->selectCollection("test"); $col->insert(array("test" => "test"));
<?php $link = mysql_pconnect('localhost', 'user', 'pass'); mysql_select_db('mytest', $link); $result = mysql_query("INSERT INTO `test` VALUES ('test');");
memcache_write.php
<?php $memcache = new Memcache; $memcache->connect('localhost', 11211) or die ("Could not connect"); $memcache->set("test", "test");
書き込み結果
ab -c 100 -n 1000 'http://192.168.0.30/couchdb_write.php' Benchmarking 192.168.0.30 (be patient) Server Software: Apache/2.2.3 Server Hostname: 192.168.0.30 Server Port: 80 Document Path: /couchdb_write.php Document Length: 64 bytes Concurrency Level: 100 Time taken for tests: 3.193331 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 255255 bytes HTML transferred: 64064 bytes Requests per second: 313.15 [#/sec] (mean) Time per request: 319.333 [ms] (mean) Time per request: 3.193 [ms] (mean, across all concurrent requests) Transfer rate: 77.98 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 38 31.2 33 117 Processing: 110 268 92.0 239 561 Waiting: 3 237 90.8 217 537 Total: 112 306 106.7 275 642 Percentage of the requests served within a certain time (ms) 50% 275 66% 300 75% 315 80% 353 90% 507 95% 556 98% 595 99% 616 100% 642 (longest request)
mongodb_write.php
ab -c 100 -n 1000 'http://192.168.0.30/mongodb_write.php' Benchmarking 192.168.0.30 (be patient) Server Software: Apache/2.2.3 Server Hostname: 192.168.0.30 Server Port: 80 Document Path: /mongodb_write.php Document Length: 0 bytes Concurrency Level: 100 Time taken for tests: 1.227498 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 190000 bytes HTML transferred: 0 bytes Requests per second: 814.67 [#/sec] (mean) Time per request: 122.750 [ms] (mean) Time per request: 1.227 [ms] (mean, across all concurrent requests) Transfer rate: 150.71 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 11 7.7 11 30 Processing: 25 105 18.4 109 131 Waiting: 3 94 19.8 92 121 Total: 25 116 19.9 119 160 Percentage of the requests served within a certain time (ms) 50% 119 66% 126 75% 131 80% 133 90% 138 95% 141 98% 145 99% 150 100% 160 (longest request)
ab -c 100 -n 1000 'http://192.168.0.30/mysql_write.php' Benchmarking 192.168.0.30 (be patient) Server Software: Apache/2.2.3 Server Hostname: 192.168.0.30 Server Port: 80 Document Path: /mysql_write.php Document Length: 0 bytes Concurrency Level: 100 Time taken for tests: 1.480484 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 190000 bytes HTML transferred: 0 bytes Requests per second: 675.45 [#/sec] (mean) Time per request: 148.048 [ms] (mean) Time per request: 1.480 [ms] (mean, across all concurrent requests) Transfer rate: 124.96 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 1.6 0 9 Processing: 5 139 57.9 151 619 Waiting: 5 139 58.0 151 619 Total: 5 140 57.8 151 625 Percentage of the requests served within a certain time (ms) 50% 151 66% 154 75% 155 80% 157 90% 186 95% 213 98% 224 99% 332 100% 625 (longest request)
memcache_write.php
ab -c 100 -n 1000 'http://192.168.0.30/memcache_write.php' Benchmarking 192.168.0.30 (be patient) Server Software: Apache/2.2.3 Server Hostname: 192.168.0.30 Server Port: 80 Document Path: /memcache_write.php Document Length: 0 bytes Concurrency Level: 100 Time taken for tests: 1.244228 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 190190 bytes HTML transferred: 0 bytes Requests per second: 803.71 [#/sec] (mean) Time per request: 124.423 [ms] (mean) Time per request: 1.244 [ms] (mean, across all concurrent requests) Transfer rate: 148.69 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 8 10.6 1 37 Processing: 15 112 35.4 124 192 Waiting: 7 106 33.5 118 191 Total: 32 120 39.1 129 199 Percentage of the requests served within a certain time (ms) 50% 129 66% 143 75% 150 80% 156 90% 165 95% 175 98% 185 99% 190 100% 199 (longest request)
全体を通したまとめ
書き込み時のTime taken for testsが
MongoDB>memcache>MySQL>CouchDB
の順番になりましたね。
こちらも納得がいく順番ですね!
MongoDB早いですね!!!流石です。
CouchDBはこれぐらいの速さなのですかね?
色々なドキュメントを見ると、MongoDBより遅いという記事を見ますが…。
あとがき
今度はこうしたらCouchDBが早くなるよ!的なアドバイス欲しいな〜。(あるかな?)
上記のテストサーバーは家でそのままにしてあるので、こんなテストして!っていう場合コメント下さい。
最後にid:yssk22さん有難う御座います!
[PR]Spreeの情報を集めています。
ECを持ちたい方、仕事でECを使いたい方向けのコミュニティサイトです。
このサイトでは世界で最も使用されているECの1つであるSpreeについての情報を提供しています。
http://spreecommerce.jp/
MongoDB,CouchDB,MySQL,memcacheデータをPHPから読み込み&書き込み速度を検証してみました!
前回、前前回とMongoDB,CouchDBのインストール方法やphpからの使用方法を記事にしました。
CentOS5.4にCouchDBをインストールする方法! - @camelmasaの開発日記
CouchDBをphpから操作する方法。 - @camelmasaの開発日記
CentOS5.4にMongoDBをインストールする方法! - @camelmasaの開発日記
MongoDBをphpから操作する方法。 - @camelmasaの開発日記
MongoDBとCouchDBにMySQL(MyISAM)とmemcacheを加えて読み込み(SELECT)と書き込み(INSERT)の速度を検証してみたいと思います。
環境
OS:CentOS5.4
PHP:5.3.1
MongoDB:1.2.2
CouchDB:0.10.1
MySQL:5.1.43
memcache:1.2.8
CPU:AMD(の何か)
メモリ:4GB
(ざっくりと検証です。)
読み取り時のソース
簡単に、"test"データベースの"test"テーブル(コレクション)の"test"データをphpから読み込みするプログラムです。
こんなソースで良いのか。
<?php require_once "HTTP/Request.php"; $http = new HTTP_Request('http://192.168.80.139:5984/test/93e4b62c166489b5ff94600e3003db88'); $response = $http->sendRequest();
mongodb.php
<?php $mongo = new Mongo(); $db = $mongo->selectDB("test"); $col = $db->selectCollection("test"); $cursor = $col->findOne();
<?php $link = mysql_pconnect('localhost', 'user', 'pass'); mysql_select_db('mytest', $link); $result = mysql_query('SELECT `test` FROM `test`;');
memcache.php
<?php $memcache = new Memcache; $memcache->connect('localhost', 11211) or die ("Could not connect"); $memcache->get('test');
読み込み結果
ab -c 100 -n 1000 'http://192.168.0.30/couchdb.php' This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright 2006 The Apache Software Foundation, http://www.apache.org/ Benchmarking 192.168.0.30 (be patient) Server Software: Apache/2.2.3 Server Hostname: 192.168.0.30 Server Port: 80 Document Path: /couchdb.php Document Length: 0 bytes Concurrency Level: 100 Time taken for tests: 9.587989 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 190000 bytes HTML transferred: 0 bytes Requests per second: 104.30 [#/sec] (mean) Time per request: 958.799 [ms] (mean) Time per request: 9.588 [ms] (mean, across all concurrent requests) Transfer rate: 19.29 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 1.5 0 9 Processing: 22 926 923.1 650 9554 Waiting: 21 860 568.4 650 5877 Total: 22 927 923.5 650 9555 Percentage of the requests served within a certain time (ms) 50% 650 66% 662 75% 783 80% 1099 90% 1565 95% 1735 98% 3220 99% 5656 100% 9555 (longest request)
mongodb.php
ab -c 100 -n 1000 'http://192.168.0.30/mongodb.php' This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright 2006 The Apache Software Foundation, http://www.apache.org/ Benchmarking 192.168.0.30 (be patient) Server Software: Apache/2.2.3 Server Hostname: 192.168.0.30 Server Port: 80 Document Path: /mongodb.php Document Length: 0 bytes Concurrency Level: 100 Time taken for tests: 1.939626 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 190000 bytes HTML transferred: 0 bytes Requests per second: 515.56 [#/sec] (mean) Time per request: 193.963 [ms] (mean) Time per request: 1.940 [ms] (mean, across all concurrent requests) Transfer rate: 95.38 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 1.5 0 8 Processing: 35 187 35.4 201 236 Waiting: 35 187 35.4 201 235 Total: 35 187 35.2 201 244 Percentage of the requests served within a certain time (ms) 50% 201 66% 202 75% 204 80% 204 90% 207 95% 208 98% 209 99% 226 100% 244 (longest request)
ab -c 100 -n 1000 'http://192.168.0.30/mysql.php' This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright 2006 The Apache Software Foundation, http://www.apache.org/ Benchmarking 192.168.0.30 (be patient) Server Software: Apache/2.2.3 Server Hostname: 192.168.0.30 Server Port: 80 Document Path: /mysql.php Document Length: 0 bytes Concurrency Level: 100 Time taken for tests: 1.421236 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 190000 bytes HTML transferred: 0 bytes Requests per second: 703.61 [#/sec] (mean) Time per request: 142.124 [ms] (mean) Time per request: 1.421 [ms] (mean, across all concurrent requests) Transfer rate: 130.17 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 1 5.1 0 22 Processing: 7 131 142.4 129 1404 Waiting: 7 131 142.3 129 1403 Total: 19 133 142.6 129 1416 Percentage of the requests served within a certain time (ms) 50% 129 66% 130 75% 136 80% 138 90% 141 95% 144 98% 173 99% 1339 100% 1416 (longest request)
memcache.php
ab -c 100 -n 1000 'http://192.168.0.30/memcache.php'
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking 192.168.0.30 (be patient)
Server Software: Apache/2.2.3
Server Hostname: 192.168.0.30
Server Port: 80
Document Path: /memcache.php
Document Length: 0 bytes
Concurrency Level: 100
Time taken for tests: 1.453866 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 191900 bytes
HTML transferred: 0 bytes
Requests per second: 687.82 [#/sec] (mean)
Time per request: 145.387 [ms] (mean)
Time per request: 1.454 [ms] (mean, across all concurrent requests)
Transfer rate: 128.62 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 15 10.2 14 45
Processing: 20 124 36.9 138 479
Waiting: 16 109 35.7 119 462
Total: 27 139 41.8 147 496
Percentage of the requests served within a certain time (ms)
50% 147
66% 163
75% 172
80% 176
90% 186
95% 191
98% 198
99% 203
100% 496 (longest request)
読み込み結果検証
Requests per secondの順位下記。
MySQL(MyISAM)>memcache>MongoDB>>>CouchDB
MySQLが一番早い結果になるとは思わなかったです。(なって欲しくなかった)
でもFacebookでのMySQL運用術はKVSの様にシンプルなのかな。
(http://hyuki.com/yukiwiki/wiki.cgi?HowFriendFeedUsesMySqlToStoreSchemaLessData)
CouchDBはRESTでのデータ取得をPEARでやってしまってるので遅いのかな?
毎度毎度その処理部分のPHPをコンパイルする分遅くなっているのでしょう。
MongoDBもmemcache並に早いですね。
MySQLがmemcacheより早いのは意外です。解せぬ〜。
次は書き込み時の速さを見てみます。
書き込み時のソース
couchdbはinsertの方法が調べれず…><
誰か教えて!ヘルプ!
mongodb_write.php
<?php $mongo = new Mongo(); $db = $mongo->selectDB("test"); $col = $db->selectCollection("test"); $col->insert(array("test" => "test"));
<?php $link = mysql_pconnect('localhost', 'root', ''); mysql_select_db('mytest', $link); $result = mysql_query("INSERT INTO `test` VALUES ('test');");
memcache_write.php
<?php $memcache = new Memcache; $memcache->connect('localhost', 11211) or die ("Could not connect"); $memcache->set("test", "test");
書き込み結果
mongodb_write.php
ab -c 100 -n 1000 'http://192.168.0.30/mongodb_write.php' This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright 2006 The Apache Software Foundation, http://www.apache.org/ Benchmarking 192.168.0.30 (be patient) Server Software: Apache/2.2.3 Server Hostname: 192.168.0.30 Server Port: 80 Document Path: /mongodb_write.php Document Length: 0 bytes Concurrency Level: 100 Time taken for tests: 9.325888 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 190190 bytes HTML transferred: 0 bytes Requests per second: 107.23 [#/sec] (mean) Time per request: 932.589 [ms] (mean) Time per request: 9.326 [ms] (mean, across all concurrent requests) Transfer rate: 19.84 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 4 9.7 0 36 Processing: 30 728 1111.7 176 9092 Waiting: 3 725 1112.6 176 9091 Total: 31 732 1111.0 177 9108 Percentage of the requests served within a certain time (ms) 50% 177 66% 910 75% 937 80% 938 90% 1030 95% 3103 98% 3148 99% 4285 100% 9108 (longest request)
ab -c 100 -n 1000 'http://192.168.0.30/mysql_write.php' This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright 2006 The Apache Software Foundation, http://www.apache.org/ Benchmarking 192.168.0.30 (be patient) Server Software: Apache/2.2.3 Server Hostname: 192.168.0.30 Server Port: 80 Document Path: /mysql_write.php Document Length: 0 bytes Concurrency Level: 100 Time taken for tests: 1.484070 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 190000 bytes HTML transferred: 0 bytes Requests per second: 673.82 [#/sec] (mean) Time per request: 148.407 [ms] (mean) Time per request: 1.484 [ms] (mean, across all concurrent requests) Transfer rate: 124.66 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 1.6 0 8 Processing: 41 142 165.8 129 1478 Waiting: 40 142 165.8 129 1478 Total: 41 143 165.8 129 1479 Percentage of the requests served within a certain time (ms) 50% 129 66% 131 75% 132 80% 133 90% 139 95% 144 98% 161 99% 1476 100% 1479 (longest request)
memcache_write.php
ab -c 100 -n 1000 'http://192.168.0.30/memcache_write.php' This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright 2006 The Apache Software Foundation, http://www.apache.org/ Benchmarking 192.168.0.30 (be patient) Server Software: Apache/2.2.3 Server Hostname: 192.168.0.30 Server Port: 80 Document Path: /memcache_write.php Document Length: 0 bytes Concurrency Level: 100 Time taken for tests: 1.701421 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 190380 bytes HTML transferred: 0 bytes Requests per second: 587.74 [#/sec] (mean) Time per request: 170.142 [ms] (mean) Time per request: 1.701 [ms] (mean, across all concurrent requests) Transfer rate: 108.73 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 17 11.0 18 44 Processing: 34 143 24.8 148 267 Waiting: 3 126 25.6 132 261 Total: 34 160 28.3 163 301 Percentage of the requests served within a certain time (ms) 50% 163 66% 175 75% 181 80% 185 90% 192 95% 195 98% 201 99% 205 100% 301 (longest request)
全体を通したまとめ
大分ざっくりとした検証で納得がいくのかわかりませんが個人的には概ね満足。
インストール〜設定〜動作等で見えた部分は勉強になりました。
検証前は圧倒的にmemcacheが一番早いだろうと思ったのですが、読み書きともMySQLとほぼ同じ位で驚きました。
その後僅差でMongoDB。
CouchDBはhttp通信をphpでしてしまってるので良い結果が得られなかった感じですか。
(couchdb.so作って!)
恐らく皆さんが書いているように、RDBMSも単体では速度的に問題なくて、複雑なSQLを処理しようとするとボトルネックになるのでしょうか。
スケーリングを意識したSQLを書く事で、KVS並に高速化になるのかもしれません。
参考:http://hyuki.com/yukiwiki/wiki.cgi?HowFriendFeedUsesMySqlToStoreSchemaLessData
あとがき
うーん…。
こうしたらMongoDBが早くなるよ!的なアドバイス欲しいな〜。
上記のテストサーバーは家でそのままにしてあるので、こんなテストして!っていう場合コメント下さい。
テストしてブログに書きます。
[PR]Spreeの情報を集めています。
ECを持ちたい方、仕事でECを使いたい方向けのコミュニティサイトです。
このサイトでは世界で最も使用されているECの1つであるSpreeについての情報を提供しています。
http://spreecommerce.jp/
CentOS5.4にMongoDBをインストールする方法!
前回CouchDBをインストールしてみましたが、勢いでMongoDBもインストールしてみました。
CentOS5.4にCouchDBをインストールする方法! - @camelmasaの開発日記
参考
http://handsout.jp/slide/2316
環境
OS:CentOS:5.4
MongoDB:1.2.2
MongoDBのダウンロード&インストール
MongoDBのダウンロード&インストール
cd /usr/local/src wget http://downloads.mongodb.org/linux/mongodb-linux-i686-1.2.2.tgz tar zxfv mongodb-linux-i686-1.2.2.tgz
以上。ダウンロードして展開するだけ。
これでインストール完了です。
CouchDBより簡単でした!!!
動作確認
MongoDBを起動します。
mkdir /data mkdir /data/db /usr/local/src/mongodb-linux-i686-1.2.2/bin/mongod /usr/local/src/mongodb-linux-i686-1.2.2/bin/mongod --help for help and startup options Fri Feb 19 23:00:03 Mongo DB : starting : pid = 12553 port = 27017 dbpath = /data/db/ master = 0 slave = 0 32-bit ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data ** see http://blog.mongodb.org/post/137788967/32-bit-limitations for more Fri Feb 19 23:00:03 db version v1.2.2, pdfile version 4.5 Fri Feb 19 23:00:03 git version: 8a4fb8b1c7cb78648c55368d806ba35054f6be54 Fri Feb 19 23:00:03 sys info: Linux domU-12-31-39-01-70-B4 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_37 Fri Feb 19 23:00:03 waiting for connections on port 27017
問題なく起動出来ているようです。
補足
mongodbをバックグラウンドで動かすには、--forkが必要。
またその際には、--logpathの指定も必要になります。
Manage mongod Processes — MongoDB Manual
./mongod --fork --logpath /usr/local/mongodb/logs/
[PR]Spreeの情報を集めています。
ECを持ちたい方、仕事でECを使いたい方向けのコミュニティサイトです。
このサイトでは世界で最も使用されているECの1つであるSpreeについての情報を提供しています。
http://spreecommerce.jp/
CentOS5.4にCouchDBをインストールする方法!
サムライファクトリーって知っていますか?ninja toolsのアクセス解析で有名ですよね?
私は社員でもなければ面識がある方もいないのですが、採用情報の"とんがった才能を世界に向けて活かしてみませんか?"のキャッチフレーズが気に入っています。
http://www.samurai-factory.jp/celebrity/
noSQLというのが盛り上がってますが、その中でも"とんがった"DB(?)であるCouchDBをインストールしてみましたので記事にしました。
(なんだかMongoDBの方が人気のようですけども…)
参考
CouchDBとMongoDBを比較してみた - Masatomo Nakano Blog
2010-02-05
CouchDBのインストール
依存パッケージのインストール
yum install automake gcc libtool erlang help2man icu libicu-devel js js-devel curl-devel
CouchDBのダウンロード
cd /usr/local/src wget http://ftp.kddilabs.jp/infosystems/apache/couchdb/0.10.1/apache-couchdb-0.10.1.tar.gz tar zxfv apache-couchdb-0.10.1.tar.gz
configureの実行
cd apache-couchdb-0.10.1 ./configure
configureが終わると下記の文字
You have configured Apache CouchDB, time to relax.
time to relax(笑)
本当かよ(笑)
次にmake&make installの実行
make make install
これでインストール完了です。
凄い簡単でした!!!
動作確認
CouchDBを起動しますが、デフォルトだとIPアドレスが127.0.0.1になっていてブラウザからアクセス出来ません。
ですので適切なIPアドレスを設定します。
(私の場合はVMwareのNAT環境でインストールしているので、192.168.80.139になります。)
local.iniの編集
cd /usr/local/etc/couchdb vim local.ini
local.iniのbind_addressの値を変更します。
;bind_address = 127.0.0.1 bind_address = 192.168.80.139
CouchDBの実行
couchdb Apache CouchDB 0.10.1 (LogLevel=info) is starting. Apache CouchDB has started. Time to relax. [info] [<0.1.0>] Apache CouchDB has started on http://192.168.80.139:5984/
ブラウザからアクセス(http://192.168.80.139:5984/)
左上にjson形式のデータが表示されています。
ブラウザからアクセス(http://192.168.80.139:5984/_utils)
管理画面が表示されました。
感動的ですね!
補足
ターミナルからCouchDBの実行をすると、rubyのwebrickの状態の様にターミナルが縛られてしまうのでscreenのインストール推奨です。
zsh + screen + vim のインストール&設定方法についてです。 - @camelmasaの開発日記
…と思ったら、下記のコマンドでバックグラウンドでcouchdbプロセス動かせました。
couchdb -b
知らなかった〜。。。
しかしログを見ながら操作したいならscreenの方が良いかも。
まとめ
CouchDBのインストールが難しいとの情報がありましたが、恐らくバージョンが上がっていたのでそれで簡単になったのではないでしょうか。
今度はphpからデータ操作やMySQLとの実行速度の比較等をしたいと思います!
[PR]Spreeの情報を集めています。
ECを持ちたい方、仕事でECを使いたい方向けのコミュニティサイトです。
このサイトでは世界で最も使用されているECの1つであるSpreeについての情報を提供しています。
http://spreecommerce.jp/
これで完璧!Q4MをCentOS5.4にインストールしphpで実行する方法!
前回の記事では中々満足のいく結果が出せませんでした。
Q4MをCentOS5.4にインストールしphpで実行しました。 - @camelmasaの開発日記
もっと簡単にQ4Mをインストールし、かつ前回出来なかったphpからqueue_abort()を出来るようにしたいと思います。
PHP5.3.1とMySQL5.1.43をyumでインストール
PHP5.3.1でなくても良いのですが、前回PDOからqueue_abort()が出来なかったので、今回はopenpearで提供されているNet_Q4Mを使用したいと思い、PHP5.3.1をインストールします。
(Net_Q4Mはphp5.2.0以上が必要)
MySQL5.1.43はQ4MがMySQL5.1以上が必要ということですのでyumからインストールします。
CentOSの通常のリポジトリだけだと、PHP5.3.1とMySQL5.1.43は出来ないのですが下記の記事を参考にしてリポジトリを追加してインストールしました。(ついでにMySQLをconfigureする為に必要なパッケージもいれます。)
CentOS 5.3 に php-5.2.9, mysql-5.1.35 をインストール(remi レポジットリより) | お試しlog4
wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm wget http://rpms.famillecollet.com/el5.i386/remi-release-5-6.el5.remi.noarch.rpm wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm rpm -Uvh *.rpm yum --enablerepo=remi,epel,rpmforge update yum --enablerepo=remi,epel,rpmforge install php-gd php-mbstring php-mysql php-odbc php-pdo php-pear mysql* yum --enablerepo=remi,epel,rpmforge install gperf readline-devel ncurses-devel zlib-devel gcc gcc-c++ autoconf automake libtool rpm-build boost boost-devel
(この時、5.1.43では無いパッケージがインストールされる場合、mysql*では無く、mysql-5.1.43 mysql-server-5.1.43 mysql-devel-5.1.43 をインストールしないと駄目だった。)
MySQLを起動します。
/etc/init.d/mysqld start
MySQL-community-5.1.43-1.rhel5.src.rpmとq4m-0.9.tar.gzの入手
MySQL-community-5.1.43-1.rhel5.src.rpmとq4m-0.9.tar.gzを入手して展開します。
cd /usr/local/src wget http://dev.mysql.com/get/Downloads/MySQL-5.1/MySQL-community-5.1.43-1.rhel5.src.rpm/from/http://ftp.jaist.ac.jp/pub/mysql/ wget http://q4m.31tools.com/dist/q4m-0.9.tar.gz tar zxfv q4m-0.9.tar.gz
MySQL-community-5.1.43-1.rhel5.src.rpmをリビルドします。
MySQL-community-5.1.43-1.rhel5.src.rpmをリビルドします。
rpmbuild --recompile --define 'community 1' MySQL-community-5.1.43-1.rhel5.src.rpm
Q4Mをビルド&インストール
Q4Mをビルドします。
cd ./q4m-0.9 ./configure --with-mysql=/usr/src/redhat/BUILD/mysql-5.1.43 make make install
./configureの実行時、"failed to locate mysql 5.1 installation"というエラーが表示された場合、mysql系の何かのパッケージがインストールされていない場合があります。
(今回のケースではyumでmysql*をインストールしているので、どのパッケージか特定していません。)
これでQ4Mがインストールされました。
次にQ4Mの動作準備します。
/usr/bin/install -c support-files/q4m-forward /usr/bin mysql -u root -f mysql < support-files/install.sql
これでQ4Mの動作準備完了です。
Q4Mがインストールされているか確認
Q4Mがインストールされているか確認します。
mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.1.43 MySQL Community Server (GPL) by Remi Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show plugins; +------------+----------+----------------+--------------------+---------+ | Name | Status | Type | Library | License | +------------+----------+----------------+--------------------+---------+ | binlog | ACTIVE | STORAGE ENGINE | NULL | GPL | | partition | ACTIVE | STORAGE ENGINE | NULL | GPL | | ARCHIVE | ACTIVE | STORAGE ENGINE | NULL | GPL | | BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL | GPL | | CSV | ACTIVE | STORAGE ENGINE | NULL | GPL | | FEDERATED | ACTIVE | STORAGE ENGINE | NULL | GPL | | MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL | | InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL | | MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL | | MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL | | ndbcluster | DISABLED | STORAGE ENGINE | NULL | GPL | | QUEUE | ACTIVE | STORAGE ENGINE | libqueue_engine.so | GPL | +------------+----------+----------------+--------------------+---------+ 12 rows in set (0.08 sec)
一番下にQUEUEの列!
プラグインの一覧に追加されているのが確認出来ました。
MySQLにQUEUEのストレージエンジンを使用したテーブルを用意
MySQLにQUEUEのストレージエンジンを使用したテーブルを用意します。
mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.1.43 MySQL Community Server (GPL) by Remi Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database q4m; Query OK, 1 row affected (0.00 sec) mysql> use q4m; Database changed mysql> create table my_queue(id int not null, name varchar(25) not null ) engine=queue; Query OK, 0 rows affected (0.03 sec)
openpear/Net_Q4Mのインストール
openpearのチャンネルをインストール後、pearコマンドでNet_Q4Mをインストールします。
pear channel-discover openpear.org pear install openpear/Net_Q4M-beta
これでOK。
phpからQ4Mを操作
以下のphpでQ4Mを操作してみます。
Net_Q4MのコンストラクタであるDSN部分は適当な値を設定して下さい。
<?php require_once ('Net/Q4M.php'); $queue = new Net_Q4M('mysql://user:pass@localhost/database'); $queue->connect(); while(true) { $row = $queue->dequeue('my_queue'); var_dump($row); if ($row) { $queue->end(); } else { $queue->abort(); } } $queue->disconnect();
phpで実行
php q4m.php buildQueryString(): SELECT queue_wait('my_queue')
別の端末からMySQLでinsertすると…?
mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 Server version: 5.1.43 MySQL Community Server (GPL) by Remi Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> use q4m; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> insert into my_queue values(1, 'hello world'); Query OK, 1 row affected (0.00 sec)
php q4m.php buildQueryString(): SELECT queue_wait('my_queue') buildQueryString(): SELECT * FROM my_queue array(4) { [0]=> string(1) "1" ["id"]=> string(1) "1" [1]=> string(11) "hello world" ["name"]=> string(11) "hello world" } buildQueryString(): SELECT queue_end() buildQueryString(): SELECT queue_wait('my_queue')
上手くスクリプトが実行されました。
Net_Q4Mの作者さんのサイトにサンプルスクリプトがあるのですが、Net_Q4Mのバージョンが上がっているせいか、コンストラクタでDSNの値を引数にいれる仕様になっていました。
http://castor.s26.xrea.com/blog/tech/tech00017.html
まとめ
前回と同様、簡単にインストール…とはいきませんでした。
現段階ではrebuildしたMySQLを使用する方法しか見当たりません。
しかし、Q4Mのabort()が実行出来るのが確認出来たので収穫ありとしたいと思います。
追記
Q4M 0.9.2をインストールした方が良いかもしれないですね。
http://developer.cybozu.co.jp/kazuho/2010/01/thanks-to-a-use.html
[PR]Spreeの情報を集めています。
ECを持ちたい方、仕事でECを使いたい方向けのコミュニティサイトです。
このサイトでは世界で最も使用されているECの1つであるSpreeについての情報を提供しています。
http://spreecommerce.jp/
Q4MをCentOS5.4にインストールしphpで実行しました。
Q4Mはid:kazuhookuさんが開発したMySQLでメッセージキューを実装するストレージエンジンです。
思わぬ機会でQ4Mに触れる事が出来たので実際に構築〜phpでの実行を記事にしました。
インストール
インストールには下記の記事を参考にしました。
Q4M on CentOS - dragon3のブログ
MySQLのバージョンが違うだけで、上記と同じ作業で行いました。
VMwareで環境を構築したのですが、MySQLをビルドするのに物凄く時間がかかるのが注意です。
(4,5時間掛かったかな?)
phpで実行
phpでの実行には下記の記事を参考にしました。
http://blog.xole.net/article.php?id=719
PDOで実行する為に必要な事を下記に示します。
php-pdoのインストール
yum install php-pdo
pdo-mysqlのインストール
pecl pdo_mysql
php.iniの編集
;;;;;;;;;;;;;;;;;;;;;; ; Dynamic Extensions ; ;;;;;;;;;;;;;;;;;;;;;; ; ; If you wish to have an extension loaded automatically, use the following ; syntax: ; ; extension=modulename.extension ; ; For example: ; ; extension=msql.so ; ; Note that it should be the name of the module only; no directory information ; needs to go here. Specify the location of the extension with the ; extension_dir directive above. extension=pdo.so extension=pdo_mysql.so
MySQLのユーザー、パスワードを適当に設定して、参考のphpを実行しました。
<?php $conn = new PDO('mysql:host=localhost; dbname=hogetest', 'user', 'password'); $wait = $conn->prepare('SELECT queue_wait("hoge_queue", 10)'); $abort = $conn->prepare('SELECT queue_abort()'); $e = $conn->prepare('SELECT queue_end()'); $select = $conn->prepare('SELECT * FROM hoge_queue'); while(true){ $start = time(); // for epch tstmp // wait call query $wait->execute(); $end = time(); echo 'wait for: ', $end - $start, ' sec.', PHP_EOL; echo 'is_queue: ', $wait->fetch(PDO::FETCH_COLUMN), PHP_EOL; $select->execute(); while($row = $select->fetch(PDO::FETCH_OBJ)){ var_dump($row); // // delete しなくとも queue_end で消える // $e->execute(); continue 2; } // abort cal // abortを実行するとphpエラーが起こるのでコメント化 //$abort->execute(); echo 'next...', PHP_EOL, PHP_EOL; }
無事にQ4Mを楽しむ事が出来ました。
$abort->execute();を実行すると表示されるエラー
[root@localhost ~]# php q4m.php
wait for: 10 sec.
is_queue: 0
PHP Fatal error: Call to a member function execute() on a non-object in /root/q4m.php on line 29
mysql> SELECT queue_abort(); ERROR 1123 (HY000): Can't initialize function 'queue_abort'; queue_abort(): not in owner mode
むう。。。
まとめ
Q4Mの利点は、プログラムをフロントエンドとバックエンドで分離する事で処理を高速化する事が出来る事だと思います。(他人の受け売りです。)
構築〜実装が複雑では無いので、どんどん取り入れたい技術だと思います。
(唯、SELECT queue_abort()が実行出来なかったのは仕様なのか、構築時のミスなのか気になるところです…。)
追記
Q4Mの構築自体に問題は無さそうですが、スクリプトに問題がありそう。現在調査中。
なんだか2回目のwhileに絶対入らない…。PDO内のスクリプトにバグがあるのかな…。
MySQL内では問題なかった…。
[PR]Spreeの情報を集めています。
ECを持ちたい方、仕事でECを使いたい方向けのコミュニティサイトです。
このサイトでは世界で最も使用されているECの1つであるSpreeについての情報を提供しています。
http://spreecommerce.jp/