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

Message ListMessage List     Post MessagePost Message

  ChartDirector concurrency and throughput
Posted by Rob R on Jun-02-2011 02:21
"Help me!  I'm melting!"

This is a busy time of year on my website, and ChartDirector is currently a bottleneck on my website producing about 2 charts per second sustained.  The charts are not particularly complicated: mostly line charts with <10 points.  The most popular web page now has about 8 charts on it.  I'm looking for ideas to improve throughput.

My environment: IIS 7 on Windows Server 2008 x64; Classic ASP w/ server-side JavaScript using ChartDirector COM.

The dllhost.exe*32 (hosting ChartDirector) is running at 6% on a 16 CPU server (nearly consuming a single core.  The temp folder used to output makeChart() files has 1320 entries with 2 added and 2 deleted every second (hence my 2 per second estimate).
Is COM serializing all access to ChartDirector?

I've got plenty of spare cycles on my server...if only I could use more threads.

Any help is appreciated.  Thanks!
Robert

  Re: ChartDirector concurrency and throughput
Posted by Peter Kwan on Jun-03-2011 03:46
Hi Rob,

Even if ChartDirector is running on 1 CPU, it should be able to generate much more than 2 charts per second. Also, as far as I know, COM will not serialize the access. (The COM is controlled by the OS.)

For your case, are you using the makeTmpFile method to create the charts as temporary files? Assuming the charts are actually generated very fast, I suspect the bottleneck is in creating and cleaning up the temporary files.

During makeTmpFile, ChartDirector will clean up old temporary files and create the chart as a temporary file. To clean up the temporary files, ChartDirector would need to scan the directory, and delete those files which are older than a certain time (which defaults to 600 seconds).

I have not checked myself, but I guess during directory scanning, the OS may not allow another file to be created. If the majority of the CPU time is actually spent on directory scanning, then the access is effective serialized, because one thread cannot write to the directory while another thread is scanning the directory.

To determine if the above is the cause of the problem, may be you can try some of the following test:

(a) If possible, try not to use makeTmpFile. Instead, use makeSession, which does not use temporary files.

You may create a web page that does not use temporary files, put a lot of charts to it using random numbers as data, and see if it is still slow (only showing 2 charts per second) or if it is much quicker.

(b) Try using a shorter lifetime and use a method to ask ChartDirector not to scan the directory everytime. One method is like:

Randomize
If Rnd > 0.99 Then
    filename = c.makeTmpFile(Server.MapPath("/tmpcharts"), cd.PNG, 60)
Else
    filename = c.makeTmpFile(Server.MapPath("/tmpcharts"), cd.PNG, -1)
End If

With the above code, there is only a 1% chance that ChartDirector will scan the directory. This means on average, the directory will be scanned for old files for every 100 access.

(c) There is a known issue that DBTable is slow on "ChartDirector for ASP/COM/VB" on 64-bit Windows. This has been fixed on Apr 18, 2010. Are you using DBTable in your code? If yes, please check if your "comchartdir.dll" is dated Apr 18, 2010 (or around that date - the exact date may differ by 1 day due to time zone differences).

Please kindly let me know what is the result.

Regards
Peter Kwan

  Re: ChartDirector concurrency and throughput
Posted by Rob R on Jun-03-2011 04:54
Thanks Peter!  It's like someone opened the flood gates on the dam.

We added the "-1" lifetime on makeTmpFile() and saw an IMMEDIATE difference.
Scanning a folder with 1000+ plus files isn't too bad...unless you're doing it several times per second.

I'll just create a schedule task that runs periodically to clean the temp files.

Thanks again.
Robert