Thursday, October 03, 2013

HttpSelfHostServer and maximum concurrent connections

To set up maximum concurrent connections for HttpSelfHostServer you need to tweak following properties:

  • In HttpSelfHostConfiguration set MaxConcurrentRequests (this is not enough, continue reading)
  • System.Net.ServicePointManager.DefaultConnectionLimit
  • ThreadPool.SetMinThreads

4 comments:

Viktor Jevdokimov said...

Any proof or why it's not enough?

Mijalko said...

Well,
If you don't change, for example, DefaultConnectionLimit you will be able to have max 2 connections in the same time (default is 2).

Viktor Jevdokimov said...

That is for http client, not the service.
Changing it on the client service accepts all connections, it is not limited to 2.

Mijalko said...

Hmmm... It seems that you are right. Well, it was some time ago when I worked on that. I had a problem when I changed only MaxConcurrentRequests. I don't have time now to check why I need to change other 2 properties... But if you are doing something like this right now and you are doing some testing, please post here your findings. I'll be glad to update this post on HttpSelfHostServer and maximum concurrent connections