浅谈一致性协议| 青训营笔记

350 阅读3分钟

这是我参与「第五届青训营 」伴学笔记创作活动的第 34 天

目前函数计算在公司内涵盖了在线服务和实时数据处理服务场景,函数计算平台日均处理万亿的请求,对比业内竞品也有一定的优势。本节课将为大家重点介绍函数计算的整体概念和在字节的落地案例与应用。

Serverless

image-20230221101921448

不操心扩缩容,Serverless,底层都Cover了。只用知道能够方便地使用计算资源就行了昂!!!

  • Serverless是FaaS吗?区别是?

Serverless = FaaS + BaaS

  • Backend As A Aervice(DB, KV微服务,统称为BaaS)
  • FaaS:Function As A Service

Where is FaaS

image-20230221102433496

FaaS不仅仅支持的简单的Handler,复杂的微服务也能跑的昂!!!

  • Function As A Service

Evolution

IaaS -> PaaS -> FaaS

image-20230221102555005

粒度不一样昂!!!

Faas Industry & Community

image-20230221102709220

Comparison of FaaS Providers in 2021

ximage-20230221102747319

Serverless computing history

image-20230221102806019

image-20230221102843084

Serverless Computing in Bytedance

Serverless能解决什么问题

  • Kafka/RocketMQ/Eventbus -> FaaS -> XXX
  • TLB -> FaaS (kitex, hertz)
  • Mesh -> FaaS -> Mesh
  • BFF/SSR -> FaaS (js, v8/wasm)
  • TOS->FaaS
  • Binlog -> FaaS

Bytefaas能在中间起到很多的功能处理昂!!!

  • The Problem
    • Building applications is hard
    • Ops is painful
    • Developers should focus on their business logic, with minimal ops burden
  • The solution
    • The next generation 1-Stop serverless computing platform
    • Easy development: you only write a function, instead of the whole service
    • Easy deployment: Fast build & release, in seconds
    • Integration with different event source, with 1 click
    • Rapidly autoscale up and down (even down to O)
    • Multi language support (Go, Python, Nodejs, Java, Rust, ...
    • Pay $ As You Go(按量付费,自动给你扩缩容)

Quick Demo

image-20230221103427247

Service governance

  • Service discovery: tlb, dns, mesh, consul
  • BOE, PPE, CloudIDE, ByteFaaS CLI
  • Logging, Metrics, Tracing
  • Byteflow, IAM, Event Center
  • SLA: BFC, Chaos, Netclass, Rhino

Bytefaas我记得我使用的时候,就是一个单独的微服务,可以自动调用去做很多事情昂!!!

字节内部Serverless的用户规模、调用情况

Current Status/Scale

image-20230221103806152

Where are ByteFaaS

image-20230221103846156

FaaS本质上是在TCE上跑的昂!!!

ByteFaaS Data Plane

image-20230221104218354

ByteFaaS Control Plane

image-20230221104247328

ByteFaaS Message Queue Triggers

image-20230221104326491

Consumer和Function Instance的解耦

  • Function Instance这边用户更新函数啊,上线啊,和Consumer解耦,Consumer没什么变动,用户代码上线会比较平稳昂!!!
  • Consumer用比较少的计算资源,拿到了比较大的吞吐,不需要特别大的耦合。

ByteFaaS Async Mode

image-20230221104615807

处求理用户的长需求昂!!!异步模式去承载长需求昂!!!

All in One -> 长任务也迁移到FaaS上面昂!!!

FaaS Native

image-20230221104733461

用户可以将RPC直接跑在FaaS上。

TTHeader协议的支持 -> RPC on FaaS,Mesh的治理是成熟的昂!

FaaS Worker & Edge

image-20230221104908770

image-20230221104922952

轻量级的Workload,不需要关系实例,甚至不用去设置实例,就OK了hhh。边缘场景计算资源更紧张,FaaS帮助你Scalable,让你少资源。

云边一体,很好用!!!

Future Planning

  • High availability , Scalability

  • Cost optimization

  • Autoscaling intelligence

  • Best Choice for event consuming business

image-20230221105233302

  • PaaS -> FaaS evolution (PaaS 平稳迁移到FaaS,让用户使用体验一致)
  • veFaaS

image-20230221105303496

veFaaS (FaaS toB)

  • FaaS worker, cloud & edge

image-20230221105344429

  • The Upcoming Sharing Sessions at ByteTech:
  1. ByteFaaS dataplane, high scalability/availability architecture, runtime standards
  2. ByteFaaS gateway, binary distribution system, async task, mesh ecosystem
  3. ByteFaaS message queue trigger, event source related topic
  4. veFaaS (FaaS tob at volcengine), FaaS Native
  5. FaaS worker, cloud and edge