In our project, we enabled multiprocesscook with cookprocesscount=8 to cook 260,000+ packages. After the cook, we found that it cost lots of time for the procedure of WaitForAsync. So, we want to know if there is any tips of reducing time cost of WaitForAsync?
[Image Removed]
WaitForAsync means that the scheduler thread of the cooker has nothing to do.
In a singleprocess cook, this means that it is waiting for asynchronous work (e.g. texture compression, or in general, asynchronous UObject::IsCachedCookedPlatformData) to complete.
In a multiprocess cook, the same category is used when the director process is waiting for worker processes to finish cooking the packages that were assigned to them, and the director process itself has no packages remaining to cook.
Given that you encountered this when using MPCook, it is almost certainly the multiprocess version of WaitForAsync that you are hitting. In that case, you will see log messages indicating that the director’s local worker has 0 packages assigned while the other CookWorkers still have non-zero packages.
Usually in MPCook, we avoid the case of the director (or any worker) being idle by retracting packages from the busy worker and having the director or idle workers work on those retracted packages. But in 5.4 and earlier, retraction was not supported for the generated packages of a world partition level. We added the ability to retract them in 5.5; that created some cook crashes that we have fixed in 5.6.
Retraction will be attempted when idle is detected and will result in log messages in the CookCommandlet similar to these , but it then will report 0 packages retracted if the only packages remaining on the CookWorker are the generated packages.
LogCook: Display: Idle CookWorkers: { CookWorker 0 }. Retracting 174195 packages from CookWorker Local to distribute to the idle CookWorkers. LogCook: Display: CookWorker Local: 348390 packages remain. LogCook: Display: CookWorker 0: 0 packages remain. LogCook: Display: CookWorker 1: 266296 packages remain. LogCook: Display: 174195 packages retracted from CookWorker Local and distributed to idle workers { CookWorker 0 }. LogCook: Display: CookWorker Local: 174195 packages remain. LogCook: Display: CookWorker 0: 174195 packages remain. LogCook: Display: CookWorker 1: 266296 packages remain.
I don’t recommend trying to take preports of improvements to multiprocess cooking from 5.4 and 5.5 into 5.3; it will be difficult to get those working robustly. It would be better to integrate all of UE 5.5 into your project.