| |
| | |

CodersClub

 Forgot password?
 Register
Search
View: 8920|Reply: 11
Collapse the left

100% of cpu used (mysql)

[Copy link]
Post time: 2013-12-26 22:47
| Show all posts |Read mode
Hello, guys! I have a serious problem!

I'm with problems of excessive CPU usage. My server have AMD dual core 2ghz and the CPU usage is at 100% with a DataBase 80mb and 1800 Users.

My discuz is x3ML
Post time: 2013-12-27 03:32
| Show all posts
Admin center>database >optimise table
this will reduce the size me the table.try that

 Russia

Post time: 2013-12-27 07:26
| Show all posts
Try to discover what the sql processes are slow!
Edit the mysql config and add such type settings:
log-slow-file = /var/log/mysql/slow.log # full path to the log file
log-slow-time = 2  # long time, seconds

Then restart mysql.
 Author| Post time: 2013-12-27 22:03
| Show all posts
Edited by raitoringo at 2013-12-27 23:05

This is the log
  1. /usr/sbin/mysqld, Version: 5.5.34-cll (MySQL Community Server (GPL)). started with:
  2. Tcp port: 0  Unix socket: (null)
  3. Time                 Id Command    Argument
  4. # Time: 131227  7:15:14
  5. # User@Host: XXXX_dz25new[XXXX_dz25new] @ localhost []
  6. # Query_time: 2.109603  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
  7. use XXXX_dz25new;
  8. SET timestamp=1388153714;
  9. SELECT * FROM pre_common_syscache WHERE `cname` IN('plugin','diytemplatename','setting','style_default','cronnextrun');
  10. # User@Host: XXXX_dz25new[XXXX_dz25new] @ localhost []
  11. # Query_time: 2.289847  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
  12. SET timestamp=1388153714;
  13. SELECT * FROM pre_common_syscache WHERE `cname` IN('plugin','diytemplatename','setting','style_default','cronnextrun');
  14. /usr/sbin/mysqld, Version: 5.5.34-cll (MySQL Community Server (GPL)). started with:
  15. Tcp port: 0  Unix socket: (null)
  16. Time                 Id Command    Argument
  17. # Time: 131227  8:30:57
  18. # User@Host: XXXX_dz25new[XXXX_dz25new] @ localhost []
  19. # Query_time: 2.036145  Lock_time: 0.000030 Rows_sent: 0  Rows_examined: 0
  20. use XXXX_dz25new;
  21. SET timestamp=1388158257;
  22. REPLACE INTO pre_common_syscache SET `cname`='cronnextrun' , `ctype`='0' , `dateline`='1388158254' , `data`='1388160000';
  23. # User@Host: XXXX_dz25new[XXXX_dz25new] @ localhost []
  24. # Query_time: 2.091688  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
  25. SET timestamp=1388158257;
  26. SELECT * FROM pre_common_syscache WHERE `cname` IN('plugin','diytemplatename','setting','style_default','cronnextrun');
  27. # Time: 131227  8:31:00
  28. # User@Host: XXXX_dz25new[XXXX_dz25new] @ localhost []
  29. # Query_time: 4.785064  Lock_time: 1.982433 Rows_sent: 5  Rows_examined: 5
  30. SET timestamp=1388158260;
  31. SELECT * FROM pre_common_syscache WHERE `cname` IN('plugin','diytemplatename','setting','style_default','cronnextrun');
  32. /usr/sbin/mysqld, Version: 5.5.34-cll (MySQL Community Server (GPL)). started with:
  33. Tcp port: 0  Unix socket: (null)
  34. Time                 Id Command    Argument
  35. /usr/sbin/mysqld, Version: 5.5.34-cll (MySQL Community Server (GPL)). started with:
  36. Tcp port: 0  Unix socket: (null)
  37. Time                 Id Command    Argument
  38. /usr/sbin/mysqld, Version: 5.5.34-cll (MySQL Community Server (GPL)). started with:
  39. Tcp port: 0  Unix socket: (null)
  40. Time                 Id Command    Argument
  41. # Time: 131227 10:15:14
  42. # User@Host: XXXX_dz25new[XXXX_dz25new] @ localhost []
  43. # Query_time: 4.899686  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
  44. SET timestamp=1388164514;
  45. SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary,sql_mode='';
  46. # Time: 131227 10:15:17
  47. # User@Host: XXXX_dz25new[XXXX_dz25new] @ localhost []
  48. # Query_time: 3.028333  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
  49. use XXXX_dz25new;
  50. SET timestamp=1388164517;
  51. SELECT * FROM pre_common_member WHERE `uid`='29';
  52. # Time: 131227 10:15:21
  53. # User@Host: XXXX_dz25new[XXXX_dz25new] @ localhost []
  54. # Query_time: 3.705166  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
  55. SET timestamp=1388164521;
  56. # administrator command: Init DB;
  57. # Time: 131227 10:15:41
  58. # User@Host: XXXX_dz25new[XXXX_dz25new] @ localhost []
  59. # Query_time: 19.589375  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
  60. SET timestamp=1388164541;
  61. SELECT * FROM pre_common_syscache WHERE `cname` IN('plugin','diytemplatename','setting','style_default','cronnextrun');
  62. # User@Host: root[root] @ localhost []
  63. # Query_time: 19.655010  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
  64. SET timestamp=1388164541;
  65. show processlist;
  66. # User@Host: XXXX_dz25new[XXXX_dz25new] @ localhost []
  67. # Query_time: 19.852219  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
  68. SET timestamp=1388164541;
  69. SELECT * FROM pre_common_syscache WHERE `cname` IN('bbcodes','smilies','smileytypes');
  70. # Time: 131227 10:15:42
  71. # User@Host: XXXX_dz25new[XXXX_dz25new] @ localhost []
  72. # Query_time: 19.951472  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
  73. SET timestamp=1388164542;
  74. SELECT * FROM pre_common_syscache WHERE `cname` IN('plugin','diytemplatename','setting','style_default','cronnextrun');
  75. # User@Host: XXXX_dz25new[XXXX_dz25new] @ localhost []
  76. # Query_time: 20.035670  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
  77. SET timestamp=1388164542;
  78. SELECT * FROM pre_common_syscache WHERE `cname` IN('plugin','diytemplatename','setting','style_default','cronnextrun');
  79. /usr/sbin/mysqld, Version: 5.5.34-cll (MySQL Community Server (GPL)). started with:
  80. Tcp port: 0  Unix socket: (null)
  81. Time                 Id Command    Argument
  82. # Time: 131227 10:41:05
  83. # User@Host: XXXX_dz25new[XXXX_dz25new] @ localhost []
  84. # Query_time: 17.902020  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
  85. use XXXX_dz25new;
  86. SET timestamp=1388166065;
  87. SELECT * FROM pre_common_syscache WHERE `cname` IN('plugin','diytemplatename','setting','style_default','cronnextrun');
  88. # Time: 131227 10:41:26
  89. # User@Host: XXXX_dz25new[XXXX_dz25new] @ localhost []
  90. # Query_time: 20.899918  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
  91. SET timestamp=1388166086;
  92. SELECT * FROM pre_common_syscache WHERE `cname` IN('pluginlanguage_system');
  93. /usr/sbin/mysqld, Version: 5.5.34-cll (MySQL Community Server (GPL)). started with:
  94. Tcp port: 0  Unix socket: (null)
  95. Time                 Id Command    Argument
  96. # Time: 131227 11:45:20
  97. # User@Host: XXXX_dz25new[XXXX_dz25new] @ localhost []
  98. # Query_time: 5.271508  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
  99. use XXXX_dz25new;
  100. SET timestamp=1388169920;
  101. SELECT * FROM pre_common_syscache WHERE `cname` IN('bbcodes','smilies','smileytypes');

