I know nothing about MySQL server's or apache and I need a place to start. why is it so high?
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 4991 mysql 20 0 207m 53m 4056 S 150 0.7 9:44.23 mysqld 9386 apache 20 0 41648 16m 3964 R 20 0.2 0:01.56 apache2 9370 apache 20 0 42460 17m 3972 R 16 0.2 0:01.46 apache2
there are about 25 apaches too. If I turn off Apache the CPU usage for Mysql doesn't reduce either.
And ofc I've turned it off and on again.
This MySQL server has been running for 0 days, 0 hours, 3 minutes and 30 seconds. It started up on Sep 29, 2009 at 03:46 PM
Server traffic: These tables show the network traffic statistics of this MySQL server since its startup. Traffic Tip ø per hour Received 6,313 KiB 106 MiB Sent 35 MiB 607 MiB Total 42 MiB 712 MiB Connections ø per hour % max. concurrent connections 99 --- --- Failed attempts 0 0.00 0.00% Aborted 0 0.00 0.00% Total 31 k 529.08 k 100.00% Query statistics: Since its startup, 95,049 queries have been sent to the server. Total ø per hour ø per minute ø per second 95 k 1.63 M 27.16 k 452.61 Query type ø per hour % admin commands 0 0.00 0.00% alter db 0 0.00 0.00% alter table 0 0.00 0.00% analyze 0 0.00 0.00% backup table 0 0.00 0.00% begin 0 0.00 0.00% change db 37 k 633.33 k 57.56% change master 0 0.00 0.00% check 0 0.00 0.00% checksum 0 0.00 0.00% commit 0 0.00 0.00% create db 0 0.00 0.00% create function 0 0.00 0.00% create index 0 0.00 0.00% create table 0 0.00 0.00% delete 0 0.00 0.00% delete multi 0 0.00 0.00% do 0 0.00 0.00% drop db 0 0.00 0.00% drop function 0 0.00 0.00% drop index 0 0.00 0.00% drop table 0 0.00 0.00% drop user 0 0.00 0.00% flush 0 0.00 0.00% grant 0 0.00 0.00% ha close 0 0.00 0.00% ha open 0 0.00 0.00% ha read 0 0.00 0.00% help 0 0.00 0.00% insert 204 3,497.14 0.32% insert select 0 0.00 0.00% kill 0 0.00 0.00% load 0 0.00 0.00% load master data 0 0.00 0.00% load master table 0 0.00 0.00% lock tables 0 0.00 0.00% optimize 0 0.00 0.00% preload keys 0 0.00 0.00% purge 0 0.00 0.00% purge before date 0 0.00 0.00% rename table 0 0.00 0.00% repair 0 0.00 0.00% replace 1 17.14 0.00% replace select 0 0.00 0.00% reset 0 0.00 0.00% Query type ø per hour % restore table 0 0.00 0.00% revoke 0 0.00 0.00% revoke all 0 0.00 0.00% rollback 0 0.00 0.00% savepoint 0 0.00 0.00% select 5,975 102.43 k 9.31% set option 493 8,451.43 0.77% show binlog events 0 0.00 0.00% show binlogs 12 205.71 0.02% show charsets 12 205.71 0.02% show collations 12 205.71 0.02% show column types 0 0.00 0.00% show create db 0 0.00 0.00% show create table 0 0.00 0.00% show databases 12 205.71 0.02% show errors 0 0.00 0.00% show fields 80 1,371.43 0.12% show grants 1 17.14 0.00% show innodb status 0 0.00 0.00% show keys 45 771.43 0.07% show logs 0 0.00 0.00% show master status 0 0.00 0.00% show ndb status 0 0.00 0.00% show new master 0 0.00 0.00% show open tables 1 17.14 0.00% show privileges 0 0.00 0.00% show processlist 3 51.43 0.00% show slave hosts 0 0.00 0.00% show slave status 0 0.00 0.00% show status 8 137.14 0.01% show storage engines 0 0.00 0.00% show tables 0 0.00 0.00% show variables 31 531.43 0.05% show warnings 0 0.00 0.00% slave start 0 0.00 0.00% slave stop 0 0.00 0.00% stmt close 0 0.00 0.00% stmt execute 0 0.00 0.00% stmt prepare 0 0.00 0.00% stmt reset 0 0.00 0.00% stmt send long data 0 0.00 0.00% truncate 0 0.00 0.00% unlock tables 0 0.00 0.00% update 469 8,040.00 0.73% update multi 0 0.00 0.00% Flush_commands 1 The number of executed FLUSH statements. Slow_queries 4 The number of queries that have taken more than long_query_time seconds.Documentation Begin SSL Variable Value Description Ssl_accept_renegotiates 0 Ssl_accepts 0 Ssl_callback_cache_hits 0 Ssl_cipher Ssl_cipher_list Ssl_client_connects 0 Ssl_connect_renegotiates 0 Ssl_ctx_verify_depth 0 Ssl_ctx_verify_mode 0 Ssl_default_timeout 0 Ssl_finished_accepts 0 Ssl_finished_connects 0 Ssl_session_cache_hits 0 Ssl_session_cache_misses 0 Ssl_session_cache_mode NONE Ssl_session_cache_overflows 0 Ssl_session_cache_size 0 Ssl_session_cache_timeouts 0 Ssl_sessions_reused 0 Ssl_used_session_cache_entries 0 Ssl_verify_depth 0 Ssl_verify_mode 0 Ssl_version Begin Handler Variable Value Description Handler_commit 0 The number of internal COMMIT statements. Handler_delete 0 The number of times a row was deleted from a table. Handler_discover 0 The MySQL server can ask the NDB Cluster storage engine if it knows about a table with a given name. This is called discovery. Handler_discover indicates the number of time tables have been discovered. Handler_read_first 43 The number of times the first entry was read from an index. If this is high, it suggests that the server is doing a lot of full index scans; for example, SELECT col1 FROM foo, assuming that col1 is indexed. Handler_read_key 14 M The number of requests to read a row based on a key. If this is high, it is a good indication that your queries and tables are properly indexed. Handler_read_next 20 M The number of requests to read the next row in key order. This is incremented if you are querying an index column with a range constraint or if you are doing an index scan. Handler_read_prev 619 The number of requests to read the previous row in key order. This read method is mainly used to optimize ORDER BY ... DESC. Handler_read_rnd 21 k The number of requests to read a row based on a fixed position. This is high if you are doing a lot of queries that require sorting of the result. You probably have a lot of queries that require MySQL to scan whole tables or you have joins that don't use keys properly. Handler_read_rnd_next 32 M The number of requests to read the next row in the data file. This is high if you are doing a lot of table scans. Generally this suggests that your tables are not properly indexed or that your queries are not written to take advantage of the indexes you have. Handler_rollback 0 The number of internal ROLLBACK statements. Handler_update 4,781 k The number of requests to update a row in a table. Handler_write 4,073 k The number of requests to insert a row in a table. Begin Query cache Variable Value Description Flush query cache Documentation Qcache_free_blocks 66 The number of free memory blocks in query cache. Qcache_free_memory 30 M The amount of free memory for query cache. Qcache_hits 20 k The number of cache hits. Qcache_inserts 1,478 The number of queries added to the cache. Qcache_lowmem_prunes 0 The number of queries that have been removed from the cache to free up memory for caching new queries. This information can help you tune the query cache size. The query cache uses a least recently used (LRU) strategy to decide which queries to remove from the cache. Qcache_not_cached 4,498 The number of non-cached queries (not cachable, or not cached due to the query_cache_type setting). Qcache_queries_in_cache 953 The number of queries registered in the cache. Qcache_total_blocks 2,052 The total number of blocks in the query cache. Begin Threads Variable Value Description Show processes Documentation Slow_launch_threads 0 The number of threads that have taken more than slow_launch_time seconds to create. Threads_cached 46 The number of threads in the thread cache. The cache hit rate can be calculated as Threads_created/Connections. If this value is red you should raise your thread_cache_size. Threads_connected 53 The number of currently open connections. Threads_created 99 The number of threads created to handle connections. If Threads_created is big, you may want to increase the thread_cache_size value. (Normally this doesn't give a notable performance improvement if you have a good thread implementation.) Threads_running 33 The number of threads that are not sleeping. Threads_cache_hitrate_% 99.68 % Begin Binary log Variable Value Description Documentation Binlog_cache_disk_use 0 The number of transactions that used the temporary binary log cache but that exceeded the value of binlog_cache_size and used a temporary file to store statements from the transaction. Binlog_cache_use 0 The number of transactions that used the temporary binary log cache. Begin Temporary data Variable Value Description Created_tmp_disk_tables 3,337 The number of temporary tables on disk created automatically by the server while executing statements. If Created_tmp_disk_tables is big, you may want to increase the tmp_table_size value to cause temporary tables to be memory-based instead of disk-based. Created_tmp_files 0 How many temporary files mysqld has created. Created_tmp_tables 4,880 The number of in-memory temporary tables created automatically by the server while executing statements. Begin Delayed inserts Variable Value Description Delayed_errors 0 The number of rows written with INSERT DELAYED for which some error occurred (probably duplicate key). Delayed_insert_threads 0 The number of INSERT DELAYED handler threads in use. Every different table on which one uses INSERT DELAYED gets its own thread. Delayed_writes 0 The number of INSERT DELAYED rows written. Not_flushed_delayed_rows 0 The number of rows waiting to be written in INSERT DELAYED queues. Begin Key cache Variable Value Description Documentation Key_blocks_not_flushed 0 The number of key blocks in the key cache that have changed but haven't yet been flushed to disk. It used to be known as Not_flushed_key_blocks. Key_blocks_unused 13 k The number of unused blocks in the key cache. You can use this value to determine how much of the key cache is in use. Key_blocks_used 1,541 The number of used blocks in the key cache. This value is a high-water mark that indicates the maximum number of blocks that have ever been in use at one time. Key_read_requests 27 M The number of requests to read a key block from the cache. Key_reads 2,413 The number of physical reads of a key block from disk. If Key_reads is big, then your key_buffer_size value is probably too small. The cache miss rate can be calculated as Key_reads/Key_read_requests. Key_write_requests 43 k The number of requests to write a key block to the cache. Key_writes 193 The number of physical writes of a key block to disk. Key_buffer_fraction_% 20.88 % Key_write_ratio_% 0.45 % Key_read_ratio_% 0.01 % Begin Joins Variable Value Description Select_full_join 9 The number of joins that do not use indexes. If this value is not 0, you should carefully check the indexes of your tables. Select_full_range_join 0 The number of joins that used a range search on a reference table. Select_range 805 The number of joins that used ranges on the first table. (It's normally not critical even if this is big.) Select_range_check 0 The number of joins without keys that check for key usage after each row. (If this is not 0, you should carefully check the indexes of your tables.) Select_scan 4,115 The number of joins that did a full scan of the first table. Begin Replication Variable Value Description Show slave hosts Show slave status Documentation Rpl_status NULL The status of failsafe replication (not yet implemented). Slave_open_temp_tables 0 The number of temporary tables currently open by the slave SQL thread. Slave_retried_transactions 0 Total (since startup) number of times the replication slave SQL thread has retried transactions. Slave_running OFF This is ON if this server is a slave that is connected to a master. Begin Sorting Variable Value Description Sort_merge_passes 0 The number of merge passes the sort algorithm has had to do. If this value is large, you should consider increasing the value of the sort_buffer_size system variable. Sort_range 47 The number of sorts that were done with ranges. Sort_rows 21 k The number of sorted rows. Sort_scan 4,982 The number of sorts that were done by scanning the table. Begin Tables Variable Value Description Flush (close) all tables Show open tables Open_tables 276 The number of tables that are open. Opened_tables 282 The number of tables that have been opened. If opened tables is big, your table cache value is probably too small. Table_locks_immediate 9,116 The number of times that a table lock was acquired immediately. Table_locks_waited 56 The number of times that a table lock could not be acquired immediately and a wait was needed. If this is high, and you have performance problems, you should first optimize your queries, and then either split your table or tables or use replication. Begin Variable Value Description Open_files 368 The number of files that are open. Open_streams 0 The number of streams that are open (used mainly for logging).