|
Dropped performance when deployed to some servers |
Posted by Magnus on Nov-04-2016 15:44 |
|
Hi,
I'm having trouble with deploying to a specific server, where I see a increase of about x6 execution time for chart director compared to my development machine and test server. I don't have direct access to this server, and I just supply a installation package, so it's hard to do any hands on testing to find the issue.
So far I have more or less excluded that it's connected to data collection and performance any SQL-performance. For some charts I've managed to add debug where data is already collected, and it's still slow, and SQL-responses have normal responce time.
We have had chartdirector running on the same site, but different server and it runs OK. Though, it's an older version of chart director (from about 2007-2008). Now I've switched to 6.1.
Our application runs fine on IIS8, IIS Express. Target server runs IIS 7.5.
Running C# .Net, Windows Server 2012/2014, IIS 8, .NET Framework 4.5, ChartDirector for .NET 6.1
We have tested to switch Managed Pipeline between Classis and Integrated, without any difference.
Any suggestions on what more to check? |
Re: Dropped performance when deployed to some servers |
Posted by Peter Kwan on Nov-04-2016 23:25 |
|
Hi Magnus,
If the code runs fast in one server, but slow in another server, the followings are some possibilities:
(a) The web server may be too busy. In many systems, the SQL server is a different machine from the web server, so the SQL part may appear to be fast, even if the web server is slow. The charting code is CPU intensive (it is basically computer graphics code), so it would be slow if the CPU is busy.
(b) The network is too slow for the content. The chart itself does not have too much network overhead. However, if there are a lot of data points, the image map (for tooltips and hot spots) may become very large. If your chart has many data points and uses getHTMLImageMap, try to comment out the getHTMLImageMap line to see if it makes any difference.
(c) The WebChartViewer internally uses session variables. By default, it takes negligible time. However, in some "server farm" configurations, the session variables for the servers in the farm may be stored centrally in another server through the ASP.NET State service. If for some reason, that server is slow, the web page will become slow too.
If you can modify the code, it should not be difficult to measure the time used to create the chart. First, please structure the code so that the charting part and the SQL part is separated, so they can be measured separately. The code should be like:
.... SQL code here ....
double[] myData = .... from SQL code ....;
double[] myData2 = .... from SQL code ....;
string[] myLabels = .... from SQL code ....;
.....
// charting code starts here with no SQL code below
// Timer to measure CPU time used
Stopwatch timer = new Stopwatch();
timer.Start();
XYChart c = new XYChart
..... charting code as usual .....
// make the chart here
c.makeWebImage(Chart.PNG);
// time used in milliseconds
long timeUsed = timer.Elapsed.Ticks / 10000;
// include the elapsed time in the chart top-left corner
c.addText(10, 0, "Time = " + timeUsed + "ms", "Arial", 8).setBackground(0xffff00);
// make the chart again
viewer.Image = c.makeWebImage(Chart.PNG);
With the above code, you can see the time used to create the chart in the top-left corner of the chart. You can also measure the SQL part of the code and add them to the chart too. Note that the above code actually renders the chart twice. After making the chart the first time, it obtains the elapsed time, then it adds the result to the chart and then makes the chart again.
Regards
Peter Kwan |
|