ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  LinearMeter cpu usage
Posted by David Salonius on Jan-24-2012 05:48
I'm using the LinearMeter object to draw colored boxes for an ASP.NET project.  It's a vertical meter with dynamic zones (usually 1-5) which ends up being colored rectangles stacked on top of each other.  On the side of the meter, I'm displaying the ticks which are static and a label.  When monitoring server CPU usage, I'm seeing higher cpu numbers than I'd like for this particular application.  In an effort to reduce the cpu load, I changed the tick scale to a separate image so that it is only drawn once leaving the stream update to consist only of the colored rectangle boxes.  This didn't really help the cpu usage, so I thought I'd ask if you had any recommendations for how to configure the object before drawing to minimize the cpu load for this particular case.

  Re: LinearMeter cpu usage
Posted by Peter Kwan on Jan-25-2012 00:36
Hi David,

In web applications, the majority of the CPU usage is in not in generating the chart or meter itself, but in compressing the image into PNG or JPG or GIF. The CPU usage mainly depends on the number of pixels in the image, not on the chart contents.

If you have tried to "zip" a file, you probably notice that data compression takes time. For example, compressing a 250KB file may take in the order of 0.05 second. (A chart of size 300 x 200 pixels is roughly 250KB before compression.) So in practice, creating a chart may take around 0.02 to 0.1 second, depend on your CPU speed and the chart size.

If you are seeing similar level of CPU usage, this could be normal. Using BMP as output should make the chart much faster (as no compression is needed), but making the network much slower (as the file size is much bigger), and this in turn may affect CPU speed too (as the CPU needs to be used to handle much larger network traffic).

If the CPU usage is normal, the most effective method to reduce the CPU usage is to reduce the number of pixels.

Also, note that in measuring CPU usage, the first few chart request will have a much higher CPU usage. It is because the .NET system will perform just in time compilation, so the first few times the CPU is used in compiling the code in realtime. After the first few times, the code should have all been compiled, and it should become normal CPU usage.

On the other hand, if you are seeing abnormally high CPU usage, would you mind to inform me what level of CPU usage are you seeing?

Regards
Peter Kwan

  Re: LinearMeter cpu usage
Posted by David Salonius on Jan-27-2012 03:58
Sorry for taking so long to reply.  After further research, I found that there were other factors going into the chart draw that were consuming more cpu than I had thought.  I think the cpu usage attributed to the chartdirector control is as expected.  Thanks for your response.