Find the answer to your Linux question:
Results 1 to 6 of 6
Hi! Is it possible that server log files can cause high cpu usage? My Load Averages are very high (over 12). It appears that mysql is causing it. There was ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2009
    Posts
    3

    Server logs cause high cpu usage??


    Hi!

    Is it possible that server log files can cause high cpu usage?

    My Load Averages are very high (over 12). It appears that mysql is causing it.
    There was a slow-query log that was 450MB heavy.
    I disabled it. It seems that the loads went down a bit.

    Are there any other logs I should consider emptying or disableing?

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,356
    1) you have high load
    2) the slow query log grows fast
    3) mysql is causing the load.

    Disabling logs wont give you much.
    And you will miss them, if something goes wrong.
    Slow query log is a good example:
    It shows the queries, that are slow ( oh really? )
    So either these queries are badly designed,
    or they have to be heavy
    or the queries themselves are ok, but the machine is too slow, badly configured for the task or overloaded.


    I would look into tuning mysql.
    • Could be that the SQL queries against it are badly designed
    • Could be that some parameters in my.cnf can be tuned. Do you have lots of memory and this is a dedicated DB machine? Crank it up There is a my-innodb-heavy-4G.cnf.
      Use that, even if only as a guideline.
    • Could be that a index at the right place speeds things up
    • Could be that you need more I/O power. Do you see a lot of IO wait?
      Hint:
      raid5 plus DB = Big NoNo
      Give the DB a raid10 with lots of spindles
      log and dump go to another raid.
    • Could be the machine simply is too slow for your tasks. IBM / HP / SUN / DELL, etc will be happy to help you with that
    Last edited by Irithori; 12-31-2009 at 08:09 AM.
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    Dec 2009
    Posts
    3
    OK, tnx.

    These are the last 5 slow queries from the slow-log.
    Does this suggest that there is an indexing problem?


    Code:
    # Time: 091231 11:10:45
    # User@Host: user @ localhost []
    # Query_time: 4  Lock_time: 0  Rows_sent: 46373  Rows_examined: 46373
    SELECT * FROM adds1 WHERE 
    			kateg=8 AND 1;
    # Time: 091231 11:10:47
    # User@Host: user1 @ localhost []
    # Query_time: 3  Lock_time: 0  Rows_sent: 58  Rows_examined: 48899
    use db_test2;
    SELECT DISTINCTROW O.lotok, O.lregija, O.lregijas, O.lzupanija FROM adds AS O WHERE 1  ORDER BY O.lotok;
    
    # Time: 091231 11:11:40
    # User@Host: user @ localhost []
    # Query_time: 4  Lock_time: 0  Rows_sent: 46373  Rows_examined: 46373
    use db_web;
    SELECT * FROM adds1 WHERE 
    			kateg=8 AND 1;
    # User@Host: user1 @ localhost []
    # Query_time: 3  Lock_time: 0  Rows_sent: 15  Rows_examined: 48813
    use db_test2;
    SELECT DISTINCTROW O.lregija, O.lregijas FROM adds AS O ORDER BY O.lregija;
    
    # Time: 091231 11:11:48
    # User@Host: user @ localhost []
    # Query_time: 3  Lock_time: 0  Rows_sent: 46373  Rows_examined: 46373
    use db_web;
    SELECT * FROM adds1 WHERE 
    			kateg=8 AND 1;

  4. #4
    Linux User
    Join Date
    Nov 2009
    Location
    France
    Posts
    292
    Switch to PostGreSQL or Apache Derby if you can, MySQL sucks, it's the worst performing server ! Spending much on heavy machines ,which hardware vendors would readily direct you to do, won't be the most efficient solution.

  5. #5
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,754
    Quote Originally Posted by napraviculom View Post
    OK, tnx.

    These are the last 5 slow queries from the slow-log.
    Does this suggest that there is an indexing problem?


    Code:
    # Time: 091231 11:10:45
    # User@Host: user @ localhost []
    # Query_time: 4  Lock_time: 0  Rows_sent: 46373  Rows_examined: 46373
    SELECT * FROM adds1 WHERE 
    			kateg=8 AND 1;
    # Time: 091231 11:10:47
    # User@Host: user1 @ localhost []
    # Query_time: 3  Lock_time: 0  Rows_sent: 58  Rows_examined: 48899
    use db_test2;
    SELECT DISTINCTROW O.lotok, O.lregija, O.lregijas, O.lzupanija FROM adds AS O WHERE 1  ORDER BY O.lotok;
    
    # Time: 091231 11:11:40
    # User@Host: user @ localhost []
    # Query_time: 4  Lock_time: 0  Rows_sent: 46373  Rows_examined: 46373
    use db_web;
    SELECT * FROM adds1 WHERE 
    			kateg=8 AND 1;
    # User@Host: user1 @ localhost []
    # Query_time: 3  Lock_time: 0  Rows_sent: 15  Rows_examined: 48813
    use db_test2;
    SELECT DISTINCTROW O.lregija, O.lregijas FROM adds AS O ORDER BY O.lregija;
    
    # Time: 091231 11:11:48
    # User@Host: user @ localhost []
    # Query_time: 3  Lock_time: 0  Rows_sent: 46373  Rows_examined: 46373
    use db_web;
    SELECT * FROM adds1 WHERE 
    			kateg=8 AND 1;
    MySQL Performance Tuning

  6. #6
    Just Joined!
    Join Date
    Dec 2009
    Posts
    3
    The cause is traced. I didn't know really what indexing is.
    Thanks for the replies.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •