Bug #69643 MySQL Cluster select count(*) very slow on concurrent 200
Submitted: 2 Jul 2013 2:22 Modified: 19 Sep 2013 12:06
Reporter: sam sha Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S5 (Performance)
Version:7.3 OS:Linux (centos 6.3)
Assigned to: Assigned Account CPU Architecture:Any
Tags: MySQL Cluster concurrent 200 select count(*)

[2 Jul 2013 2:22] sam sha
Description:
Table : phpbb_sessions

   Field Type Extra

P session_id varchar(32) 

   session_user_id mediumint(8) UNSIGNED 

   session_forum_id mediumint(8) UNSIGNED 

   session_last_visit int(11) UNSIGNED 

   session_start int(11) UNSIGNED 

   session_time int(11) UNSIGNED 

   session_ip varchar(40) 

   session_browser varchar(150) 

   session_forwarded_for varchar(255) 

   session_page varchar(255) 

   session_viewonline tinyint(1) UNSIGNED 

   session_autologin tinyint(1) UNSIGNED 

   session_admin tinyint(1) UNSIGNED 

   Index Fields Extra

   session_user_id session_user_id 

   session_time session_time 

   session_forum_id session_forum_id 

   session_uti session_user_id, session_time, session_id 

---------------------------------------------------------------------

SQL: SELECT COUNT(session_id) AS sessions
                                        FROM phpbb_sessions
                                        WHERE session_user_id = 1
                                        AND session_time >= 1372239407;

records number is 20000 -  30000.
run the sql alone is normal , time use 0.0x s。

but when I use apache bench, cocurrent number more bigger, the sql is more and more slowly。 What is abnormal is time used is over 30s when concurent number is 100 - 200 , but other sql query is very fast . 

how can i resolve it? thank you!

1

How to repeat:
write a php, use web application to call the sql, then use apache bench concurrent call the php。
[19 Aug 2013 12:06] Gustaf Thorslund
Sam,

Could you please provide the output of:

  mysql> show create table phpbb_sessions;

  mysql> explain SELECT COUNT(session_id) AS sessions
                                        FROM phpbb_sessions
                                        WHERE session_user_id = 1
                                        AND session_time >= 1372239407;

You might also be interested in looking at:

  mysql> select min(session_time), max(session_time), avg(session_time), std(session_time);

While running these queries do you run any other queries? Do you get any errors when running any queries? In that case what errors and how do you handle them?

/Gustaf
[20 Sep 2013 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".