| Dart Home | PowerTCP Sockets for .NET | Custom Development | Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums |
| Author | Forum: PowerTCP Sockets for .NET (Secure and Standard) Topic: Thread usage ? and limit (25 threads) |
| fonager From: Copenhagen, Denmark Posts: 25 Member Since: 11/18/03 |
posted November 20, 2003 7:33 PM I am currently evaluating the Sockets for .NET product, and until now I have been very satisfied. I have a test application, much like the "echo server" sample. A server app, which listen for incoming client applications, and when recieving data from a client, it broadcasts it to all other connected clients. I recieve data asynchroniously, and send data synchroniously. I run on Windows 2003 Server using Visual Studio 2003, 1 CPU (P3 550 mhz), 256 mb ram. Here is the problem : For every client that connects, a thread is allocated in my app, counting down from the 25 available worker threads, which is default. When I connect more that 25 clients, my application start to hurt, and sending data to a from a client, starts to buffer up (it gets delayed/slow). I have a few questions now : 1) Can it really be true, that every new client connection takes up 1 new thread ? 2) I have tried setting available worker threads to 100 instead of 25, and now everything runs smooth, until I have connected more that 100 clients. But where is the limit for adjusting the "available worker threads" size ? If I want 1000 client connections, I will need to set it to 1000 - but something tells me that this is not right. 3) Is there a way to accept and communicate with clients, without using 1 thread connected pr. client ? Really looking forward to your answer! - Regards, Tony Fonager, Denmark |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted November 20, 2003 10:38 PM 1) Yes, every client uses 1 thread. The major complaint with our last product was that it was single threaded, so we decided to answer everyones demands and make it multi-threaded. 2) If you think your server will use that many connections then yes, I guess you would have to adjust the limit. 3) I do not know of a way to that. |
| fonager From: Copenhagen, Denmark Posts: 25 Member Since: 11/18/03 |
posted November 21, 2003 2:04 AM Okay, but is there some "risk" involved with allocating 1000 worker threads for my application ? I mean, if 500 was allocated as default, and I raised it to 600, I would not worry so much, but in this case 25 is default and I would change it to 1000 - which is 40 times as much ... I worry because I have read several places stuff like "do not adjust this value (workerthreads), as it could make your app unstable" ... |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted November 21, 2003 9:27 AM I honestly don't know the answer to this. The component will do whatever the environment allows. We would not be the bottleneck based on our knowledge, but there are other system-based issues that may be encountered, including memory and CPU load. We have tested at 75 connections per second, with each connection receiving an individual thread, but the activity was limited on each thread. I am not sure where the first bottleneck would occur if you conduct more intense activity on each thread. |
| fonager From: Copenhagen, Denmark Posts: 25 Member Since: 11/18/03 |
posted November 21, 2003 9:36 AM OK, thanks for your answer (and godmorning over there ???) I have now designed the application, so it adjusts the amount of available worker threads itself, according to the workload. If available worker threads goes below 5, I add 5 more worker threads, and the same goes the other way around - if there are more then 25 available worker threads, I deallocate some of the available threads. I hope this method will go thru our test fine - we are testing right now, and until now everything seems fine, fine ... |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted November 21, 2003 9:52 AM That sounds like it will work. I was going to suggest that, but I didn't know that you could adjust that on the fly. I thought it was something that was set before the process started. |
| fonager From: Copenhagen, Denmark Posts: 25 Member Since: 11/18/03 |
posted November 21, 2003 10:35 AM I use a free .NET component developed by Devshock : www.devshock.com/products/tool/ThreadPoolManager It can inform you about current thread usage, and set the allocation pool size - on the fly. |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted November 21, 2003 10:48 AM Thanks. |
| cambler From: Redmond, WA USA Posts: 102 Member Since: 04/14/03 |
posted November 21, 2003 7:59 PM The limit of 25 is rather low, actually. I've written an application that uses Dart libraries to open a ludicrous amount of connections to a remote computer and slam the hell out of it (not a DOS attack program, mind you, but an actual application with a purpose). I increase the thread limit to 1000 with no problem, and actually use 400 to 500 of them at any given time. Living on the edge! :-) |
| fonager From: Copenhagen, Denmark Posts: 25 Member Since: 11/18/03 |
posted November 22, 2003 4:14 AM Thanks for the information - that makes me a little bit bore "relaxed", when changing the values of the worker threads. |
| Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|