Orionsbelter Posted May 28, 2008 Share Posted May 28, 2008 help me please my sever is slow what process don't i need running, i need mysql and php to run but which ones don't i need to run here is the process list User CPU % VM Size Res Size Stat Start Command root 0.0 1960 KB 652 KB Ss 07:51 init Stop Kill apache 0.6 0 KB 0 KB Z 11:17 httpd <defunct> Stop Kill apache 0.3 34160 KB 9460 KB S 11:17 httpd Stop Kill cyrus 0.0 31252 KB 2080 KB S 10:49 imapd Stop Kill apache 0.3 34204 KB 9372 KB S 11:17 httpd Stop Kill apache 0.4 34228 KB 9564 KB S 11:18 httpd Stop Kill apache 0.3 34120 KB 9324 KB S 11:18 httpd Stop Kill apache 0.4 34148 KB 9472 KB S 11:18 httpd Stop Kill apache 0.3 34044 KB 9304 KB S 11:18 httpd Stop Kill apache 0.4 34056 KB 9260 KB S 11:18 httpd Stop Kill apache 0.4 34232 KB 9472 KB S 11:18 httpd Stop Kill apache 0.2 34064 KB 9208 KB S 11:18 httpd Stop Kill cyrus 0.0 31252 KB 2080 KB S 10:50 imapd Stop Kill cyrus 0.0 31252 KB 2080 KB S 10:50 imapd Stop Kill root 0.0 6624 KB 1740 KB Ss 09:51 master Stop Kill cyrus 0.0 10776 KB 2680 KB Ss 09:51 cyrus-master Stop Kill cyrus 0.0 29812 KB 488 KB S 09:51 idled Stop Kill cyrus 0.0 31252 KB 2092 KB S 09:51 imapd Stop Kill cyrus 0.0 30952 KB 2048 KB S 09:51 pop3d Stop Kill cyrus 0.0 30952 KB 2052 KB S 09:51 pop3d Stop Kill cyrus 0.0 31048 KB 2324 KB S 09:51 lmtpd Stop Kill cyrus 0.0 30952 KB 2048 KB S 09:51 pop3d Stop Kill cyrus 0.0 30952 KB 2048 KB S 09:51 pop3d Stop Kill postfix 0.0 6688 KB 1752 KB S 09:51 pickup Stop Kill postfix 0.0 6748 KB 1832 KB S 09:51 qmgr Stop Kill apache 0.3 34384 KB 9828 KB S 11:04 httpd Stop Kill cyrus 0.0 31252 KB 2080 KB S 10:36 imapd Stop Kill cyrus 0.0 31252 KB 2080 KB S 10:36 imapd Stop Kill root 0.0 5500 KB 1652 KB Ss 08:14 vsftpd Stop Kill 502 0.0 5684 KB 1312 KB S 08:14 vsftpd Stop Kill postfix 0.0 6684 KB 1784 KB S 10:06 tlsmgr Stop Kill apache 0.0 34040 KB 9332 KB S 11:07 httpd Stop Kill apache 0.0 34072 KB 9164 KB S 11:07 httpd Stop Kill apache 0.0 34064 KB 9248 KB S 11:07 httpd Stop Kill apache 0.0 34164 KB 9376 KB S 11:08 httpd Stop Kill root 0.0 1628 KB 572 KB Ss 07:51 syslogd Stop Kill named 0.0 69556 KB 3260 KB Ssl 07:51 named Stop Kill root 0.0 6068 KB 1000 KB Ss 07:51 sshd Stop Kill root 0.0 2600 KB 848 KB Ss 07:51 xinetd Stop Kill root 0.0 4972 KB 504 KB Ss 07:51 vsftpd Stop Kill root 0.0 2340 KB 1120 KB S 07:51 mysqld_safe Stop Kill mysql 45.4 147192 KB 27044 KB Sl 07:51 mysqld Stop Kill root 0.5 318700 KB 118012 KB Sl 07:51 java Stop Kill root 0.0 33376 KB 13372 KB Ss 07:51 httpd Stop Kill root 0.0 3180 KB 1100 KB Ss 07:51 crond Stop Kill root 0.0 5356 KB 708 KB Ss 07:51 saslauthd Stop Kill root 0.0 5356 KB 436 KB S 07:51 saslauthd Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted May 28, 2008 Share Posted May 28, 2008 Well if you look at the CPU % column, MySQL is using 45% of the CPU in that snapshot, which indicates you probably have some poorly written queries bogging down your server. Quote Link to comment Share on other sites More sharing options...
Orionsbelter Posted May 28, 2008 Author Share Posted May 28, 2008 can anyone give me a link to making better querys Quote Link to comment Share on other sites More sharing options...
conker87 Posted May 28, 2008 Share Posted May 28, 2008 Post your code. Quote Link to comment Share on other sites More sharing options...
gizmola Posted May 28, 2008 Share Posted May 28, 2008 With mysql you can turn on the slow running query logging. There are a few ways to do this, but the one I'd suggest is adding this to your mysql configuration file, which is typically named my.cnf. It's often in the /etc directory or /etc/mysql directory, but that depends on your server config. Edit it to add this under the [mysqld] section # Logging set-variable=long_query_time=5 log-slow-queries=/var/log/mysql/slow-queries.log You might need to change the file path to suit your server config -- for example I assume here you already have a /var/log/mysql directory. You can also play with the long_query_time making it longer or shorter (it's in seconds). You have to restart mysql after you make these changes. Once that's working you should open up a shell and tail -f the file, then watch your server run through it's paces, and test things. You'll see the queries that are taking a long time. If you find queries that are tablescanning then you'll look to see whether there is a sensible index that you can add. Beyond that there are entire books on query optimization. It's too complicated a subject to dash off a simple reply. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.