Performance, multithreading and webservices
Performance, multithreading and webservices
We have a .NET web form that uses TeeChart .NET control to create charts. Data comes from a webservice. We tried stress testing the page and it can handle 18 charts / second. During that time the entire web site that includes the charts is almost unresponsive, as if IIS is waiting for the chart to complete and then serve additional requests.
The delay is from the webservice, because when creating charts with dummy data, the performance is 50 charts / second.
Is there a way for the chart to NOT delay the whole IIS web site when it is waiting for data from the web service?
The delay is from the webservice, because when creating charts with dummy data, the performance is 50 charts / second.
Is there a way for the chart to NOT delay the whole IIS web site when it is waiting for data from the web service?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi realize,
Can you please read this topic, specially Norbert's message and my reply about threads? Does this apply to your application? I mean, could it be that your threads don't leave enough time for the charts to paint themselves and thus they seem to be unresponsive?
Can you please read this topic, specially Norbert's message and my reply about threads? Does this apply to your application? I mean, could it be that your threads don't leave enough time for the charts to paint themselves and thus they seem to be unresponsive?
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
I read it but I am not sure it helps. Let me rephrase:
* We have a dll that creates charts (teechart)
* This dll is called by a web page in .NET
* The web page feeds TeeChart with data. If, for any reason, the data feed is delayed, and another page calls TeeChart dll to create a chart, does teechart have to wait for process 1 to finish before executing process 2 ?
* We have a dll that creates charts (teechart)
* This dll is called by a web page in .NET
* The web page feeds TeeChart with data. If, for any reason, the data feed is delayed, and another page calls TeeChart dll to create a chart, does teechart have to wait for process 1 to finish before executing process 2 ?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi realize,
We guess this is the same as threading, basically add data to the serise, wait for the chart to finish drawing it, and then add new data, etc.
What you could do is putting a flag, set to false, in the BeforeDraw event and in the AfterDraw event set it to true. Then you know that if the flag is true new data can be added.
We guess this is the same as threading, basically add data to the serise, wait for the chart to finish drawing it, and then add new data, etc.
What you could do is putting a flag, set to false, in the BeforeDraw event and in the AfterDraw event set it to true. Then you know that if the flag is true new data can be added.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hello,
Representing data graphically, that is, drawing data as a chart, is a time consuming process. TeeChart needs to be given time to complete this process, which in a multi-threaded environment means not giving it more data until it has finished painting the last dataset it has been given. The way to check if a TeeChart is painting or not is a flag in the BeforeDraw and AfterDraw events, a flag we could internalise as a property but which would do exactly the same.
You might consider caching charts in your application so that the same chart doesn't have to be created time and time again. In this way new charts are created only when the data has changed, greatly reducing the load on the TeeChart routines.
Representing data graphically, that is, drawing data as a chart, is a time consuming process. TeeChart needs to be given time to complete this process, which in a multi-threaded environment means not giving it more data until it has finished painting the last dataset it has been given. The way to check if a TeeChart is painting or not is a flag in the BeforeDraw and AfterDraw events, a flag we could internalise as a property but which would do exactly the same.
You might consider caching charts in your application so that the same chart doesn't have to be created time and time again. In this way new charts are created only when the data has changed, greatly reducing the load on the TeeChart routines.
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
I'll try to explain one last time... Sorry if I am not able to make myself clear...
Lets say that teechart needs 10 secs to get data (because data is coming from a remote web service (Stage A).
When this data comes, it needs 1 second to draw the chart (Stage B).
I understand that it cannot draw a second chart during stage B. But can it draw a second chart during stage A? If yes, how?
I hope I explined it right now
Lets say that teechart needs 10 secs to get data (because data is coming from a remote web service (Stage A).
When this data comes, it needs 1 second to draw the chart (Stage B).
I understand that it cannot draw a second chart during stage B. But can it draw a second chart during stage A? If yes, how?
I hope I explined it right now
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi realize,
You can try using TeeChart's AutoRepaint property:
Before loading data (Stage A) you set data-loading chart's AutoRepaint to false and set it back to true when the chart being drawn has finished this process, on its AfterDraw event.
You can try using TeeChart's AutoRepaint property:
Code: Select all
tChart1.AutoRepaint = false;
Random r = new Random();
for(int i = 0; i <500; i++)
{
tChart1[0].Add (i,r.Next(800),Color.Blue);
}
tChart1.AutoRepaint = true;
tChart1.Refresh();
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi realize,
The tecnique in the code snippet I posted is not dependent on WinForms. Its WebForms equivalent would be:
Anyway, it's not a problem if you want TeeChart to draw another chart while you're waiting for the data. You can collect the data into a dataset, which may take some time, and in the meantime, you can draw a chart. Then, when the dataset is complete, you can assign it as a datasource of your series and get it drawn. TeeChart doesn't have to wait for the data to arrive, you can get a dataset to wait for it to arrive and use the TChart to do whatever you like in the meantime.
The tecnique in the code snippet I posted is not dependent on WinForms. Its WebForms equivalent would be:
Code: Select all
Steema.TeeChart.Chart ch1 = WebChart1.Chart;
ch1.AutoRepaint = false;
Random r = new Random();
for (int i = 0; i < 500; i++)
{
ch1[0].Add(i, r.Next(800), System.Drawing.Color.Blue);
}
ch1.AutoRepaint = true;
ch1.Invalidate();
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |