First, thanks for reading, it was a very interesting blog post.
You might want to explore this library , which was inspired by Facebook BigPipe. Note. I do not approve of this, as I have never used it, but its creation is not trivial.
As for how synchronous and asynchronous is better, it depends. Synchronization is simpler - the dependencies are obvious and there is no overhead. Asynchronous is only an advantage if your resources are not fully utilized and your processing can be easily broken into independent blocks. I canβt say what you are trying to do, so you need to decide for yourself where the performance bottleneck is, and whether archiving your application so that several partitions can be loaded, processed and displayed in parallel will actually provide an advantage.
As an example, if you load one massive array of data that will be displayed as a table in the browser, then splitting this data into several parallel downloads will increase productivity - at the cost of creating some queuing system, dealing with out-of-order answers. On the other hand, although technically slower, batch loading into synchronous blocks, so that one block is loaded and displayed before the next request, will still do wonders for perceived performance and is a much simpler alternative.
David tang
source share