What is the best choice for working with thousands of simultaneous connections?
...
Curiosity about the beginning [...]. If I have an MMORPG server, where is one connection interacting with each other to update the position, animation, effects (the main MMORPG mechanism), in numbers that are "heavily loaded servers"? 200 ~ 300 simultaneous connections?
On the server side, you can also make good use of any asynchronous socket API, starting with Begin / End-style APM , based on EAP or TAP based Task events. This is because you will block fewer threads, as opposed to using synchronous APIs. Thus, more threads will be available to simultaneously serve other incoming requests to your server, which will increase its scalability.
Most likely, you will not see any performance benefits from using the TAP socket APIs compared to analogs of APM or EAP. However, the TAP API template is much easier to develop than APM or EAP. When used with async/await it creates shorter, more readable, and less error prone code. You get a natural stream of pseudo-linear code that is not possible with APM callbacks or EAP event handlers. If you cannot find a suitable Task socket API, you can always do it yourself from the Begin/End APM API using Task.FromAsync (or from the EAP API, check the " Task.FromAsync Template for Converting an Event to a Task" ).
When it comes to the client user interface application , scalability is not so important, but there is another advantage of the TAP template. With a little effort, this helps make your user interface responsive because you wonโt block the user interface thread (which usually happens while waiting for the result of a synchronous call). This does not apply to the Socket Task API, it applies to any Task based API, such as Task.Delay() or Stream.ReadAsync() .
For some good reading material on asynchronous C # programming, check out the async/await wiki tag:
fooobar.com/questions/tagged / ...
source share