开发者

Ability to deal with 10000 concurrent requests - how to do it?

开发者 https://www.devze.com 2023-02-10 21:19 出处:网络
My server need to have the ability to handle 10000 request in the same time. I don\'t know how t开发者_运维技巧o define it on the WCF - and I don\'t find any example or article that can help me to u

My server need to have the ability to handle 10000 request in the same time.

I don't know how t开发者_运维技巧o define it on the WCF - and I don't find any example or article that can help me to understand how to do it.

Do I need to create different thread for each coming request?


You can do this by using the serviceThrottling tag in your app.config file :

<serviceThrottling maxConcurrentSessions="10000" maxConcurrentCalls="1000"/>

You don't need to create any thread, WCF will handle all this for you, using a thread pool.


That being said, if all of those 10000 requests come at the exact same time, and should all be handled concurrently (let's say for example that they are all incrementing an interlocked int and that none of those calls will return before it reaches 10000), the .net CLR might have trouble creating the 10000 needed threads ...

I think you should carefully review what your concurrency requirements really are. Increasing the maxConcurrentCalls to 10000 is not a silver bullet, it's not going to magically solve all the other performance bottlenecks and/or limitations you might have somewhere else in your software (and in your hardware!)

Being able to handle x concurrent requests is not going to help if all of those threads are all using a single database connection, for example !

0

精彩评论

暂无评论...
验证码 换一张
取 消