Answer the question
In order to leave comments, you need to log in
Does it make sense to use asynchronous calls in Don net core console programs if the processing algorithm is sequential?
Wrote a program to import data into the database from an external REST service.
The program is written as a console application on dot net core in C#.
It is scheduled to run every 30 minutes from Windows Sheduler.
The main loop looks like:
Данные = СчитатьДанныеИзREST();
while (Данные != NULL) {
СохранитьДанныеВБд(Данные);
Данные = СчитатьДанныеИзREST();
}
Answer the question
In order to leave comments, you need to log in
Asynchrony in C# is cooperative multitasking. If multitasking within a process is not needed, then asynchrony is also not needed. On the contrary, it will work a little slower and eat a little more memory. When a synchronous task is waiting for data, it does not consume CPU time. The thread goes to the OS kernel and the thread manager switches to another thread or puts the processor core in standby mode.
Thanks for the prompt detailed answer.
When a synchronous task is waiting for data, it does not consume CPU time. The thread goes to the OS kernel and the thread manager switches to another thread or puts the processor core in standby mode.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question