Copy the Code

 Russia

Post time: 2013-12-28 16:16
| Show all posts
That log records means that the server (or the mySQL daemon) is very busy.
Run mySQL shell and check what the processes runs at the same tome:
show processlist;

And the second:
I always recomend to NOT USE the Sql Cache!
Use the FILE Cache instead!
config_global.php:
  1. // ---------------------------  CONFIG CACHE  --------------------------- //
  2. $_config['cache']['type'] = 'file';
Copy the Code
 Author| Post time: 2013-12-30 16:04
| Show all posts
my problem remains the same
  1. Repair a MySQL Database

  2. Repairing XXXX_dz25new

  3. XXXX_dz25new.pre_badge_log_7ree                OK
  4. X
  5. XXXX_dz25new.pre_common_plugin_luckypacket     OK
  6. XXXX_dz25new.pre_common_plugin_luckypacketlog  OK
  7. XXXX_dz25new.pre_common_plugin_trthank         OK
  8. XXXX_dz25new.pre_common_plugin_trthanklog      OK
  9. XXXX_dz25new.pre_common_pluginvar              OK
  10. XXXX_dz25new.pre_common_process                note     : The storage engine for the table doesn't support repair
  11. XXXX_dz25new.pre_common_regip                  OK
  12. XXXX_dz25new.pre_common_relatedlink            OK
  13. XXXX_dz25new.pre_common_remote_port            OK
  14. XXXX_dz25new.pre_common_report                 OK
  15. XXXX_dz25new.pre_common_searchindex            OK
  16. XXXX_dz25new.pre_common_secquestion            OK
  17. XXXX_dz25new.pre_common_session                note     : The storage engine for the table doesn't support repair
  18. XXXX_dz25new.pre_common_setting                OK
  19. XXXX_dz25new.pre_common_smiley                 OK
  20. XXXX_dz25new.pre_common_sphinxcounter          OK
  21. XXXX_dz25new.pre_common_stat                   OK
  22. XXXX_dz25new.pre_common_statuser               OK
  23. XXXX_dz25new.pre_common_style                  OK
  24. XXXX_dz25new.pre_common_stylevar               OK
  25. XXXX_dz25new.pre_common_syscache               OK
  26. XXXX_dz25new.pre_common_tag                    OK
  27. XXXX_dz25new.pre_common_tagitem                OK
  28. XXXX_dz25new.pre_common_task                   OK
  29. XXXX_dz25new.pre_common_taskvar                OK
  30. XXXX_dz25new.pre_common_template               OK
  31. XXXX_dz25new.pre_common_template_block         OK
  32. XXXX_dz25new.pre_common_template_permission    OK
  33. XXXX_dz25new.pre_common_uin_black              OK
  34. XXXX_dz25new.pre_common_usergroup              OK
  35. XXXX_dz25new.pre_connect_memberbindlog         OK
  36. XXXX_dz25new.pre_connect_postfeedlog           OK
  37. XXXX_dz25new.pre_forum_activityapply           OK
  38. XXXX_dz25new.pre_forum_announcement            OK
  39. XXXX_dz25new.pre_forum_threadclass             OK
  40. XXXX_dz25new.pre_forum_threadclosed            OK
  41. XXXX_dz25new.pre_forum_threaddisablepos        note     : The storage engine for the table doesn't support repair
  42. XXXX_dz25new.pre_forum_threadhot               OK
  43. XXXX_dz25new.pre_forum_threadimage             OK
  44. XXXX_dz25new.pre_home_feed                     OK
  45. XXXX_dz25new.pre_home_feed_app                 OK
  46. XXXX_dz25new.pre_home_follow                   OK
  47. XXXX_dz25new.pre_home_follow_feed              OK
  48. XXXX_dz25new.pre_home_pic                      OK
  49. XXXX_dz25new.pre_home_pic_moderate             OK
  50. XXXX_dz25new.pre_home_picfield                 OK
  51. XXXX_dz25new.pre_ucenter_protectedmembers      OK
  52. XXXX_dz25new.pre_ucenter_settings              OK
  53. XXXX_dz25new.pre_ucenter_sqlcache              OK
  54. XXXX_dz25new.pre_ucenter_tags                  OK
  55. XXXX_dz25new.pre_ucenter_vars                  note     : The storage engine for the table doesn't support repair
  56. Done.
Copy the Code


 Russia

Post time: 2013-12-31 10:38
| Show all posts
Check the server load average. (shell "top" command in unix/linux).

P.S.
What the hosting plan used?
 Author| Post time: 2013-12-31 20:53
| Show all posts
Editado por raitoringo en 2014-1-2 14:24

VPS - 2Ghs - 1,5Gb ram



CPU
99.89%
Load Average 9.15, 6.38, 2.88

 Russia

Post time: 2014-01-02 13:50
| Show all posts
Try to discover what the processes are running as "php-cgi".
May be these are some plugin cron scripts?
Try to stop all non-default plugins and their cron-scripts.
 Author| Post time: 2014-01-03 15:24
| Show all posts
Yes, the problem was a plugin

The strange thing is that before it worked well, and the error appeared suddenly. Problem solved. Thank you very much!
You have to log in before you can reply Login | Register

Points Rules

Archive|Mobile|Dark room|CodersClub

Top.Mail.Ru
Top.Mail.Ru

2024-10-06 06:22 GMT+3 , Processed in 0.090796 sec., 8 queries .

Powered by Discuz! X3.4 Release 20230520

© 2001-2024 Discuz! Team.

MultiLingual version, Rev. 4301, © codersclub.org

Quick Reply To Top Return to the list