teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

5

バイナリログの場合のデータを更新した。

2015/12/15 12:04

投稿

eripong
eripong

スコア1546

answer CHANGED
@@ -97,6 +97,7 @@
97
97
  ```
98
98
 
99
99
  ---
100
+ (2015/12/15 21:02 追記)
100
101
  バイナリログを出力する様になっていたりしませんか?
101
102
 
102
103
  [Bug #67676 prepared statement is very slow while binlog was enabled](https://bugs.mysql.com/bug.php?id=67676)
@@ -105,4 +106,38 @@
105
106
  試しに、こちらの環境でバイナリログを出力する様にしたところ、
106
107
  以下の結果となり、KiyoshiMotokiさんの結果に少し近くなりました。
107
108
 
108
- ![実行結果の散布図グラフ(仮想環境 バイナリログON)](4caf0385361305f18bb53a809cefa27e.png)
109
+ ![実行結果の散布図グラフ(仮想環境 バイナリログON)](bdc33c150a2e7061687fba6267070966.png)
110
+
111
+ mysqli_get_client_statsの情報(実行前後の差分)
112
+ ```
113
+ [bytes_sent] => 47295406
114
+ [bytes_received] => 20765932
115
+ [packets_sent] => 525952
116
+ [packets_received] => 525112
117
+ [protocol_overhead_in] => 2100448
118
+ [protocol_overhead_out] => 2103808
119
+ [bytes_received_rset_header_packet] => 540
120
+ [bytes_received_rset_row_packet] => 13673680
121
+ [bytes_received_prepare_response_packet] => 7077672
122
+ [packets_sent_command] => 262856
123
+ [packets_received_rset_header] => 60
124
+ [packets_received_rset_row] => 262616
125
+ [packets_received_prepare_response] => 262136
126
+ [non_result_set_queries] => 262616
127
+ [ps_prepared_once_executed] => 4
128
+ [rows_affected_normal] => 1966080
129
+ [rows_affected_ps] => 1966080
130
+ [command_buffer_too_small] => 784
131
+ [connect_success] => 120
132
+ [connect_failure] => 5
133
+ [active_connections] => 18446744073709551491
134
+ [explicit_close] => 120
135
+ [explicit_free_result] => 60
136
+ [explicit_stmt_close] => 60
137
+ [com_quit] => 120
138
+ [com_query] => 131548
139
+ [com_stmt_prepare] => 60
140
+ [com_stmt_execute] => 131068
141
+ [com_stmt_close] => 60
142
+
143
+ ```

4

バイナリログについて追記した。

2015/12/15 12:03

投稿

eripong
eripong

スコア1546

answer CHANGED
@@ -39,7 +39,7 @@
39
39
  以下の様に、顕著にO(n)の傾向が見えます。
40
40
  どうも、おかしいような気がします。
41
41
 
42
- ![実行結果のグラフ(散布図)](323990f354003b27054a00f5dc2f7798.png)
42
+ ![実行結果の散布図](323990f354003b27054a00f5dc2f7798.png)
43
43
 
44
44
  また、性能検証には向かない環境ですが、Windows 7上のOracle Virtualboxを
45
45
  DBサーバとして、Windows 7のホストから負荷をかけてみました。
@@ -49,9 +49,9 @@
49
49
  OS : Windows 7
50
50
  CPU : Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz
51
51
  Memory : 16GB
52
- スクリプト : PHP 5.6.8
52
+ スクリプト : PHP 5.6.8
53
53
  DB接続ドライバ : PDO
54
- Oracle Virtual Box 5.0.8
54
+ Oracle Virtual Box 5.0.8
55
55
 
56
56
  DBサーバ(ゲスト)
57
57
  OS : Ubuntu 14.04.3
@@ -59,7 +59,7 @@
59
59
  DB : MySQL 5.5.46
60
60
 
61
61
  グラフ化した結果は以下の通りです。
62
- ![仮想環境での実行結果のグラフ(散布図)](c9b0dc500eecd25a3c0d8b759ae72268.png)
62
+ ![実行結果の散布図(仮想環境)](c9b0dc500eecd25a3c0d8b759ae72268.png)
63
63
  顕著な差は出ませんでした。
64
64
 
65
65
  mysqli_get_client_statsの情報(値が0の項目は省きました)
@@ -94,4 +94,15 @@
94
94
  [com_stmt_prepare] => 15
95
95
  [com_stmt_execute] => 32767
96
96
  [com_stmt_close] => 15
97
- ```
97
+ ```
98
+
99
+ ---
100
+ バイナリログを出力する様になっていたりしませんか?
101
+
102
+ [Bug #67676 prepared statement is very slow while binlog was enabled](https://bugs.mysql.com/bug.php?id=67676)
103
+
104
+ という不具合があるようです。
105
+ 試しに、こちらの環境でバイナリログを出力する様にしたところ、
106
+ 以下の結果となり、KiyoshiMotokiさんの結果に少し近くなりました。
107
+
108
+ ![実行結果の散布図グラフ(仮想環境 バイナリログON)](4caf0385361305f18bb53a809cefa27e.png)

3

結果の整形を行った。

2015/12/15 11:55

投稿

eripong
eripong

スコア1546

answer CHANGED
@@ -50,7 +50,7 @@
50
50
  CPU : Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz
51
51
  Memory : 16GB
52
52
  スクリプト : PHP 5.6.8
53
- DB接続ドライバ : PDO
53
+ DB接続ドライバ : PDO
54
54
  Oracle Virtual Box 5.0.8
55
55
 
56
56
  DBサーバ(ゲスト)

2

mysqli_get_client_statsの情報を追記した。

2015/12/14 09:40

投稿

eripong
eripong

スコア1546

answer CHANGED
@@ -59,5 +59,39 @@
59
59
  DB : MySQL 5.5.46
60
60
 
61
61
  グラフ化した結果は以下の通りです。
62
- ![仮想環境での実行結果のグラフ(散布図)](82c0e8f4550440290ea98081ac5b1143.png)
62
+ ![仮想環境での実行結果のグラフ(散布図)](c9b0dc500eecd25a3c0d8b759ae72268.png)
63
- 顕著な差は出ませんでした。
63
+ 顕著な差は出ませんでした。
64
+
65
+ mysqli_get_client_statsの情報(値が0の項目は省きました)
66
+ ```
67
+
68
+ [bytes_sent] => 11823835
69
+ [bytes_received] => 5191393
70
+ [packets_sent] => 131488
71
+ [packets_received] => 131278
72
+ [protocol_overhead_in] => 525112
73
+ [protocol_overhead_out] => 525952
74
+ [bytes_received_rset_header_packet] => 135
75
+ [bytes_received_rset_row_packet] => 3418420
76
+ [bytes_received_prepare_response_packet] => 1769418
77
+ [packets_sent_command] => 65714
78
+ [packets_received_rset_header] => 15
79
+ [packets_received_rset_row] => 65654
80
+ [packets_received_prepare_response] => 65534
81
+ [non_result_set_queries] => 65654
82
+ [ps_prepared_once_executed] => 1
83
+ [rows_affected_normal] => 491520
84
+ [rows_affected_ps] => 491520
85
+ [command_buffer_too_small] => 196
86
+ [connect_success] => 30
87
+ [connect_failure] => 2
88
+ [active_connections] => 18446744073709551584
89
+ [explicit_close] => 30
90
+ [explicit_free_result] => 15
91
+ [explicit_stmt_close] => 15
92
+ [com_quit] => 30
93
+ [com_query] => 32887
94
+ [com_stmt_prepare] => 15
95
+ [com_stmt_execute] => 32767
96
+ [com_stmt_close] => 15
97
+ ```

1

グラフ化した結果を追加した。

2015/12/14 09:36

投稿

eripong
eripong

スコア1546

answer CHANGED
@@ -29,4 +29,35 @@
29
29
  [http://php.net/manual/ja/pdo.prepared-statements.php](http://php.net/manual/ja/pdo.prepared-statements.php)
30
30
 
31
31
  また、理由が分からないのであれば、
32
- [mysqli_get_client_stats](https://dev.mysql.com/doc/apis-php/en/apis-php-mysqli.get-client-stats.html)などを使って、統計を取ってみては?
32
+ [mysqli_get_client_stats](https://dev.mysql.com/doc/apis-php/en/apis-php-mysqli.get-client-stats.html)などを使って、統計を取ってみては?
33
+
34
+
35
+ ---
36
+ 参考情報です。
37
+
38
+ KiyoshiMotokiさんの結果を、こちらで散布図にしてみたところ、
39
+ 以下の様に、顕著にO(n)の傾向が見えます。
40
+ どうも、おかしいような気がします。
41
+
42
+ ![実行結果のグラフ(散布図)](323990f354003b27054a00f5dc2f7798.png)
43
+
44
+ また、性能検証には向かない環境ですが、Windows 7上のOracle Virtualboxを
45
+ DBサーバとして、Windows 7のホストから負荷をかけてみました。
46
+ 環境は以下の通りです。
47
+
48
+ APサーバ(ホスト)
49
+ OS : Windows 7
50
+ CPU : Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz
51
+ Memory : 16GB
52
+ スクリプト : PHP 5.6.8
53
+ DB接続ドライバ : PDO
54
+ Oracle Virtual Box 5.0.8
55
+
56
+ DBサーバ(ゲスト)
57
+ OS : Ubuntu 14.04.3
58
+ Memory : 2GB
59
+ DB : MySQL 5.5.46
60
+
61
+ グラフ化した結果は以下の通りです。
62
+ ![仮想環境での実行結果のグラフ(散布図)](82c0e8f4550440290ea98081ac5b1143.png)
63
+ 顕著な差は出ませんでした。