20-30 Threads are created when create a chart?

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Arction_LasseP

bool001
Posts: 9
Joined: Wed Apr 04, 2018 3:06 am

20-30 Threads are created when create a chart?

Post by bool001 » Tue Apr 10, 2018 9:15 am

Hi, my application has a requirement of show multi- charts(Need to show 30 charts at the same time). But I find when create a chart, the quantity of threads increases 20-30. So 30 charts make 400-600 threads!

I want to know if it is a hidden trouble when to many threads are created.
And how to reduce the quantity of threads in such a situation?

Thank you!

ArctionKestutis
Posts: 383
Joined: Mon Mar 14, 2016 9:22 am

Re: 20-30 Threads are created when create a chart?

Post by ArctionKestutis » Tue Apr 10, 2018 12:59 pm

Hi,

The multiple threads in general is not bad thing. It allows code to distribute work across multiple processors and the .NET Framework 4 supports parallel programming. However, LightningChart does not control number of threads. The task is given for thread-pool and it is Framework keeps control on optimal number of threads.
As long as number of threads is not increasing during application run, there is no reasons for concern (your numbers are about right). We do had reports in the past about faulty display drivers, which lead to much higher number of threads, memory fragmentation and finally failure of app.

Please note that there is significant difference between 120 series and 120 charts. You could improve memory usage by using multi-segment (or stacked layout) graph. This is that we always recommended, because creating a new chart will cause creation a new DirectX scene (excessive memory required). That is, if you add second segment (or second y-axis) the memory requirement will change only a little. “Lots of real-time traces” allow testing this difference (there you can change number of charts and/or traces). There are number of examples in our Demo app, which show the way of creating segmented/stacked layout: “Y axis layouts”, “Automatic axis placements” etc.

All the best.

PerryKen
Posts: 1
Joined: Mon May 21, 2018 9:49 am

Re: 20-30 Threads are created when create a chart?

Post by PerryKen » Mon May 28, 2018 11:50 am

Hi ArctionKestutis, so basically the more threads the better essentially? Is there a point at which you get some diminishing returns though?

ArctionKestutis
Posts: 383
Joined: Mon Mar 14, 2016 9:22 am

Re: 20-30 Threads are created when create a chart?

Post by ArctionKestutis » Thu May 31, 2018 10:55 am

Hi,

This is not something for me or you to decide. The thread-pool is controlled by Framework and Windows environment. And there are smart algorithms to decide on number threads to perform certain task. On paper there is no benefit to run small task on individual thread: at some point time for creating thread will be just higher than process it was running. Ideally, if you can choose, you would like to run several long processes in parallel. Internally, LightningChart tries to split task for parallel loop with this idea in mind. However, how exactly it is run by thread-pool we can not say.

Hope this helps.