M
M
mrAvenger2017-11-13 15:35:17
Boost
mrAvenger, 2017-11-13 15:35:17

Async or multithread is the question, what to choose?

Good afternoon, we are developing a server platform for a toy, at the moment we have 3300+ active connections and we get a strong performance drop.
There is a desire to move to another machine, at the moment we benefit from hertz, and not from the number of processors, but so far this is not very fun, since we are stuck in i7 with a frequency of 4700, and find something higher on the open market dedicated servers are simply not realistic. There is a desire to completely cut the update system, and for now the question remains which method to choose, asynchrony or manual flow control.
What the server does in general:
* AI creatures in the world
* Handling collisions, finding and processing paths for game creatures
* Processing, respectively, movements, interactions between players, processing their characters and much more
* Working with the database, saving, loading
That is, there is both strong IO and calculations.
At the moment we have a test server with 48 threads with a frequency of 2000, on which we failed tests with manual threading, most of the servers that can be found on the market focus on the number of cores, and not on the performance of each of them.
Actually, according to my theory. knowledge asynchrony requires additional. resources for storage of intermediate information and for its recovery.
What to do in our case?
PS: There are no problems, in particular, with the amount of RAM used, that is, there is a lot of it and we do not feel sorry for the resources.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2017-11-13
@mrAvenger

Asynchronous programs just consume less memory and have a smaller overhead on context switches. But an asynchronous program, in principle, cannot use more than one core. For concurrency, only threads. Well, either a hybrid option is to run on a thread per core, each of which will spin its own asynchronous event loop, as in Go. But in this case, the logic of synchronization of coroutines will not be easy.

A
Alexander Taratin, 2017-11-13
@Taraflex

Asynchrony is good in style tasks - a little count, a long wait (no matter what), a little more count, a long wait again, etc. Since it allows you to evenly spread the time of active use of the processor for different tasks.
From your description, you can only async


* Working with the database, saving, loading
the rest, as I understand it, are number crushers.
In any case, the description is too general. Definitely do not answer.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question