Jason Rodman
Posts: 40
Joined: 2016-11-01
|
I am porting a COM excel addin to XLL and one of the features I am taking advantage of is multi-threaded recalculation. Normally these UDF's are pretty taxing on our database and I want to put in some protection so that multi-threaded recalculation does not bring my server to its knees. We have thousands of spreadsheets that have thousands of individual calls to these functions in each of them, with hundreds of concurrent users. Now the performance gain is great, a spreadsheet that took 30 minutes to recalc before now takes 90 seconds, but I witnessed it peg the SQL server processor when recalculating 1200 cells in parallel which brings all other operations to a halt. Do you know of any way to put limits on how many parallel threads can run when recalculating in excel? |
|
OliverM
Guest
|
Hi Jason,
WithExcelApp.MultiThreadedCalculation.ThreadCount = xx you can set the number of threads used for recalculation. |
|
Jason Rodman
Posts: 40
Joined: 2016-11-01
|
That works! Its a lot easier than employing a SemaphoreSlim. The only downside is it affects all recalculation, not just specific UDF's. If anyone needs more granular control I have found SemaphoreSlim to be effective in limiting processing when used in a UDF. It doesn't actually prevent extra threads from being created, but it holds up threads that are over the limit until others complete. This way I can allow less resource intensive UDFs to run on more threads than more resource intensive ones. |
|
Andrei Smolin
Add-in Express team
Posts: 18830
Joined: 2006-05-11
|
Thank you very much! Both Jason and Oliver! That's two great pieces of info to know! thank you very much for sharing your knowledge!
Andrei Smolin
Add-in Express Team Leader |
|