LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-03-2005, 05:13 AM   #1
cooper
LQ Newbie
 
Registered: Nov 2003
Distribution: FC3, Trustix
Posts: 2

Rep: Reputation: 0
Mysqld Eat's all the CPU


Hey folks,

I've got a php script which is inserting some data from a txt file into a table, however we dont seem to get very far as mysqld takes nearly all the CPU and we insert perhaps 1 or 2 records per second.

top - 11:10:12 up 35 min, 1 user, load average: 1.30, 0.82, 0.64
Tasks: 78 total, 3 running, 74 sleeping, 0 stopped, 1 zombie
Cpu(s): 97.7% user, 2.3% system, 0.0% nice, 0.0% idle
Mem: 1017268k total, 720712k used, 296556k free, 25996k buffers
Swap: 1831400k total, 0k used, 1831400k free, 556944k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
4011 mysql 18 0 11516 11m 1928 R 99.7 1.1 0:07.83 mysqld
3937 root 10 0 976 976 776 R 0.7 0.1 0:00.24 top
986 cpuser 9 0 1888 1888 1724 R 0.0 0.2 0:00.27 sshd




root@server143 [/usr/local/lib]# mysql --version
mysql Ver 12.22 Distrib 4.0.25, for pc-linux-gnu (i686)



mysql> status;
--------------
mysql Ver 12.22 Distrib 4.0.25, for pc-linux-gnu (i686)

Connection id: 29
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Server version: 4.0.25-standard
Protocol version: 10
Connection: Localhost via UNIX socket
Client characterset: latin1
Server characterset: latin1
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 4 min 47 sec

Threads: 3 Questions: 1793 Slow queries: 0 Opens: 17 Flush tables: 1 Open tables: 11 Queries per second avg: 6.247
--------------

mysql>





Anyone know why this might be happening?

many thanks
 
Old 12-04-2005, 05:13 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
You've got a bad version of mySQL (in which case installing a different version might help), a bug in your PHP library (in which case a new version of PHP might help), a bug in your PHP script, a problem with your mySQL configuration, or a poorly optimized query.

The first place to look, of course, is in your SQL.

"explain" and "show status" are your friends. Google or go to the on-line mySQL documentation and try each of them out. You should fairly easily be able to track down the offending query (or queries).

Take a glance here for basic performance analysis and tuning under MySQL:

http://dev.mysql.com/doc/refman/5.0/...-overview.html

Please let us know what you find!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
chroot mysqld gk_ Linux - Security 2 08-16-2005 11:26 PM
mysqld missing varun_saa Red Hat 6 08-13-2005 07:01 AM
please help guys, wrong cpu speed shown with a regular non-mobile cpu !! : ( maku Linux - Hardware 1 01-02-2005 02:03 PM
mysqld on startup... dark poet Linux - Newbie 8 10-05-2003 12:16 AM
Mysqld cinnix Linux - General 4 07-08-2001 01:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration