Await-Tree Async Rust 可观测性的灵丹妙药 - 赵梓淇
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 的 设计原理与实现 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 年前3Working with Asynchrony Generically: A Tour of C++ Executors
Goals for the Executors proposal 2. Some simple examples, intro to senders 3. The lifecycle of an async operation 4. Under the hood of a concurrent operation 5. Implementing a simple algorithm 6. Senders THE EXECUTORS PROPOSAL The vision: “An asynchronous analog of the STL” • A full suite of standard async algorithms based on real-world requirements: E.g., then, when_all, sync_wait, repeat, stop_when, compute resource (aka, scheduler) • A unit of lazy async work (aka, sender) • A completion handler (aka, receiver) • A small, initial set of generic async algorithms: • E.g., then, when_all, sync_wait,0 码力 | 121 页 | 7.73 MB | 5 月前3CeresDB Rust 生产实践 任春韶
Future Cancellation Rust 生产实践 生产实践 – Tokio 为什么使用 Tokio ? 1. 业界使用最广泛,测试齐全。 2. Tokio 支持 async/await ,提供了高效的异步锁、异步队列等。 3. Tokio 社区支持好。 生产实践 – Tokio Rust future preemption https://docs.rs/ happen at .await points, so code that spends a long time without reaching an .await will prevent other tasks from running. 生产实践 – Future 循环 Run Return https://rust-lang.github.io/async-book/04_pinning/01_chapter /generators.html 生产实践 – Async lock Req0 Req1 Req2 Memory cache https://docs.rs/tokio/1.28.2/tokio/sync/ struct.Mutex.html#which-kind-of-mutex-should-you-use 生产实践 – Async lock runtime.spawn(task0)0 码力 | 22 页 | 6.95 MB | 1 年前3Rust 异步并发框架在移动端的应用 - 陈明煜
嵌入式软件能力中心 Applications of Rust Runtime in Mobile Overview of asynchronous Rust #1 Rust 异步简介 Ylong async runtime #3 Ylong Runtime 并发框架 目录 Table of Contents #2 社区并发框架介绍以及与移动端的不适配性 Introduction to third 10 微秒 -> 100 纳秒 Rust 语言并没有提供异步并发框架, 只提供异步所需的基本特性: Future async / await Waker asyn c Future Waker poll Syntax sugar wake await Rust 异步机制 Asynchronous Rust Rust 异步机制 Asynchronous Rust Waker 目前 Rust 社区最广泛使用的事件 驱动型调度框架,擅长处理大量异 步 IO 的场景。具有非常强大的生 态。 tokio 第一个适配 Rust async/await 原语 的运行时库,与 tokio 类似支持异步 IO ,目前已经半废弃 async-std 更轻量化的调度框架,功能被拆分 到其他多个库中, IO 密集场景性 能不如 Tokio smol Rayon 并非异步运行时。它通过同步0 码力 | 25 页 | 1.64 MB | 1 年前3Introduction to Mobile UI Test Automation
Installation npm install nativescript-dev-appium --save-dev npm install -g appium -wd -tslib(async/await) -mocha -typings -reporting If you don’t configure it, it won’t work. ;) Appium config file: waitForExist() waitForNotExist() getAttribute() source() size() location() exists() text() Typings Async/Await Image Comparison driver.compareScreen("page.png"); Open source cloud builds - Sauce Labs n0 码力 | 41 页 | 4.75 MB | 1 年前3基于 Rust Arrow Flight 的物联网和时序数据传输及转换工具 霍琳贺
• 安全性 • 高性能 • 跨平台兼容 • 强大的类型系统和抽象表达能力 • 优秀的 Rust 生态和开发工具链 • C FFI 互操作能力 • async/await 异步编程 Rust - Crates Used in taosX • Async runtime: https://crates.io/crates/tokio • Job Scheduler: https://crates Parquet: https://crates.io/crates/parquet • CSV: https://crates.io/creates/csv-async • Compression: https://crates.io/crates/zstd • Async Hashmap:https://crates.io/crates/dashmap Arrow • Schema with metadata0 码力 | 29 页 | 2.26 MB | 1 年前3使用硬件加速Tokio - 戴翔
for writing async code. Rust has very strict backward compatibility requirements, , and they haven't chosen to lock- in a specific runtime. Why need Tokio? Rust does not provide async runtime in std Applications can process hundreds of thousands of requests per second with minimal overhead. Fast async/await reduces the complexity of writing asynchronous applications. Paired with Tokio's utilities and0 码力 | 17 页 | 1.66 MB | 1 年前3C++20: An (Almost) Complete Overview
Library Additions5 Agenda New keywords: concept requires constinit consteval co_await co_return co_yield char8_t New identifiers: import moduleModules7 Modules Advantages 12:00coroutines15 Coroutines What’s a coroutine? A function, with one of the following: co_await: suspends coroutine while waiting for another computation to finish co_yield: returns a value0 码力 | 85 页 | 512.18 KB | 5 月前3C++高性能并行编程与优化 - 课件 - 05 C++11 开始的多线程编程
解算还能在后台继续正常 运行。虽然 zeno 也用了 opengl ,但他用多进程成功在 opengl 的百般拖后腿下实现了 并发。 第 2 章:异步 异步好帮手: std::async • std::async 接受一个带返回值的 lambda ,自身返回一个 std::future 对象 。 • lambda 的函数体将在另一个线程里执行 。 • 接下来你可以在 main 里面做一些别的事 future_status::ready 。 • 同理还有 wait_until() 其参数是一个时间点。 另一种用法: std::launch::deferred 做参数 • std::async 的第一个参数可以设为 std::launch::deferred ,这时不会创建一个 线程来执行,他只会把 lambda 函数体内 的运算推迟到 future 的 get() 被调用时。 的执行仍在主线程 中,他只是函数式编程范式意义上的异步 ,而不涉及到真正的多线程。可以用这个 实现惰性求值( lazy evaluation )之类。 std::async 的底层实现: std::promise • 如果不想让 std::async 帮你自动创建线程 ,想要手动创建线程,可以直接用 std::promise 。 • 然后在线程返回的时候,用 set_value() 设置返回值。在主线程里,用0 码力 | 79 页 | 14.11 MB | 1 年前3
共 9 条
- 1