![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi everyone, I've asked for your help before and you've been very welcoming and helpful, however now I have a few further issues. I'm developing a highly concurrent middleware server app (C#) that takes socket connections from a frontend webpage and performs processing and SQL queries on a back end SQL server. I'm getting massive improvements on my predecessor's efforts - I can sustain 1000 msgs/sec in some cases as opposed to a few tens before. However, I'm hitting a point now where latency is creeping up (over a minute under heavy load - which is unacceptable) and I think its down to differing lengths of time it takes the incoming messages to execute (some are very quick, a few are several seconds - credit card auth). I'm using async sockets to read in and transmit responses, and the built in threadpool and where possible the new async database operations (in .NET 2.0 beta 2) to handle actual message processing, so IO completion ports all over the place. Ive been using a seperate threadpool class to place longer running (over 1 sec) processing - but i'm unsure even after some testing as to exactly what balance I should give and how many threads to allocate. I'm assuming all 25 of the built in ThreadPool are a gimme, but how many is reasonable to allocate seperately? I'm beginning to think shifting all my processing to the seperate threadpool would be beneficial too. Any suggestions? I'm at a bit of a loss now, this is where my expertise on the matter ends? I'd be eternally grateful if anyone could point me in a useful direction! Cheers, Kieran |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
Yes, I think I suggested that in my original post - and why I'm moving to a seperate threadpool for the processing. Do you have any suggestions for the number of threads I should allow in total though? Don't want to get to the stage where I'm using all the CPU context switching! |
#5
| |||
| |||
|
#6
| |||
| |||
|
|
Hi everyone, I've asked for your help before and you've been very welcoming and helpful, however now I have a few further issues. I'm developing a highly concurrent middleware server app (C#) that takes socket connections from a frontend webpage and performs processing and SQL queries on a back end SQL server. I'm getting massive improvements on my predecessor's efforts - I can sustain 1000 msgs/sec in some cases as opposed to a few tens before. However, I'm hitting a point now where latency is creeping up (over a minute under heavy load - which is unacceptable) and I think its down to differing lengths of time it takes the incoming messages to execute (some are very quick, a few are several seconds - credit card auth). I'm using async sockets to read in and transmit responses, and the built in threadpool and where possible the new async database operations (in .NET 2.0 beta 2) to handle actual message processing, so IO completion ports all over the place. Ive been using a seperate threadpool class to place longer running (over 1 sec) processing - but i'm unsure even after some testing as to exactly what balance I should give and how many threads to allocate. I'm assuming all 25 of the built in ThreadPool are a gimme, but how many is reasonable to allocate seperately? I'm beginning to think shifting all my processing to the seperate threadpool would be beneficial too. Any suggestions? I'm at a bit of a loss now, this is where my expertise on the matter ends? I'd be eternally grateful if anyone could point me in a useful direction! Cheers, Kieran |
#7
| |||
| |||
|
#8
| |||
| |||
|
|
Thanks Henning, Yes, I'm sure that all of the threads are being used in the threadpool, and yes CPU is at or around 100%. I was under the impression though that this might be down to too many context switches? When I view CPU usage in Sysinternals Process Explorer I see a significant (15-20%) amount of time is spent in kernal mode. Your pointer on the Processor Queue Length is very useful, I will check this out immediately. Cheers, Kieran |
#9
| |||
| |||
|
|
By "another threadpool" I mean a class that has been written to perform the functionality of the buil-in runtime ThreadPool but allow itself to be instanciated so that different jobs can go to different TPs depending on their characteristics. NOT another process (I don't even understand what you mean by this). Performance testing is allowing me to finetune the number of threads allocated to each pool, however I am unable to replicate the entire expected load until final in-situ testing takes place. Is there a guideline maximum number of active threads a process should use for maximum scalability? |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |