# [SOLVED] Random system load spikes for about 1 minute

## sbergloff

I recently installed Gentoo using the minimal CD and a stage 3 tarball, following online documentation and research.  I am using the x86_64 platform with an AMD Athlon 64x2 processor and 2GB DDR2 RAM.  It went through a couple of failed installation attempts as this was a learning process for me; but, 3rd times a charm as I am up and running very well (mostly).  

Once I was happy with my base installation, I felt comfortable with customizing for what I wanted to use it for.  

I emerged gnome-light, and then emerged only the packages that I knew that I would want to use.

The system seems to have stellar performance, except for random load spikes which freeze up my system for about a minute at a time.  If I open up mplayer to play a video, the system will freeze up for about 1 minute, and then play the video just fine normally.  Afterward, I can play 10 other videos (even at the same time if I want to) and performance is perfect.

Sometimes in Firefox I will click a link, the system once again freezes for about a minute (usually with the hard drive activity light going crazy).  But then it will run just fine.

I also run World of Warcraft using Cedega.  I have used Wine also, but it seems to have higher frame rates for me in Cedega.  When I first start the game, it seems to freeze up for a couple of minutes while I assume it is loading and my hard drive activity light is blinking a lot during this time.  Once I get in the game, it runs flawlessly.  But, after playing a while, I will just be running along and suddenly the video freezes and the sound starts repeating whatever bit that it's on for about a minute, with hard drive activity way up during this time.  After a minute, it all frees up and I can continue.

Even something as simple as opening gedit in Gnome to something as complex as running WoW in Cedega, I see the same load spikes.

If I reopen WoW after closing it, it seems to load faster and it takes a little longer for the spikes to occur.  Other programs seem to cause the spikes more primarlily the first time they are opened after rebooting.  

If I can fix this one issue, I will be perfectly happy with my system.  Using the gnome-system-monitor applet, it looks like my CPU usage jumps to 100% during the load spikes.  Using the top command, there seems to be a large number in the VIRT column for wine-server, but that would not be consistent as the cause because it occurs even when this is not running.  WoW is the only Windows program that I run, and I don't run it all the time.  When I open the gnome system monitor, I don't see what is causing the 100% load on the CPU when it is reporting it.  I notice that there are 2 colors in the CPU usage in the applet.  There is a brighter blue and then a darker blue above it.  Is this because I have dual core?

I have read that hald might be causing it, so I stopped all hald processes, and that did not fix it.  I felt like it could be swap space utilization causing it, so I turned off my swap space, and that didn't fix it.  I updated my Nvidia driver, recompiled my kernel and can't seem to figure this one out.

I've been trying to figure out what could be causing this for a couple of weeks, and have not been successful.  I'm not sure what log files to look for clues in.  I thank you in advance for any and all assistance.  I just need to be pointed in the right direction to fix this.  I used Sabayon Linux prior to installing Gentoo.  Overall system performance was not as good in Sabayon, but I never had these load spikes.  That leads me to believe that it's not the hardware, so there must be something running that is doing it, or perhaps something that's not running that should be.  I also noticed that it seems to take a long time to copy large files from a disc to the hard drive.  I expect it to take a little while for a large file, but it seems a little too long.  I wonder if these issues are related.

Any ideas?

Let me know if I posted this in the wrong section.Last edited by sbergloff on Thu Nov 20, 2008 11:24 pm; edited 1 time in total

----------

## paulbiz

I had a similar problem, mine happened related to disk activity blocking the whole UI, somewhat randomly, and it turned out to be a flaw in ext3's design. I switched to xfs and everything has been fine ever since. Are you using ext3?

----------

## sbergloff

I am using ext3.  I wonder if that's the whole problem.  It makes sense, so I guess I will give it a shot.  Are there any tools for changing my file system on a drive that already has data, or do I have a large backup to look forward to?

----------

## paulbiz

I can't remember the specifics, but I think it was related to the journal and basically when one file was flushed, it would flush ALL pending disk writes, blocking everything else in the mean time. I think it's just a design flaw so not something that'll be fixed. xfs and every other filesystem have their own quirks, too, I'm sure. I think reiser3 is the only one with full journaling, but I've never used it before so I went with xfs since I've had no disasters (yet  :Smile:  ).

So, when you have lots of RAM like your 2GB there's much more able to be used as disk cache (and in my case I have 8 GB so the freezes were very long)

You can try to add commit=300 to your ext3 mount options in /etc/fstab ... that reduced the effects slightly for me, though it still existed. You can play with different values, basically the thought is to not allow too much data to accumulate in RAM, so when it does decide to sync everything to disk there's not as much there, making the freeze-up last a shorter amount of time. Depending on how bad it is for you, maybe that'll be enough to make it less annoying (assuming it's the same problem I was having).

You could also use the partition in ext2 mode instead of ext3, but obviously then you lose the journaling and if you crash/power out you have potential days of fsck in your future  :Razz: 

As far as converting, I don't think there are really any tools for that in general. I had an external USB harddrive so I was able to copy off all the data, format, and copy it all back.

----------

## sbergloff

Thanks for all the info.  I'm in the process of copying my files and switching the partitions to xfs right now.  Hopefully, I can finish up tonight and see if it worked.  If you hadn't pointed this out, I would still be scratching my head.  It really does make alot of sense, and I see now that ext3 is considered slow but secure, while xfs is considered high performance but less secure.  It's my home PC, so performance > security.  

With all the additional research I did when I was setting up the OS, the file system is perhaps the one thing that I didn't think much about.  I felt like ext3 was a proven fs with journaling, so I just went with that.  As I said before, this whole thing has been a great learning experience for me, so I don't mind the extra challenges.

----------

## paulbiz

I hope it works! Same here, I used ext3 for a long time on my old PC which was slower and had significantly less RAM (512 mb), so I never ran into this problem. Once I got a faster machine with more memory, it was really painful. At first i thought x86 vs amd64 had something to do with it, maybe it does or doesn't, or maybe amd64 machines tend to be faster in general than x86 since there are much older x86 machines out there. I was frustrated that my new PC which is 4 times faster and has 8 times as much RAM was actually performing worse in some cases.

----------

## sbergloff

I copied all my files to another drive, reformated my partitions as xfs (except for boot which is ext2), and moved it all back.  I think there is definitely some performance improvement, but this problem still exists.  When the problem is occuring, the gnome system montior applet shows my CPU usage jump to 100%, but most of that looks like I/O Wait.  

I'm at work now, so it will be tonight before I can check; but, it occurred to me that I haven't checked whether or not I have DMA enabled.  I will check with hdparm tonight and see if that is the problem.  I hope that is all it is, because it is a really annoying problem.

Thanks for your suggestion to switch to xfs.  I see some other threads explaining how to tweak ext3 for better performance as well, but xfs does seem to suit my needs.  I will post my findings after I get home tonight.

----------

## paulbiz

If you emerge sys-process/iotop it will show you a top-like breakdown of what is causing the I/O wait, though I think it is limited to programs/processes and not internal kernel stuff like commits.  sys-power/powertop may also give you some clues, if there is a power usage spike by any device that coincides with the 100% CPU/wait spike.

----------

## sbergloff

It's fixed!

Wow, I had DMA disabled the whole time.  It turns out I didn't have my IDE chipset compiled into my kernel.  So, I guess this was in the right forum section after all.

Thanks for all your help, and I'm sure my performance is much better than I would have got out of ext3, since I switched to xfs.

----------

## dmpogo

 *sbergloff wrote:*   

> It's fixed!
> 
> Wow, I had DMA disabled the whole time.  It turns out I didn't have my IDE chipset compiled into my kernel.  So, I guess this was in the right forum section after all.
> 
> Thanks for all your help, and I'm sure my performance is much better than I would have got out of ext3, since I switched to xfs.

 

I don't know, when I was setting up my server couple of years ago with SCSI raid array, I benchmarked extensively

ext3, xfs, jfs, reiser3.   I settled on reiser3, but point is the differences where not dramatic.

----------

## dmpogo

 *sbergloff wrote:*   

> It's fixed!
> 
> Wow, I had DMA disabled the whole time.  It turns out I didn't have my IDE chipset compiled into my kernel.  So, I guess this was in the right forum section after all.
> 
> Thanks for all your help, and I'm sure my performance is much better than I would have got out of ext3, since I switched to xfs.

 

BTW, are you sure you want IDE driver for your disk, and not SATA driver in AHCI mode ?

----------

## sbergloff

 *dmpogo wrote:*   

> BTW, are you sure you want IDE driver for your disk, and not SATA driver in AHCI mode ?

 

I'm haven't moved up to SATA yet, so I think I'm good with the IDE driver.  The system is running great now.  Thanks.

----------

