Then my periodic job and PutRecordBatchAsync are processed at the same time?
Using the Task API, you can guarantee that they will be executed simultaneously (using a thread pool), but you need to understand the difference between concurrency-based IOS-based memory operations.
While it is useful to use Tasks in concurrency memory, an IO call once made does not need a thread at all, since it relies on concurrency hardware if it ever uses a thread, all that it will wait for an IO call to return thereby wasting precious system resources and reducing the scalability of the system.
In the case of concurrency-based IOs, what do you call a remote / network interface API, how does async-wait work here?
Well, a true Async operation will free the thread context, in windows it will use the I / O completion port (queue mechanism) to make an Async call, while the calling thread is used to send other similar calls, it just needs the thread context when returning the I / O call for servicing the response and for this, if it is not a UI call, use ConfigureAwait(false) so that any context stream can be used to deliver the response.
What if you do not use await with async?
A call intended for asynchrony becomes synchronous and immediately affects the scalability of the system, since the threads are now blocked, which is even worse for lengthy I / O operations. You have seen how JavaScript frameworks always make an AJAX (Async) call to the server API, so much more work is possible without blocking browser threads.
In general, to process In-memory, you should create a certain number of Tasks and process them using Task.WaitAll or Parallel.ForEach for the collection, for Async processing, ideally, the recommendation should not have Task.Run anywhere, it should be preferred Async from the entry point, as is possible in the case of MVC, the controllers can be asynchronous. Multiple calls are grouped together using Task.WhenAll representative tasks and then expected. even if you use Task.Run as in your code, then use async lambda to make an asynchronous call
Summary:
It is imperative to use await for asynchronous calls, otherwise they Async keyword is useless in this context, and yes await will wait for the IO call to return before continuing, although no thread is blocked in the process