Rust 异步并发框架在移动端的应用 - 陈明煜
Rust 异步机制 Asynchronous Rust Rust 异步机制 Asynchronous Rust Waker Task Future task Queue wake Worker Future.poll() Reactor fd fd listen listen find 现有并发框架 Third Party Runtime 目前 Rust 社区最广泛使用的事件 现有框架无法完美适配移动端(一) Core Thread Thread Worker Worker task task Local queue Local queue Tokio 采用了如右图这种 GMP 模式: • 一核可以绑定多线程,每个线程拥有一个 Worker ,每个 Worker 拥有一个任务队列 • 但线程拥有相同优先级 • Worker 只持有一个本地 FIFO 队列 移动端诉求:优先级 • spawn_blocking 调度模式 spawn 调度模式 Thread Worker task Local queue Thread Thread task Global queue task New task Global queue New task take & run take & run Worker take & run Steal & run 两种接口拥有两套割裂的调度模式和线程池0 码力 | 25 页 | 1.64 MB | 1 年前3Performance Lets dive into Performance issues
Easy access to anything dealing with GUI • Bad: Jank when doing lengthy work • Potential Solutions: Worker thread Nested Layouts • Primarily a Android issue; but does impact iOS. • GridLayout is the King doSomething(fun); } } Data Processing • Anything that does any amount of work; if possible move to your worker thread. • Gathering and saving data from/to your database is a prime example. Enabling Optimization0 码力 | 15 页 | 1.71 MB | 1 年前3KubeCon2020/大型Kubernetes集群的资源编排优化
businesses in the cluster, and personalization configuration is not supported. Worker HPA1 HPA2 … HPAn HPA1 HPAPlus-controller Worker HPA1 HPA2 … HPAn HPA1 1. HPA can be turned on/off separately 2. Support0 码力 | 27 页 | 3.91 MB | 1 年前3使用硬件加速Tokio - 戴翔
Perf Gaps: CAS(Compare And Swap) can't perfectly scale with core count. Tokio Channel • Each worker has own run queue • Steal when own run queue is empty From the high level, it is a MPMC queue0 码力 | 17 页 | 1.66 MB | 1 年前3Working with Asynchrony Generically: A Tour of C++ Executors
unifex::repeat_effect(); } Accept requests on low-latency threads. Process the requests on the worker threads.16 EXAMPLE: TRANSITIONING EXECUTION CONTEXT namespace ex = std::execution; ex::sender0 码力 | 121 页 | 7.73 MB | 5 月前3
共 5 条
- 1