How Meta Made Debugging Async Code Easier with Coroutines and Senders
… … Stack Traces for Async Code are Unhelpful Threadpool threads: #0 process_file(...) #5 pool.run() #10 __clone … … IO Thread: #0 async_read_some_at(...) #3 ctx Threadpool threads: #0 process_file(...) #5 pool.run() #10 … IO Thread: … #0 async_read_some_at(...) #3 ctx.run() #5 __clone … … Main thread: #0 unifex::sync_wait( … #0 async_read_some_at(...) … #12 unifex::sync_wait(...) #16 main() #19 __libc_start_main() … … Async Stacks are BetterStructured Concurrency Makes Async Stacks Possible0 码力 | 131 页 | 907.41 KB | 5 月前3Await-Tree Async Rust 可观测性的灵丹妙药 - 赵梓淇
开发者大会 Await-Tree Async Rust 可观测性的灵丹妙药 赵梓淇 Bugen Zhao Await-Tree Async Rust 可观测性的灵丹妙药 Await-Tree 的 设计原理与实现 2 回顾 Async Rust 的设计与痛点 1 Await-Tree 的 应用与真实案例 3 Await-Tree Async Rust 可观测性的灵丹妙药 Await-Tree Await-Tree 的 设计原理与实现 2 回顾 Async Rust 的设计与痛点 1 Await-Tree 的 应用与真实案例 3 Async Rust 的优势 • 异步编程的共同优势 • async/await 关键字 • 用户态调度 • Async Rust 的独特优势 • Ownership 与 Lifetime • 无栈协程 Async Rust 回顾 Rust 的无栈协程抽象 的无栈协程抽象 — Future Async Rust 回顾 • 通过 poll 驱动的状态机 • 组合嵌套为调度单元: Task • async fn 语法糖 Async Rust 观测与调试的痛点 Async Rust 回顾 • 特性: Future 灵活的可组合性 • 任意定制 Poll 的执行逻辑 (Join / Select / Timeout) • 动态的调用关系 • 痛点:观测与调试工具无法理解灵活的执行逻辑0 码力 | 37 页 | 8.60 MB | 1 年前3WebAssembly 简介 - 陈思衡
之类的 async runtime 中执行一些特别的 WASM 时就会遇到 WASM 阻塞 tokio 最终导致服务不可用的情况。 阻塞示例 WASM 使用场景和问题 利用语言本身 Async 机制 因为 Rust 的 async 机制是无栈协程,会将 async 部分在编译时隐式转换成一个 Future。 所以我们可以利用这一点来实现一个 Async 的 Wasm。 Async Wasm Photo / image / chart 利用本身 Async 机制 自行实现 Async Runtime Async 的 Wasm • 在 wasm 中把 future 存入固定内存处。 • 导出 poll 函数给 host 调用。 • 把 host function 包装成自定义 Future。 • 实现简单 利用本身 Async 机制 优点 • 方案不通用(wasm 局限于某一种语言) 无法与现有生态配合 缺点 Async 的 Wasm 基于 fiber / ucontext Async Wasm 解决方案 wasmtime-fiber 是一个通过内联汇编,保存当前寄存 器和栈数据来实现有栈协程的 rust 库。 wasmtime-fiber Ucontext 和 fiber 功能相同,但是 linux 的系统库。 ucontext 执行流程 Async Wasm 解决方案0 码力 | 24 页 | 773.46 KB | 1 年前3Sender Patterns to Wrangle Concurrency in Embedded Devices
2. Tell Ben the count one digit at a time. 3. When done, yell "End of Line" Exercise 7async/concurrency 8async/concurrency GPIO Timer 1 Timer 2 I2C DMA Half-Duplex Serial core 9Sender World senders. auto sndr = async::just(42, 17); 1 18just just_result_of just_error just_error_result_of just_stopped Sender Factories Functions that return senders. auto sndr = async::just_result_of( s1.schedule() | async::then([] { return 42; }) | async::continue_on(s2) | async::then([] (int i) { return std::to_string(i); }) ; 1 2 3 4 5 6 7 8 auto r = comp | async::sync_wait(); 9 auto0 码力 | 106 页 | 26.36 MB | 5 月前3Deciphering C++ Coroutines
Task18/55 Threads - A straightforward solution std::futurespawn_task () { return std:: async( outer_function ); }18/55 Threads - A straightforward solution main() spawn task()18/55 Threads auto data = co_await async_io (...); co_return IoResult :: from_io_data(data ); }24/55 Suspending nested coroutines Async inner_function () { auto data = co_await async_io (...); co_return Suspending nested coroutines Async inner_function () { auto data = co_await async_io (...); co_return IoResult :: from_io_data(data ); }25/55 Moving up the stack Async inner_function 0 码力 | 156 页 | 1.79 MB | 5 月前3Django Q Documentation Release 0.7.13
test without the cluster by setting the sync option to True in the configuration. This will run all async calls inline through a single cluster worker without the need for forking. Other known issues are: • Failures are always saved. 1.2.8 sync When set to True this configuration option forces all async() calls to be run with sync=True. Effectively making everything synchronous. Useful for testing. Defaults configuration. 1.4 Tasks 1.4.1 async() Use async() from your code to quickly offload tasks to the Cluster: from django_q.tasks import async, result # create the task async('math.copysign', 2, -2) # or0 码力 | 56 页 | 416.37 KB | 1 年前3Django Q Documentation Release 0.7.11
test without the cluster by setting the sync option to True in the configuration. This will run all async calls inline through a single cluster worker without the need for forking. Other known issues are: • Failures are always saved. 1.2.8 sync When set to True this configuration option forces all async() calls to be run with sync=True. Effectively making everything synchronous. Useful for testing. Defaults Release 0.7.11 1.4 Tasks 1.4.1 async() Use async() from your code to quickly offload tasks to the Cluster: from django_q.tasks import async, result # create the task async('math.copysign', 2, -2) # or0 码力 | 54 页 | 412.45 KB | 1 年前3Django Q Documentation Release 0.7.12
test without the cluster by setting the sync option to True in the configuration. This will run all async calls inline through a single cluster worker without the need for forking. Other known issues are: • Failures are always saved. 1.2.8 sync When set to True this configuration option forces all async() calls to be run with sync=True. Effectively making everything synchronous. Useful for testing. Defaults configuration. 1.4 Tasks 1.4.1 async() Use async() from your code to quickly offload tasks to the Cluster: from django_q.tasks import async, result # create the task async('math.copysign', 2, -2) # or0 码力 | 56 页 | 415.46 KB | 1 年前3Django Q Documentation Release 0.8.0
cpu_affinity Brokers Redis Disque IronMQ Amazon SQS MongoDB Django ORM Custom Broker Reference Tasks async() Async Cached operations Synchronous testing Connection pooling Reference Groups Reference Iterable configure it and install the appropriate client library. Run Django Q cluster in order to handle tasks async: $ python manage.py qcluster Requirements Django Q is tested for Python 2.7 and 3.6 Django [https://www test without the cluster by setting the sync option to True in the configuration. This will run all async calls inline through a single cluster worker without the need for forking. Other known issues are:0 码力 | 73 页 | 506.27 KB | 1 年前3Django Q Documentation Release 0.7.11
scheduler cpu_affinity Brokers Redis Disque IronMQ Amazon SQS MongoDB Django ORM Reference Tasks async() Async Cached operations Synchronous testing Connection pooling Reference Groups Reference Iterable test without the cluster by setting the sync option to True in the configuration. This will run all async calls inline through a single cluster worker without the need for forking. Other known issues are: Defaults to 250 Failures are always saved. sync When set to True this configuration option forces all async() calls to be run with sync=True. Effectively making everything synchronous. Useful for testing. Defaults0 码力 | 72 页 | 526.88 KB | 1 年前3
共 1000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 100