{"componentChunkName":"component---src-templates-blog-detail-tsx","path":"/blog/2020-07-17-serverlessdays-didi","result":{"data":{"currentBlog":{"id":"ecc61b91-6065-5cfc-94d1-15294badadb0","frontmatter":{"thumbnail":"https://img.serverlesscloud.cn/2020720/1595231990326-1594107290027-%E6%BB%B4%E6%BB%B4.jpg","authors":["张健/陈钦辉"],"categories":["news"],"date":"2020-07-17T00:00:00.000Z","title":"从零到一，Serverless 平台在滴滴内部落地","description":"本文整理自 ServerlessDay · China 大会，讲师为滴滴弹性云平台负责人张健、滴滴资深前端开发工程师陈钦辉。滴滴 Serverless FT 成员来自：滴滴基础平台部、车服技术部、金融事业部、普惠产品技术部。","authorslink":null,"translators":null,"translatorslink":null,"tags":["ServerlessDays","Meetup"],"keywords":"Serverless, ServerlessDays, Serverless实践","outdated":null},"wordCount":{"words":365,"sentences":79,"paragraphs":79},"fileAbsolutePath":"/opt/build/repo/content/blog/2020-07-17-serverlessdays-didi.md","fields":{"slug":"/blog/2020-07-17-serverlessdays-didi/","keywords":["faas","koa","nodejs","serverless","webpack","云函数","Serverless","serverlesscloud"]},"html":"<blockquote>\n<p>本文整理自 ServerlessDay · China 大会 - 《从零到一，Serverless 平台在滴滴内部落地》分享，讲师滴滴弹性云平台负责人张健、滴滴资深前端开发工程师陈钦辉。滴滴 Serverless FT成员来自：滴滴基础平台部、车服技术部、金融事业部、普惠产品技术部。</p>\n</blockquote>\n<h2 id=\"为什么（前端）要推动建设-serverless\"><a href=\"#%E4%B8%BA%E4%BB%80%E4%B9%88%EF%BC%88%E5%89%8D%E7%AB%AF%EF%BC%89%E8%A6%81%E6%8E%A8%E5%8A%A8%E5%BB%BA%E8%AE%BE-serverless\" aria-label=\"为什么（前端）要推动建设 serverless permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>为什么（前端）要推动建设 Serverless</h2>\n<ul>\n<li>更快地创建一个服务且免运维：大量的 Node.js 服务，创建服务，需要申请节点、申请机器，对接构建、部署、日志、监控，还要持续运维服。我们希望能更快创建一个服务并且免运维。</li>\n<li>更灵活的隔离能力：前端 BFF 接口聚合、微前端等业务场景，需要创建大量的接口服务，快速创建服务的同时，还希望可以以不同粒度灵活进行接口间的隔离。</li>\n<li>更低的成本：大量低峰期时间cpu/内存利用率很低，服务不再使用了，资源却仍然占用。</li>\n</ul>\n<p><img src=\"https://img.serverlesscloud.cn/202077/1594108194995-%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_15941081788086.png\"></p>\n<h2 id=\"我们的方案\"><a href=\"#%E6%88%91%E4%BB%AC%E7%9A%84%E6%96%B9%E6%A1%88\" aria-label=\"我们的方案 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>我们的方案</h2>\n<p>我们调研了业界的 Serverless 方案，最终决定了自己的方案： K8s + Knative + Istio 搭建应用级 Serverless。他的优势是：</p>\n<ul>\n<li>社区相对繁荣，未来充满希望。</li>\n<li>应用级 Serverless, 和传统通过 Docker 镜像开发，部署相近，现有服务迁移成本低。</li>\n<li>应用级 Serverless, 通过 Serverless。 路由，可以灵活控制隔离的粒度。</li>\n</ul>\n<p><img src=\"https://img.serverlesscloud.cn/202077/1594108195018-%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_15941081788086.png\"></p>\n<h2 id=\"通过-serverless-升级研发模式\"><a href=\"#%E9%80%9A%E8%BF%87-serverless-%E5%8D%87%E7%BA%A7%E7%A0%94%E5%8F%91%E6%A8%A1%E5%BC%8F\" aria-label=\"通过 serverless 升级研发模式 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>通过 Serverless 升级研发模式</h2>\n<p>那有了 Severless 基础能力，如何通过他来升级我们的研发模式呢？</p>\n<ul>\n<li>我们提供 npm 包打通公司的基础能力，包括数据存储相关、通信相关</li>\n<li>上层封装层 各种框架的中间件</li>\n<li>再上层是面向业务领域的框架，express/koa/以及我们基于egg打造的degg框架，他一定程度上方便了从零到一创建一个公司内部标准的服务。\n现在我们称之为面向 Serverless 的高级模式，业务同学可以更专注于业务编码，简单、高效完成这么一个日常开发迭代的流程</li>\n</ul>\n<p><img src=\"https://img.serverlesscloud.cn/202077/1594108194989-%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_15941081788086.png\"></p>\n<h2 id=\"serverless-全局图---研发视角\"><a href=\"#serverless-%E5%85%A8%E5%B1%80%E5%9B%BE---%E7%A0%94%E5%8F%91%E8%A7%86%E8%A7%92\" aria-label=\"serverless 全局图   研发视角 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Serverless 全局图 - 研发视角</h2>\n<p>从研发视角看下，整个 Serverless的全局，自上而下是：</p>\n<ul>\n<li>业务场景解决方案 ，基于 Serverless 平台，在Serverless-cli 插件规范下的场景解决方案</li>\n<li>Serverless -cli 和 Vscode 插件，作为面向开发者的统一入口</li>\n<li>面向业务的研发层，开发IDE, 包括本地的、云端的</li>\n<li>两层网关，业务层网关到 Istio 打造的Serverless网关</li>\n<li>Bass SDK，用来与后台基础能力通信</li>\n<li>运行在集群里的应用，包含三类</li>\n<li>右侧是Appication是传统服务</li>\n<li>左下是Runtime, Application, 他是将日常业务场景进行抽象，将不变的沉淀到Runtime里。</li>\n<li>业务工程里只有变的东西，云函数情况下就可以是上面这个Funciton</li>\n<li>Nodejs 框架</li>\n<li>底层集群， K8s /Knative 集群</li>\n</ul>\n<p>右侧： 是业务服务环境，下面是常规的日志、监控、报警、性能分析的能力</p>\n<p>左下侧：是Nodejs生态体系，包括业务框架、SDK、Nodejs性能分析平台</p>\n<p>左上侧：是面向Serverless 研发体系的共享市场</p>\n<p><strong>在虚线框里，就是面向一个业务场景，基于 Serverless 能力打造的一个通用解决方案。</strong></p>\n<p><img src=\"https://img.serverlesscloud.cn/202077/1594108194249-%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_15941081788086.png\"></p>\n<h2 id=\"serverless-流程图---研发视角\"><a href=\"#serverless-%E6%B5%81%E7%A8%8B%E5%9B%BE---%E7%A0%94%E5%8F%91%E8%A7%86%E8%A7%92\" aria-label=\"serverless 流程图   研发视角 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Serverless 流程图 - 研发视角</h2>\n<p>将上面 Serverless 全局图拆分，我们把它分成三部分，这三部分也是我们年初立项，多个团队合作做这件事的一个模块分工，分为底层、平台层，和面向业务的研发层。</p>\n<p>在开发者使用过程中，他们的流程是这样的：</p>\n<ul>\n<li>上层不同场景的工程，使用统一的cli, 也可以通过Vscode插件可视化来完成整个开发流程，Vscode也调用cli能力</li>\n<li>然后由cli调用平台的能力，再由平台进行权限验证，调用下层通用构建、部署能力</li>\n<li>最后调用Serverless底层接口，将服务部署到KNative+K8s集群上</li>\n</ul>\n<p><img src=\"https://img.serverlesscloud.cn/202077/1594108194762-%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_15941081788086.png\"></p>\n<h3 id=\"serverless-cli-的定位\"><a href=\"#serverless-cli-%E7%9A%84%E5%AE%9A%E4%BD%8D\" aria-label=\"serverless cli 的定位 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Serverless-cli 的定位</h3>\n<p>我们再来看下 Serverless-cli,  它的定位是，基于插件式命令行扩展框架。他包含如下3个核心能力：</p>\n<ul>\n<li>与Serverless平台联动，完成服务构建、部署等操作</li>\n<li>提供规范，灵活的命令扩展能力</li>\n<li>打造开发者生态，场景方案共享，并保持开发体验的一致性</li>\n</ul>\n<p><img src=\"https://img.serverlesscloud.cn/202077/1594108195026-%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_15941081788086.png\" alt=\"Serverless\"></p>\n<h3 id=\"serverless-cli-的设计\"><a href=\"#serverless-cli-%E7%9A%84%E8%AE%BE%E8%AE%A1\" aria-label=\"serverless cli 的设计 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>serverless-cli 的设计</h3>\n<p>cli 设计包含核心模块、默认命令、webpack相关、配置规范、以及基于cli 框架上层打造的插件生态。</p>\n<p><img src=\"https://img.serverlesscloud.cn/202077/1594108194752-%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_15941081788086.png\" alt=\"Serverless\"></p>\n<h2 id=\"场景方案\"><a href=\"#%E5%9C%BA%E6%99%AF%E6%96%B9%E6%A1%88\" aria-label=\"场景方案 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>场景方案</h2>\n<h3 id=\"场景方案---faas（云函数）\"><a href=\"#%E5%9C%BA%E6%99%AF%E6%96%B9%E6%A1%88---faas%EF%BC%88%E4%BA%91%E5%87%BD%E6%95%B0%EF%BC%89\" aria-label=\"场景方案   faas（云函数） permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>场景方案 - FaaS（云函数）</h3>\n<p>第一个场景方案：云函数。\n函数即服务，用户快速编写一个函数接口，这里创建了两个接口, 每个接口暴露一个函数，入参为param 和 context, 通过 async 返回函数同步异步结果。这个场景的插件为 @didi/sls-cli-plugin-faas, 用户通过 package.json 中声明依赖即可。 FaaS工程类型的优势，是简单高效，并且通过Serverless 路由可以灵活控制隔离粒度。</p>\n<p><img src=\"https://img.serverlesscloud.cn/202077/1594108194187-%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_15941081788086.png\" alt=\"Serverless\"></p>\n<p><img src=\"https://img.serverlesscloud.cn/202077/1594108195331-%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_15941081788086.png\" alt=\"Serverless\"></p>\n<h3 id=\"场景方案---sma（微应用）\"><a href=\"#%E5%9C%BA%E6%99%AF%E6%96%B9%E6%A1%88---sma%EF%BC%88%E5%BE%AE%E5%BA%94%E7%94%A8%EF%BC%89\" aria-label=\"场景方案   sma（微应用） permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>场景方案 - Sma（微应用）</h3>\n<p>第二个场景方案：微应用。\n页面即服务，前后端代码一体化，service.js 里保留出两个接口 list 和 add， 此时可以在前端组件中，类似远程调用，直接调用这两个方法，如同本地函数一样。另外它的服务端代码上下文和 FaaS 保持一致。</p>\n<p><img src=\"https://img.serverlesscloud.cn/202077/1594108194996-%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_15941081788086.png\" alt=\"Serverless\"></p>\n<h3 id=\"场景方案---sma-light（微应用-轻量版）\"><a href=\"#%E5%9C%BA%E6%99%AF%E6%96%B9%E6%A1%88---sma-light%EF%BC%88%E5%BE%AE%E5%BA%94%E7%94%A8-%E8%BD%BB%E9%87%8F%E7%89%88%EF%BC%89\" aria-label=\"场景方案   sma light（微应用 轻量版） permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>场景方案 - Sma-light（微应用-轻量版）</h3>\n<p>因为是应用级Severless方案，服务部署过程还是需要经历构建代码、编译镜像、以及整个应用级的部署。故我们基于Runtime的设计，结合Nodejs热更新能力，来支持页面级发布能力，轻量微应用类型工程。它支持</p>\n<ul>\n<li>静态页面、接口</li>\n<li>动态页面、接口</li>\n<li>页面模板、中间件等抽象，打造该工程类型的物料生态</li>\n</ul>\n<p><img src=\"https://img.serverlesscloud.cn/202077/1594108195057-%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_15941081788086.png\" alt=\"Severless\"></p>\n<h3 id=\"不同场景方案，一致开发体验\"><a href=\"#%E4%B8%8D%E5%90%8C%E5%9C%BA%E6%99%AF%E6%96%B9%E6%A1%88%EF%BC%8C%E4%B8%80%E8%87%B4%E5%BC%80%E5%8F%91%E4%BD%93%E9%AA%8C\" aria-label=\"不同场景方案，一致开发体验 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>不同场景方案，一致开发体验</h3>\n<p>我们来感受下，不同场景下一致的开发体验，包括创建、构建、开发、部署等\n执行dev 时会一件启动前端资源webpack服务，同时启动服务端runtime服务，打开导航页面。</p>\n<p>另外部署，可以执行 sls deploy, 通过 cli 将服务、按场景先后，按流量分组部署到 Severless 平台。\n也可以通过 Vscode 插件可视化方式进行操作，进行部署、回滚。</p>\n<p><img src=\"https://img.serverlesscloud.cn/202077/1594108195298-%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_15941081788086.png\" alt=\"Severless\"></p>\n<p><img src=\"https://img.serverlesscloud.cn/202077/1594108195614-%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_15941081788086.png\" alt=\"Severless\"></p>\n<h3 id=\"云端开发\"><a href=\"#%E4%BA%91%E7%AB%AF%E5%BC%80%E5%8F%91\" aria-label=\"云端开发 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>云端开发</h3>\n<p>更进一步，我们提供了云端开发能力，来满足一些如云函数，这类轻量创建服务的方式，开发者可以通过平台创建函数、页面，完成开发、调试，上线，且它的开发体验与本地是完全环境一致，并且是复用的。</p>\n<p><img src=\"https://img.serverlesscloud.cn/202077/1594108195592-%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_15941081788086.png\" alt=\"Severless\"></p>\n<h2 id=\"基于-serverless-面向业务聚合\"><a href=\"#%E5%9F%BA%E4%BA%8E-serverless-%E9%9D%A2%E5%90%91%E4%B8%9A%E5%8A%A1%E8%81%9A%E5%90%88\" aria-label=\"基于 serverless 面向业务聚合 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>基于 Serverless 面向业务聚合</h2>\n<p>我们来看一个业务使用案例。\n这是我们普惠的工作台，是一个面向运营，集合了多个业务线后台系统。这里的菜单栏是配置集成起来的，每个菜单项是一个独立的页面，目前我们还没有采用微前端的一些轻量的隔离方案，使用的是简单、有效的iframe来进行隔离的。每个页面即服务，由每个业务线团队里的每个同学，用他们熟悉的技术栈，通过的前面介绍的微应用解决方案，独立运维。</p>\n<p><img src=\"https://img.serverlesscloud.cn/202077/1594108195607-%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_15941081788086.png\" alt=\"Serverless\"></p>\n<h2 id=\"最后\"><a href=\"#%E6%9C%80%E5%90%8E\" aria-label=\"最后 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>最后</h2>\n<p>最后，我们也在积极探索用 V8 Isolate 与我们现有应用级Serverless + Runtime设计结合，实现面向nodejs更轻量高效的Serverless 隔离方案。</p>\n<hr>\n<div id='scf-deploy-iframe-or-md'></div>\n<hr>\n<blockquote>\n<p><strong>传送门：</strong></p>\n<ul>\n<li>GitHub: <a href=\"https://github.com/serverless/serverless/blob/master/README_CN.md\">github.com/serverless</a></li>\n<li>官网：<a href=\"https://serverless.com/\">serverless.com</a></li>\n</ul>\n</blockquote>\n<p>欢迎访问：<a href=\"https://serverlesscloud.cn/\">Serverless 中文网</a>，您可以在 <a href=\"https://serverlesscloud.cn/best-practice\">最佳实践</a> 里体验更多关于 Serverless 应用的开发！</p>","tableOfContents":"<ul>\n<li><a href=\"/blog/2020-07-17-serverlessdays-didi/#%E4%B8%BA%E4%BB%80%E4%B9%88%EF%BC%88%E5%89%8D%E7%AB%AF%EF%BC%89%E8%A6%81%E6%8E%A8%E5%8A%A8%E5%BB%BA%E8%AE%BE-serverless\">为什么（前端）要推动建设 Serverless</a></li>\n<li><a href=\"/blog/2020-07-17-serverlessdays-didi/#%E6%88%91%E4%BB%AC%E7%9A%84%E6%96%B9%E6%A1%88\">我们的方案</a></li>\n<li><a href=\"/blog/2020-07-17-serverlessdays-didi/#%E9%80%9A%E8%BF%87-serverless-%E5%8D%87%E7%BA%A7%E7%A0%94%E5%8F%91%E6%A8%A1%E5%BC%8F\">通过 Serverless 升级研发模式</a></li>\n<li><a href=\"/blog/2020-07-17-serverlessdays-didi/#serverless-%E5%85%A8%E5%B1%80%E5%9B%BE---%E7%A0%94%E5%8F%91%E8%A7%86%E8%A7%92\">Serverless 全局图 - 研发视角</a></li>\n<li>\n<p><a href=\"/blog/2020-07-17-serverlessdays-didi/#serverless-%E6%B5%81%E7%A8%8B%E5%9B%BE---%E7%A0%94%E5%8F%91%E8%A7%86%E8%A7%92\">Serverless 流程图 - 研发视角</a></p>\n<ul>\n<li><a href=\"/blog/2020-07-17-serverlessdays-didi/#serverless-cli-%E7%9A%84%E5%AE%9A%E4%BD%8D\">Serverless-cli 的定位</a></li>\n<li><a href=\"/blog/2020-07-17-serverlessdays-didi/#serverless-cli-%E7%9A%84%E8%AE%BE%E8%AE%A1\">serverless-cli 的设计</a></li>\n</ul>\n</li>\n<li>\n<p><a href=\"/blog/2020-07-17-serverlessdays-didi/#%E5%9C%BA%E6%99%AF%E6%96%B9%E6%A1%88\">场景方案</a></p>\n<ul>\n<li><a href=\"/blog/2020-07-17-serverlessdays-didi/#%E5%9C%BA%E6%99%AF%E6%96%B9%E6%A1%88---faas%EF%BC%88%E4%BA%91%E5%87%BD%E6%95%B0%EF%BC%89\">场景方案 - FaaS（云函数）</a></li>\n<li><a href=\"/blog/2020-07-17-serverlessdays-didi/#%E5%9C%BA%E6%99%AF%E6%96%B9%E6%A1%88---sma%EF%BC%88%E5%BE%AE%E5%BA%94%E7%94%A8%EF%BC%89\">场景方案 - Sma（微应用）</a></li>\n<li><a href=\"/blog/2020-07-17-serverlessdays-didi/#%E5%9C%BA%E6%99%AF%E6%96%B9%E6%A1%88---sma-light%EF%BC%88%E5%BE%AE%E5%BA%94%E7%94%A8-%E8%BD%BB%E9%87%8F%E7%89%88%EF%BC%89\">场景方案 - Sma-light（微应用-轻量版）</a></li>\n<li><a href=\"/blog/2020-07-17-serverlessdays-didi/#%E4%B8%8D%E5%90%8C%E5%9C%BA%E6%99%AF%E6%96%B9%E6%A1%88%EF%BC%8C%E4%B8%80%E8%87%B4%E5%BC%80%E5%8F%91%E4%BD%93%E9%AA%8C\">不同场景方案，一致开发体验</a></li>\n<li><a href=\"/blog/2020-07-17-serverlessdays-didi/#%E4%BA%91%E7%AB%AF%E5%BC%80%E5%8F%91\">云端开发</a></li>\n</ul>\n</li>\n<li><a href=\"/blog/2020-07-17-serverlessdays-didi/#%E5%9F%BA%E4%BA%8E-serverless-%E9%9D%A2%E5%90%91%E4%B8%9A%E5%8A%A1%E8%81%9A%E5%90%88\">基于 Serverless 面向业务聚合</a></li>\n<li><a href=\"/blog/2020-07-17-serverlessdays-didi/#%E6%9C%80%E5%90%8E\">最后</a></li>\n</ul>"},"previousBlog":{"id":"9841f6e5-c49f-577a-8ce4-66e5cb4563f5","frontmatter":{"thumbnail":"https://img.serverlesscloud.cn/2020713/1594632872304-1594628616299-%E7%AC%AC%E4%BA%94%E6%9C%9Fwebinar%20banner%E5%89%AF%E6%9C%AC.jpg","authors":["Serverless 社区"],"categories":["meetup"],"date":"2020-07-17T00:00:00.000Z","title":"对象存储 COS 和云函数 SCF 结合的轻应用及其技术原理 | 在线分享第五期","description":"腾讯云存储产品经理林楠、腾讯云存储前端负责人叶嘉梁为您分享","authorslink":null,"translators":null,"translatorslink":null,"tags":["COS","Meetup"],"keywords":"Serverless,SCF,COS","outdated":null},"wordCount":{"words":52,"sentences":8,"paragraphs":8},"fileAbsolutePath":"/opt/build/repo/content/blog/2020-07-17-webinar5-meetup.md","fields":{"slug":"/blog/2020-07-17-webinar5-meetup/","keywords":["serverless","云函数","serverless","Serverless","serverlesscloud"]}},"nextBlog":{"id":"7a740ddd-e8dd-5a94-b4a7-f78a8175ccb5","frontmatter":{"thumbnail":"https://img.serverlesscloud.cn/2020720/1595232134658-1594123221943-%E4%BA%AC%E4%B8%9C%E6%99%BA%E8%BF%9E%E4%BA%91.jpg","authors":["朱琅"],"categories":["news"],"date":"2020-07-16T00:00:00.000Z","title":"京东智联云在 Serverless 的探索","description":"本文整理自 ServerlessDay · China 大会，讲师为京东智联云的 PaaS 产品负责⼈朱琅。","authorslink":null,"translators":null,"translatorslink":null,"tags":["ServerlessDays","Meetup"],"keywords":"Serverless, ServerlessDays, Serverless实践,","outdated":null},"wordCount":{"words":910,"sentences":64,"paragraphs":64},"fileAbsolutePath":"/opt/build/repo/content/blog/2020-07-16-serverlessdays-jingdong.md","fields":{"slug":"/blog/2020-07-16-serverlessdays-jingdong/","keywords":["serverless","spa","Serverless","服务","FaaS","京东","代码"]}},"recommendBlogs":{"edges":[{"node":{"id":"73576d26-e0ce-5f26-9330-64b4f3889157","frontmatter":{"thumbnail":"https://main.qcloudimg.com/raw/3cb7b20955d78ced738e0279bb3f6f41.jpg","authors":["AndreaPasswater"],"categories":["news","engineering-culture"],"date":"2018-03-09T00:00:00.000Z","title":"Serverless 数据解读：2018 报告","description":"Serverless Framework 使用统计数据：事件源、服务结构、运行时长等等。","authorslink":["https://serverless.com/author/andreapasswater/"],"translators":["Aceyclee"],"translatorslink":["https://www.zhihu.com/people/Aceyclee"],"tags":["事件源","服务结构"],"keywords":"Serverless 统计数据,Serverless 事件源,Serverless 服务结构","outdated":null},"wordCount":{"words":212,"sentences":45,"paragraphs":45},"fileAbsolutePath":"/opt/build/repo/content/blog/2018-03-09-serverless-by-the-numbers-2018-data-report.md","fields":{"slug":"/blog/2018-03-09-serverless-by-the-numbers-2018-data-report/","keywords":["go","serverless","无服务器","云函数","服务","使用率","Go","部署"]}}},{"node":{"id":"84876745-cbfb-5c1d-9f6c-7c74338d5d28","frontmatter":{"thumbnail":"https://s3-us-west-2.amazonaws.com/assets.site.serverless.com/images/champions/champions_banner.jpg","authors":["RupakGanguly"],"categories":["news","engineering-culture"],"date":"2018-04-10T00:00:00.000Z","title":"2018 年首批无服务器社区冠军介绍","description":"无服务器社区冠军是无服务器社区的领导者。快来认识一下我们 2018 年度的社区英雄吧！","authorslink":null,"translators":null,"translatorslink":null,"tags":null,"keywords":null,"outdated":null},"wordCount":{"words":194,"sentences":32,"paragraphs":32},"fileAbsolutePath":"/opt/build/repo/content/blog/2018-04-10-announcing-new-2018-serverless-champions.md","fields":{"slug":"/blog/2018-04-10-announcing-new-2018-serverless-champions/","keywords":["serverless","webpack","无服务器","无服务器架构","服务器","serverless","champions","架构","blog","github","框架"]}}},{"node":{"id":"1e1a90fc-3b65-540c-b726-755999e7912a","frontmatter":{"thumbnail":"https://main.qcloudimg.com/raw/8a0db1c9fd8b51c15d0b006291d52bf5.jpg","authors":["AndreaPasswater"],"categories":["news","engineering-culture"],"date":"2018-07-19T00:00:00.000Z","title":"2018 年社区调查：Serverless 使用率大幅增长","description":"我们曾在开发社区进行问卷调查，询问 Serverless 的使用情况。它的使用率增长连我们自己都惊讶不已，下面来看看数据。","authorslink":["https://serverless.com/author/andreapasswater/"],"translators":["Aceyclee"],"translatorslink":["https://www.zhihu.com/people/Aceyclee"],"tags":["Component","Serverless"],"keywords":"Serverless 社区调查,Serverless 使用情况,Serverless 数据","outdated":null},"wordCount":{"words":267,"sentences":50,"paragraphs":49},"fileAbsolutePath":"/opt/build/repo/content/blog/2018-07-19-2018-serverless-community-survey-huge-growth-usage.md","fields":{"slug":"/blog/2018-07-19-2018-serverless-community-survey-huge-growth-usage/","keywords":["go","serverless","无服务器","Serverless","serverless"]}}},{"node":{"id":"8311b008-2b15-5225-8adc-9b75e484177b","frontmatter":{"thumbnail":"https://img.serverlesscloud.cn/2020414/1586880819419-%E5%B0%81%E9%9D%A2%E5%9B%BE%20%286%29.png","authors":["serverless 社区"],"categories":["news"],"date":"2019-04-08T00:00:00.000Z","title":"邀您参加 | K8S&云原生技术开放日-北京站","description":"K8S&云原生技术开放日，将围绕K8S、Serverless等云原生相关技术，从最佳落地实践、不同场景技术改造、应用优化，到开源领域深度技术研究，和技术爱好者们一起探讨。","authorslink":["https://zhuanlan.zhihu.com/ServerlessGo"],"translators":null,"translatorslink":null,"tags":["云原生","Serverless"],"keywords":"serverless 入门,serverless 框架,腾讯云 serverless","outdated":null},"wordCount":{"words":36,"sentences":9,"paragraphs":9},"fileAbsolutePath":"/opt/build/repo/content/blog/2019-04-08-k8s.md","fields":{"slug":"/blog/2019-04-08-k8s/","keywords":["serverless","云原生","serverless","Serverless","技术","原生","serverlesscloud","github"]}}},{"node":{"id":"25f709db-cde0-59d7-81f4-944c46a6dd8a","frontmatter":{"thumbnail":"https://img.serverlesscloud.cn/2020414/1586880571672-%E5%B0%81%E9%9D%A2%E5%9B%BE%20%285%29.png","authors":["serverless 社区"],"categories":["news"],"date":"2019-04-04T00:00:00.000Z","title":"Serverless 技术风暴来袭，开发者该如何应对？","description":"Hello Serverless技术沙龙北京站，将围绕Serverless的应用场景，客户案例，FaaS+BaaS架构的实现方案等，针对未来的无服务形态进行交流和讨论，释放技术想象！","authorslink":["https://zhuanlan.zhihu.com/ServerlessGo"],"translators":null,"translatorslink":null,"tags":["应用场景","Serverless"],"keywords":"serverless 入门,serverless 框架,腾讯云 serverless","outdated":null},"wordCount":{"words":37,"sentences":8,"paragraphs":8},"fileAbsolutePath":"/opt/build/repo/content/blog/2019-04-04-technology-storm.md","fields":{"slug":"/blog/2019-04-04-technology-storm/","keywords":["serverless","Serverless","serverless","serverlesscloud","github","技术","架构","围绕"]}}},{"node":{"id":"4bc4d946-6187-5c3d-91c6-d98c4c4c1314","frontmatter":{"thumbnail":"https://img.serverlesscloud.cn/2020414/1586880172144-%E5%B0%81%E9%9D%A2%E5%9B%BE%20%284%29.png","authors":["serverless 社区"],"categories":["news"],"date":"2019-06-11T00:00:00.000Z","title":"一图读懂无服务器云函数","description":"本图将重要信息进行梳理和提炼，帮助读者更好的理解无服务器云函数的理念和作用","authorslink":["https://zhuanlan.zhihu.com/ServerlessGo"],"translators":null,"translatorslink":null,"tags":["云函数","Serverless"],"keywords":"serverless 入门,serverless 框架,腾讯云 serverless","outdated":null},"wordCount":{"words":31,"sentences":6,"paragraphs":6},"fileAbsolutePath":"/opt/build/repo/content/blog/2019-06-11-one-picture-serverless-cloud-function.md","fields":{"slug":"/blog/2019-06-11-one-picture-serverless-cloud-function/","keywords":["serverless","无服务器","无服务器云函数","云函数","serverless","serverlesscloud","Serverless","github","开发者","函数"]}}},{"node":{"id":"1cd76f95-14a9-5fd5-926b-456af189b7ed","frontmatter":{"thumbnail":"https://img.serverlesscloud.cn/2020326/1585217744291-%E6%91%84%E5%9B%BE%E7%BD%91_400730082_wx.jpg","authors":["朱峰 Ben"],"categories":["news"],"date":"2019-10-14T00:00:00.000Z","title":"由浅入深说 Serverless 之云函数的生命周期","description":"希望通过文章分享帮助大家更深入的了解 Serverless 背后的机制并掌握相关的最佳实践。","authorslink":["https://github.com/jiangliu5267"],"translators":null,"translatorslink":null,"tags":["云函数"],"keywords":"Serverless, Serverless前端开发, Serverless云函数","outdated":null},"wordCount":{"words":74,"sentences":29,"paragraphs":29},"fileAbsolutePath":"/opt/build/repo/content/blog/2019-10-14-serverless-cloud-function.md","fields":{"slug":"/blog/2019-10-14-serverless-cloud-function/","keywords":["faas","java","云函数","函数","触发","实例","事件","数据库","启动","连接","sql","代码"]}}},{"node":{"id":"4f16f8bc-1a35-5394-9029-f7abc2ad6137","frontmatter":{"thumbnail":"https://img.serverlesscloud.cn/qianyi/images/YHl6UWa9s629ucl0iaVcic8rL06uEBM5go4LSXiaHnibDJSBjLGAhGlWz3QZ1RZzd3NeCibjJxOyUApDO7TaPYcwxsw.jpg","authors":["Serverless 中文网"],"categories":["news"],"date":"2019-10-26T00:00:00.000Z","title":"Hello Serverless 实战沙龙回顾","description":"2019 年 10 月 26 日，Hello Serverless 沙龙活动在广州市海珠区腾讯众创空间成功举办，一起看看我们都为大家准备了哪些精彩的演讲吧！","authorslink":["https://github.com/jiangliu5267"],"translators":null,"translatorslink":null,"tags":["Meetup"],"keywords":"Serverless, Serverless技术沙龙,Hello Serverless","outdated":null},"wordCount":{"words":64,"sentences":13,"paragraphs":13},"fileAbsolutePath":"/opt/build/repo/content/blog/2019-10-26-hello-serverless-meetup.md","fields":{"slug":"/blog/2019-10-26-hello-serverless-meetup/","keywords":["go","serverless","云函数","云原生","Serverless","存储","腾讯","serverlesscloud"]}}}],"totalCount":46}},"pageContext":{"isCreatedByStatefulCreatePages":false,"blogId":"ecc61b91-6065-5cfc-94d1-15294badadb0","previousBlogId":"9841f6e5-c49f-577a-8ce4-66e5cb4563f5","nextBlogId":"7a740ddd-e8dd-5a94-b4a7-f78a8175ccb5","categories":["news"]}}}