《戴翔-使用硬件加速Tokio.pptx》由会员分享,可在线阅读,更多相关《戴翔-使用硬件加速Tokio.pptx(17页珍藏版)》请在三个皮匠报告上搜索。
1、第三届中国第三届中国Rust开发者大会开发者大会使用硬件加速使用硬件加速Tokio演讲人:Loong.Dai,Cathy.LuLoong DaiIntel云原生工程师微软MVPDapr、Thanos、Golangci-lint的Maintainer现在主要专注于服务网格领域,探索云原生软硬件结合新范式Github ID:daixiang0自我介绍Cathy LuIntel软件工程师专注于NFV,电信网络云化等方案Why need Tokio?Rust does not provide async runtime in std libTokio is good enoughTokioTokios
2、 APIs are memory-safe,thread-safe,and misuse-resistant.This helps prevent common bugs,such as unbounded queues,buffer overflows,and task starvation.ReliableBuilding on top of Rust,Tokio provides a multi-threaded,work-stealing scheduler.Applications can process hundreds of thousands of requests per s
3、econd with minimal overhead.Fastasync/await reduces the complexity of writing asynchronous applications.Paired with Tokios utilities and vibrant ecosystem,writing applications is a breeze.EasyThe needs of a server application differ from that of an embedded device.Although Tokio comes with defaults
4、that work well out of the box,it also provides the knobs needed to fine tune to different cases.FlexibleTokioCore Queue-Based Modules in Tokio Channel SchedulerTokio uses Channel for communication between threads(incl.pthread,co-routines).Channel allows a unidirectional flow of information between t
5、wo end-points:the Sender and the Receiver.Channel Type:SPSC,SPMC,MPMC,MPSC.SendersReceiveSendersSendersReceiveReceiversPerf Gaps:CAS(Compare And Swap)cant perfectly scale with core count.Tokio ChannelKeyTokio SchedulerPerf Gap:Synchronization is required for stealingSoftware Queue IssuesProducerEnqu
6、eue SoftwareDequeue SoftwareHead and Tail pointersDequeue SoftwareDequeue SoftwareEnqueue SoftwareProducerConsumerConsumerConsumerSynchronization latencyMemory/Cache latencyCPU cycles latencyDLB:Dynamic Load BalanceDLBDLBEnqueue LogicHead and Tail pointersDequeue Logic&Load BalancerProducerProducerC