Replies: 5 comments 3 replies
-
In the very beginning, we looked a lot the implementation from folly and we explained this in document. The reason why we don't use folly directly is that we feel folly it too heavy for us. Even for
No, possibly we won't. On the one hand, folly doesn't have the features when we started to implement async_simple. On the other hand, such features have costs. For example, asyncStack will cause the switch performance of coroutines slow down about 3 times. Meanwhile, our solution to the question lives in the compiler side, see https://github.com/alibaba/async_simple/blob/main/docs/docs.en/DebuggingLazy.md. It is much more cheap than asyncStack.
Yes. We support this. We can find the example in demos. Also we support to co_await a Future to make things simpler: https://github.com/alibaba/async_simple/blob/main/docs/docs.en/Future.md#get-value-from-lazy
This is a complex topic. We can't talk it precisely and concisely. Maybe you can take a look at https://github.com/alibaba/async_simple/blob/main/docs/docs.en/StacklessCoroutineAndFuture.md.
We can wrap the coroutine APIs into Futures. See the above doc.
It is not easy to give a precise and concise answer too. But we can estimate the cost of coroutine switch into 2 function calls, which takes generally no more than 10ns. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick answers!
What about optimizing a complex library, eliminating all blocking calls? Shouldn't we also migrate to asynchronous programming with future/promise, which is more complex than async/await model. Otherwise users without latest gcc toolchain can only use precompiled library. Also, is there a good way to quantitively analyze how eliminating blocking calls would improve the performance? Mentioned in readme it has been widely used in many production areas. How do you tell if asynchronous programming is worth efforts (e.g. toolchain upgrades, possible programming model migration)?
Very impressive, |
Beta Was this translation helpful? Give feedback.
-
This requires a refactoring. I don't think we have a magic solution for such problems.
I mean to refactor the library with coroutines. But in the headers, we can offer an option to only export the future wrapped APIs.
Complexity is a cost too, including code complexity and architecture complexity. This is the major reason why we don't use folly. |
Beta Was this translation helpful? Give feedback.
-
Speaking of executors, the docs said "The executor used in alibaba actually isn't open-sourced yet.". Is there any plans to kindly provide an executor? Folly executors do not use work-stealing, while bthread does. Would you share some ideas about how should we implement an executor for IO-CPU hybrid workload. |
Beta Was this translation helpful? Give feedback.
-
facebook/rocksdb#11017 mentioned a stackful coroutine PhotonLibOs. Stackful-coroutines are far less painful when rewriting code for asynchronous programming. On the other hand, It seems that folly stackless coroutines met some problem in rocksdb, through the main issues are related with file IO rather than network. Is there any major difference between bthread, PhontonLibOs & async_simple coroutines? |
Beta Was this translation helpful? Give feedback.
-
It seems that a lot of apis are quite the same with folly::coro. I'm a big fan of coroutines and asynchronous programming. What do you guys think of the relationship?
Would
async_simples
do more (e.g supports trace spans likes opentelemetry between suspend points, call stack traces likes folly::AsyncStack, latency stats). Some interesting topics (examples users may want to learn) are:Beta Was this translation helpful? Give feedback.
All reactions