views:

64

answers:

1

Hi , I want to develop a server which will listen on some specific ports to receive requests from device.While processing a request following steps are followed.

  1. Read data from socket stream(sent from device)
  2. Parse byte data in to business objects
  3. Use business objects process request using database through ado.net layer
  4. Send response in binary to device

All of above steps take fraction of a second to process.

Currently i am using thread pool for making server multithreaded.

My objective is to make a server which can handle maximum requests per second.

What should be my approach to develop maximum efficient server and then to test this server request handling capacity for verification.

Thanks

+3  A: 

I like what you're doing with the thread pool. My only suggestion is to cap the pool because it defaults at 50 threads in the pool, which is way many more that anything I've read suggested. The context switching with that many threads could become rediculous. Cap it at 3-5 times the number of cores you have in the server.

Testing it is fairly simple. If you just add the line to change the number of threads then add in a precision timer. Once you write another small application to fire a bunch of server requests, see how many threads is fastest. If you change more code than that get an SVN server on the machine and branch the code off with your various versions and test with the aforementioned testing application and timer.

Steve H.
I think i should leave no of thread configuration on Thread pool itself.As u have specified i have developed a test device simulator that sends requests.But i am not able to increase its capacity to send more than hundreds requests at a time.In scenario is possible to get lakhs of requests.Si i just want to know what are ways to improve performance of a server.I suppose one way is to use asynchronous methods of NetworkSocket.
Maddy.Shik