Performance, multithreading and webservices

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
realize
Newbie
Newbie
Posts: 10
Joined: Fri Jul 22, 2005 4:00 am

Performance, multithreading and webservices

Post by realize » Wed Nov 15, 2006 6:57 pm

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?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Nov 16, 2006 9:27 am

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?
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

realize
Newbie
Newbie
Posts: 10
Joined: Fri Jul 22, 2005 4:00 am

Post by realize » Thu Nov 16, 2006 11:34 am

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 ?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Nov 17, 2006 12:25 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

realize
Newbie
Newbie
Posts: 10
Joined: Fri Jul 22, 2005 4:00 am

Post by realize » Tue Nov 21, 2006 1:53 pm

So TeeChart is not multithreaded?

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Wed Nov 22, 2006 8:50 am

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.
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/

realize
Newbie
Newbie
Posts: 10
Joined: Fri Jul 22, 2005 4:00 am

Post by realize » Fri Nov 24, 2006 1:12 pm

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 :)

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Nov 24, 2006 2:58 pm

Hi realize,


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(); 
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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

realize
Newbie
Newbie
Posts: 10
Joined: Fri Jul 22, 2005 4:00 am

Post by realize » Thu Nov 30, 2006 12:37 pm

We are not talking about a Win32 application.
We are talking about a web site with 500+ concurrent users

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Dec 20, 2006 1:18 pm

Hi realize,

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();
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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply