FAQ: Sawmill Uses Too High a Percentage of CPU

When I process log data with Sawmill, it uses most or all of my processor; it says it's using 90%, or even 100% of the CPU. Should it be doing that? Is that a problem?

Short Answer

Yes, it should do that, and it's not usually a problem. Any CPU-intensive program will do the same. However, you can throttle it back if you need to, using operating system priorities.

Long Answer

Sawmill is a "CPU-bound" program while it's processing logs, which means that the microprocessor (a.k.a. CPU) is the bottleneck; the disk feeds data to Sawmill as fast as the processor can handle it. Most programs you use daily (web browsers, mail programs, word processors, etc.) are probably not CPU-bound, but any number-crunching or data-crunching program is. Other examples of programs that are typically CPU-bound include compression/decompression programs like ZIP, 3D rendering programs, and encryption programs (or encryption breakers).

Any well-behaved operating system will give a CPU-bound process as much CPU as it has available, provided that the processing needs of all other processes are met as well. Because most systems use only a small fraction of their processing power, there is usually more than 90% free CPU available at any time. This CPU is wasted unless it is used, so if there's a program like Sawmill that's continually asking for more CPU, the operating system should and will give it as much CPU as possible. If nothing else is running on the system, Sawmill will use 100% of the CPU. Since nothing else needs the CPU, that's as it should be--if the operating system only gave Sawmill 50% of the CPU, it would take twice as long to process the log data, and during the other 50% of the time, the CPU would be sitting idle, wasting time. So don't worry if Sawmill is using nearly 100% of your CPU--that's the way it's supposed to be, and it will generally have no negative effects.

The one time you may see negative effects of Sawmill's CPU usage is if there are other CPU-bound or CPU-intensive programs running on the system. In this case, because all the programs want as much CPU as possible, the operating system will split the CPU evenly between them. For instance if there are three CPU-intensive processes running, each of them will get 33% of the CPU, and each will run 1/3 as fast as it would on a lightly loaded machine. If you have an important CPU-intensive process running on your server (for instance, a very busy web server), you may want to give Sawmill a lower priority than the other processes. You can do this on UNIX systems using the "nice" command, and on Windows systems using the Process Manager. When you set Sawmill's priority to lower than the rest, it will get less than its share of CPU time, and the other processes will run faster. Sawmill, of course, will run slower. Similarly, if other processes are interfering with Sawmill's performance and you don't care about the performance of the other processes, you can increase Sawmill's priority to make it run faster, at the expense of the other processes.

Even programs that are not normally CPU-bound will have moments when they become briefly CPU-bound. For instance, a web browser sits idle most of the time, using almost no CPU, but when you load a complex page, it briefly uses as much CPU as it can get to compute and display the page. During that period, if Sawmill is running, each program will get 50% of the CPU. So the layout will take twice as long as it does when Sawmill is not running, which will make the web browser feel more sluggish than usual. Other programs, and the operating system itself, will similarly feel more sluggish while Sawmill is processing the log data. This is an side effect of having a CPU-bound program running on the system--everything else will slow down. Setting Sawmill to a lower priority will help in this situation, because the web browser will get nearly 100% of the CPU (while Sawmill is temporarily halted) while it's rendering.