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 |