{"componentChunkName":"component---src-templates-blog-detail-tsx","path":"/blog/2020-09-01-rust-webassembly","result":{"data":{"currentBlog":{"id":"1dd5ab16-83ee-57de-adf8-e53200d90472","frontmatter":{"thumbnail":"https://img.serverlesscloud.cn/202091/1598950750395-origin_img_6f483a12-6885-4499-b35b-2e23c949ef8g.jpg","authors":["Michael Yuan"],"categories":["user-stories"],"date":"2020-09-01T00:00:00.000Z","title":"基于腾讯云的 Rust 和 WebAssembly 函数即服务","description":"本文将介绍如何在云函数 SCF 中运行用 Rust 编写的 WebAssembly 函数。","authorslink":["https://www.freecodecamp.org/news/author/michael"],"translators":null,"translatorslink":null,"tags":["Serverless","WebAssembly"],"keywords":"Serverless, Serverless Framework","outdated":null},"wordCount":{"words":551,"sentences":59,"paragraphs":59},"fileAbsolutePath":"/opt/build/repo/content/blog/2020-09-01-rust-webassembly.md","fields":{"slug":"/blog/2020-09-01-rust-webassembly/","keywords":["go","serverless","无服务器","无服务器函数","云函数","函数","WebAssembly","Rust","腾讯","web","服务器"]},"html":"<p>腾讯云云函数 (SCF) 已经支持十多种编程语言和运行时框架。腾讯云最近发布的 SCF custom runtime（自定义运行时）更进一步 —— SCF 现在可以支持用任何编程语言编写的函数。</p>\n<p>本文将介绍如何在云函数 SCF 中运行用 Rust 编写的 WebAssembly 函数。</p>\n<p>我们先介绍一些基本概念，然后回顾一个完整但简单的 hello world 示例，部署您的第一个 WebAssembly 无服务器函数。最后，我们将用一个机器学习即服务 (MLaaS) 示例来做一些有用的事情。该示例接受数据并以 SVG 格式返回拟合模型和可视化。</p>\n<p>这是本教程结束时你将创建的<a href=\"https://www.secondstate.io/demo/2020-tencentcloud.html\">最终应用</a>。它完全是「无服务器」的，只有使用时会产生成本。</p>\n<p>HTML 和 JavaScript UI 可以托管在任何计算机上，包括笔记本电脑上。在腾讯云 Serverless 上的后端函数执行机器学习和 SVG 绘图。</p>\n<h2 id=\"为什么选择-webassembly-和-rust\"><a href=\"#%E4%B8%BA%E4%BB%80%E4%B9%88%E9%80%89%E6%8B%A9-webassembly-%E5%92%8C-rust\" aria-label=\"为什么选择 webassembly 和 rust 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>为什么选择 WebAssembly 和 Rust</h2>\n<p>传统的无服务器函数基于重量级的框架。开发者必须在特定的应用框架中编写函数，比如 Node.js 中的 JavaScript 或 Python Boto。</p>\n<p>腾讯云 SCF Custom Runtime 打破了这种模式，允许开发者用任何语言编写无服务器函数。</p>\n<p>为了演示这个优势，本文提供了基于 Bash 脚本的函数、基于 Deno 的 TypeScript 函数和基于 Rust 的本机二进制函数的示例。这使我们能够在腾讯云上创建和部署基于 web 组件的无服务器函数。</p>\n<h3 id=\"为什么要这么做？\"><a href=\"#%E4%B8%BA%E4%BB%80%E4%B9%88%E8%A6%81%E8%BF%99%E4%B9%88%E5%81%9A%EF%BC%9F\" 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<ul>\n<li>WebAssembly 是为性能而设计的。 WebAssembly 函数可以比用JavaScript 或者 Python 快 10 倍。</li>\n<li>WebAssembly 函数是可移植的。虽然可以在 SCF Custom runtime上运行本地二进制文件，但必须将这些二进制文件编译到 Custom runtime 的确切操作系统环境中。目前在 X86 CPU 上使用的是 CentOS 7.6，之后可能会更改。正如我们将要看到的，WebAssembly 函数是可移植的，并且非常容易部署和管理。</li>\n<li>WebAssembly 函数是安全的。众所周知，即使使用 Docker，本地二进制应用程序也可能会破坏容器。由于你的应用程序可能依赖于许多第三方库，因此你的依赖项中存在危险代码的风险真实存在。 WebAssembly 有着基于能力的安全模型, 为你的代码提供更好的运行时保护。</li>\n<li>虽然 WebAssembly 兼容各种编程语言，但 Rust、AssemblyScript (TypeScript)、C/C++ 和 Go 是写 WebAssembly 函数的最佳语言，尤其是 Rust。Rust 是一种流行且越来越受瞩目的编程语言，社区非常活跃。Rust 让我们能够写一个高效但内存安全的函数。</li>\n</ul>\n<p>最后，在腾讯云上编写和部署 WebAssembly 函数实际上非常简单，在一个小时内就可以完成。</p>\n<h2 id=\"前期准备\"><a href=\"#%E5%89%8D%E6%9C%9F%E5%87%86%E5%A4%87\" 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>首先，注册一个腾讯云账户。对大多数开发和个人项目来说，开发工作都可以在免费额度内进行。 </p>\n<p>确保你已经在地开发计算机或 Docker 容器上安装了 Rust 和 ssvmup 工具链。ssvmup 工具链将 Rust 程序编译并优化为 WebAssembly 字节码。只需使用以下简单命令即可安装。你也可以参考这个指南。</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">$ curl --proto &#39;=https&#39; --tlsv1.2 -sSf https://sh.rustup.rs | sh\n$ source $HOME/.cargo/env\n... ...\n$ curl https://raw.githubusercontent.com/second-state/ssvmup/master/installer/init.sh -sSf | sh</code></pre></div>\n<p>WebAssembly 函数是在 Second State 虚拟机 SSVM 里执行的。SSVM 是专为服务端的用例和应用优化的高性能 WebAssembly 虚拟机。</p>\n<h2 id=\"hello-world\"><a href=\"#hello-world\" aria-label=\"hello world 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>Hello, world</h2>\n<p>要在腾讯云上部署 Rust 和 WebAssembly 函数, 我们建议 clone 或者 fork GitHub 上的<a href=\"https://github.com/second-state/ssvm-tencent-starter\">模板 repo</a>，并把这个模板作为你自己应用的基础。 </p>\n<p>在 <code class=\"language-text\">main.rs</code> 上的 Rust 函数是我们将部署到 SCF 的无服务函数。正如你能从源代码看到的那样，它能从 STDIN 读取函数的输入, 然后用 println! macro 把结果发送到 STDOUT。</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">use std::io::{self, Read};\nuse serde::Deserialize;\n\nfn main() {    \n    let mut buffer = String::new();    \n    io::stdin().read_to_string(&amp;mut buffer).expect(&quot;Error reading from STDIN&quot;);    \n    let obj: FaasInput = serde_json::from_str(&amp;buffer).unwrap();    \n    let key1 = &amp;(obj.key1);    \n    let key2 = &amp;(obj.key2);    \n    println!(&quot;Hello! {}, {}&quot;, key1, key2);\n}\n\n#[derive(Deserialize, Debug)]\nstruct FaasInput {    \n    key1: String,    \n    key2: String\n}</code></pre></div>\n<p>Rust main() 函数使用 serde 库来从 STDIN 解析一个 JSON 字符串。</p>\n<p>JSON 看起来像下面这样。 我们之所以用这种方式编写函数，是因为SCF 使用内置的 hello world JSON 模板来测试部署好的函数。</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">{  \n    &quot;key1&quot;: &quot;test value 1&quot;,  \n    &quot;key2&quot;: &quot;test value 2&quot;\n}</code></pre></div>\n<p>函数提取 key1 和 key2 值并输出下面的 hello 消息到 STDOUT。 </p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Hello! test value 1, test value 2</code></pre></div>\n<p>但是，这个函数的 web 请求是如何被转换成 STDIN 的？如何将 STDOUT 中的函数响应转换为 HTTP 响应？</p>\n<p>这是通过我们模板中的 SCF custom runtime 基础设施和引导 (bootstrap) 程序完成的。</p>\n<p>正如你所看到的那样，引导程序只是一个 bash shell 程序，它不断地轮询云函数 SCF 以查找传入的请求。它将传入的请求转换为 STDIN，并通过 SSVM 调用 WebAssembly 函数。然后，它接受 STDOUT 输出，并将其作为函数的响应发给 SCF。</p>\n<p>如果你使用我们的模板，就不需要修改引导程序。</p>\n<p>现在，可以使用 ssvmup 将 Rust 函数构建到 WebAssembly 字节码中，然后将 zip 文件打包，从而在腾讯云 SCF Custom Runtime 上进行部署。</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">$ ssvmup build\n... ...\n\n$ cp pkg/hello_bg.wasm cloud/\n$ cd cloud\n$ zip hello.zip *</code></pre></div>\n<p>按照这个说明和截图来部署并测试上面 <code class=\"language-text\">hello.zip</code> 文件。现在已经成功地部署了一个 WebAssembly 无服务器函数！</p>\n<p>接下来，让我们用 Rust 函数创建一个有价值的 web 服务。</p>\n<h2 id=\"机器学习即服务\"><a href=\"#%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E5%8D%B3%E6%9C%8D%E5%8A%A1\" 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>这个例子中，我们选择了一个计算密集型的机器学习任务来演示 Rust WebAssembly 函数的性能。</p>\n<p>无服务器函数采用以逗号分隔的数字输入字符串，这些数字表示二维平面上的一组点。输入的数据格式是 <code class=\"language-text\">x1,y1,x2,y2,...</code></p>\n<p>该函数分析数据并计算两个特征向量，指示数据中最大方差的方向。特征向量为数据科学家提供了关于驱动数据变化的潜在因素的线索。这就是所谓的主成分分析。</p>\n<p>我们的函数创建一个 SVG 图，并且在这个图上绘制输入的数据点以及上面计算得到的特征向量。该函数最后以 XML 文本的形式返回这个 SVG 图。</p>\n<p>要开始这个例子，你可以 clone 或者 fork 这个 <a href=\"https://github.com/second-state/wasm-learning/tree/master/tencentcloud\">repo</a>。该项目在 <code class=\"language-text\">tencentcloud/ssvm/pca</code> 文件夹中。或者你可以复制 <code class=\"language-text\">Cargo.toml</code> 和 <code class=\"language-text\">src/*</code> 的内容到上文的 hello world 模板。如果你选择后者，确保你修改了 <code class=\"language-text\">Cargo.toml</code>，将其指向 Rust 机器学习库的正确源代码文件夹。</p>\n<p>本教程中不会深入探讨 PCA 或 SVG 生成的 Rust 源代码的细节，因为它们涉及大量的计算代码。</p>\n<p>遵照与 hello world 示例中相同的步骤。使用 ssvmup 构建一个 <code class=\"language-text\">pca.zip</code> 包，并将其部署到腾讯云 SCF custom runtime 上。</p>\n<p>接下来，我们将部署好的函数与 web API 网关关联起来，以便可以从 web HTTP 或 HTTPS 请求调用它。在 SCF 的 web 控制台的触发管理选项卡中执行此操作。这里可以查看<a href=\"https://github.com/second-state/wasm-learning/tree/master/tencentcloud/ssvm/pca#create-a-web-service\">教程和截图</a></p>\n<p>API 控制台将 HTTP 请求转换为无服务器函数的 JSON 输入。例如，这里有一个对 API 网关 URL 的 HTTP POST 请求。我们将来自 <code class=\"language-text\">iris.csv</code> 文件的以逗号分隔的数据点放在 POST 主体中。</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">$ curl -d @iris.csv -X POST https://service-m9pxktbc-1302315972.hk.apigw.tencentcs.com/release/PCASVG</code></pre></div>\n<p>API 网关将以下 JSON 传到 Rust 函数的 STDIN。POST body 现在是 JSON 中的 body 属性。</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">{\n  &quot;body&quot;: &quot;3.5,0.2,3,0.2,...&quot;,\n  &quot;headerParameters&quot;: {},\n  &quot;headers&quot;: {\n    &quot;accept&quot;: &quot;/&quot;,\n    &quot;content-length&quot;: &quot;11&quot;,\n    &quot;content-type&quot;: &quot;application/x-www-form-urlencoded&quot;,\n    &quot;host&quot;: &quot;service-aj0plx8u-1302315972.hk.apigw.tencentcs.com&quot;,\n    &quot;user-agent&quot;: &quot;curl/7.54.0&quot;,\n    &quot;x-anonymous-consumer&quot;: &quot;true&quot;,\n    &quot;x-api-requestid&quot;: &quot;e3123014742e7dd79f0652968bf1f62e&quot;,\n    &quot;x-b3-traceid&quot;: &quot;e3123014742e7dd79f0652968bf1f62e&quot;,\n    &quot;x-qualifier&quot;: &quot;$DEFAULT&quot;\n  },\n  &quot;httpMethod&quot;: &quot;POST&quot;,\n  &quot;path&quot;: &quot;/my_hk&quot;,\n  &quot;pathParameters&quot;: {},\n  &quot;queryString&quot;: {},\n  &quot;queryStringParameters&quot;: {},\n  &quot;requestContext&quot;: {\n    &quot;httpMethod&quot;: &quot;ANY&quot;,\n    &quot;identity&quot;: {},\n    &quot;path&quot;: &quot;/my_hk&quot;,\n    &quot;serviceId&quot;: &quot;service-aj0plx8u&quot;,\n    &quot;sourceIp&quot;: &quot;136.49.211.114&quot;,\n    &quot;stage&quot;: &quot;release&quot;\n  }\n}</code></pre></div>\n<p>Rust 函数解析主体中的数据，执行 PCA，并生成 SVG 图形。它将 SVG 内容打印到 STDOUT，后者由 API 网关获取并作为 HTTP 响应发送回来。</p>\n<p>要在 AJAX 请求中使用此 API 网关 URL，还必须配置腾讯云网关以接受 CORS web 请求。查看<a href=\"https://www.secondstate.io/articles/tencentcloud-api-gateway-cors/\">指南</a>，了解如何做到这一点。</p>\n<p>下面的 HTML JavaScript 例子展示了如何在网页中使用这个无服务器函数。</p>\n<p>它通过 ID <code class=\"language-text\">csv_data</code> 从 <code class=\"language-text\">textarea</code> 字段获取 CSV 数据，向无服务器函数发出 AJAX HTTP POST 请求，然后把返回值（一个 SVG 图形）放入 ID 为 <code class=\"language-text\">svg_img</code> 的 HTML 元素中。点击这里查看 <a href=\"https://www.secondstate.io/demo/2020-tencentcloud.html\">demo</a>。</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">$.ajax({\n  method: &quot;POST&quot;,\n  url: &quot;https://service-m9pxktbc-1302315972.hk.apigw.tencentcs.com/release/PCASVG&quot;,\n  data: $(&#39;#csv_data&#39;).val(),\n  dataType: &quot;text&quot;\n}).done(function(data) {\n  $(&#39;#svg_img&#39;).html(data);\n})</code></pre></div>\n<p><img src=\"https://img.serverlesscloud.cn/202091/1598949770276-tencentcloud_pca_webapp.png\" alt=\"运行中的 Web 应用\"></p>\n<h2 id=\"接下来\"><a href=\"#%E6%8E%A5%E4%B8%8B%E6%9D%A5\" 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>腾讯的 SCF Custom runtime 是一个非常强大的无服务运行环境。它为你想要编写的任何应用程序函数提供了一个通用的 Linux 环境，并提供了标准的 web 接口来与函数的输入和输出进行交互。这绝对值得一试。</p>\n<p>正如本文所讨论的，我们相信 Rust 和 WebAssembly 为无服务器函数提供了一个高性能、安全、可移植、面向未来的堆栈。Rust、WebAssembly 与 SCF costum runtime 代表了未来！</p>\n<blockquote>\n<p><strong>作者简介：</strong> Michael Yuan 博士是 5 本软件工程书籍的作者。最新著作《Building Blockchain Apps》由 Addison-Wesley 于 2019 年 12 月出版。Michael 还担任 Second State 的 CEO，Second State 是一家致力于将 WebAssembly 和 Rust 技术引入云计算，AI 与区块链的公司。</p>\n</blockquote>\n<hr>\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>\n<p><a href=\"/blog/2020-09-01-rust-webassembly/#%E4%B8%BA%E4%BB%80%E4%B9%88%E9%80%89%E6%8B%A9-webassembly-%E5%92%8C-rust\">为什么选择 WebAssembly 和 Rust</a></p>\n<ul>\n<li><a href=\"/blog/2020-09-01-rust-webassembly/#%E4%B8%BA%E4%BB%80%E4%B9%88%E8%A6%81%E8%BF%99%E4%B9%88%E5%81%9A%EF%BC%9F\">为什么要这么做？</a></li>\n</ul>\n</li>\n<li><a href=\"/blog/2020-09-01-rust-webassembly/#%E5%89%8D%E6%9C%9F%E5%87%86%E5%A4%87\">前期准备</a></li>\n<li><a href=\"/blog/2020-09-01-rust-webassembly/#hello-world\">Hello, world</a></li>\n<li><a href=\"/blog/2020-09-01-rust-webassembly/#%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E5%8D%B3%E6%9C%8D%E5%8A%A1\">机器学习即服务</a></li>\n<li><a href=\"/blog/2020-09-01-rust-webassembly/#%E6%8E%A5%E4%B8%8B%E6%9D%A5\">接下来</a></li>\n</ul>"},"previousBlog":{"id":"635582b7-be92-5517-b7c6-0a1c5d2c6cde","frontmatter":{"thumbnail":"https://img.serverlesscloud.cn/202093/1599100692526-1598958654408-%E7%AC%AC%E4%B9%9D%E6%9C%9Fbanner.jpg","authors":["Serverless 社区"],"categories":["meetup"],"date":"2020-09-04T00:00:00.000Z","title":"消除冷启动，预置并发助力腾讯云 Serverless 云函数更快 | 在线分享第九期","description":"腾讯云云函数产品经理 Alfonso 为您分享！","authorslink":null,"translators":null,"translatorslink":null,"tags":["Serverless","Meetup"],"keywords":"Serverless CFS","outdated":null},"wordCount":{"words":36,"sentences":5,"paragraphs":5},"fileAbsolutePath":"/opt/build/repo/content/blog/2020-09-04-webinar-meetup.md","fields":{"slug":"/blog/2020-09-04-webinar-meetup/","keywords":["serverless","云函数","并发","serverlesscloud","Serverless","冷启动","预置"]}},"nextBlog":{"id":"4715b7fd-70d9-51ec-98e3-d168c38cfb64","frontmatter":{"thumbnail":"https://img.serverlesscloud.cn/2020831/1598875449764-%E5%9B%9E%E9%A1%BE.jpg","authors":["黄文俊"],"categories":["news"],"date":"2020-08-31T00:00:00.000Z","title":"回顾｜腾讯云 CFS 文件存储给云函数 SCF 带来的业务新场景","description":"Serverless 依靠其快速开发上线，无需复杂运维的特性，正逐步进入到更多的业务场景中。","authorslink":["https://github.com/loboxu"],"translators":null,"translatorslink":null,"tags":["Serverless","文件存储"],"keywords":"Serverless, Serverless Kafka, Serverless 实践","outdated":null},"wordCount":{"words":331,"sentences":26,"paragraphs":26},"fileAbsolutePath":"/opt/build/repo/content/blog/2020-08-31-scf-cfs.md","fields":{"slug":"/blog/2020-08-31-scf-cfs/","keywords":["serverless","云函数","函数","文件","存储","存储空间","场景"]}},"recommendBlogs":{"edges":[{"node":{"id":"4300b21c-7209-5256-86ff-0d38e3daec9b","frontmatter":{"thumbnail":"https://main.qcloudimg.com/raw/14f1c8eed372e76c1b139703b2f6d0fa.jpg","authors":["KieranMcCarthy"],"categories":["user-stories","engineering-culture"],"date":"2018-01-09T00:00:00.000Z","title":"我是如何在四年时间里，从厨师转行为 Serverless 应用开发者","description":"我是厨师出身，现在成为了一名 Serverless 应用开发者。","authorslink":["https://serverless.com/author/kieranmccarthy/"],"translators":["Aceyclee"],"translatorslink":["https://www.zhihu.com/people/Aceyclee"],"tags":["应用开发","Serverless"],"keywords":"Serverless 应用开发,Serverless 管理,厨师转行为 Serverless 应用开发者","outdated":null},"wordCount":{"words":285,"sentences":38,"paragraphs":36},"fileAbsolutePath":"/opt/build/repo/content/blog/2018-01-09-from-chef-to-serverless-developer-in-4-years.md","fields":{"slug":"/blog/2018-01-09-from-chef-to-serverless-developer-in-4-years/","keywords":["无服务器","无服务器开发","云函数","学习","Serverless","构建","Framework","开发者","服务器","应用","学位","简历"]}}},{"node":{"id":"713a0563-4bf9-5721-bacb-3b4ef609fe4a","frontmatter":{"thumbnail":"https://s3-us-west-2.amazonaws.com/assets.blog.serverless.com/camp-fire/camp-fire-housing-thumb.jpg","authors":["EricWyne"],"categories":["guides-and-tutorials","user-stories"],"date":"2018-12-05T00:00:00.000Z","title":"Serverless Twitter 机器人帮助为坎普山火受灾者安置住房","description":"加利福尼亚州的坎普山火致使数千人流离失所，为此，我构建了一个简单的 Serverless Twitter 机器人来帮助将受灾者安置在临时住房！","authorslink":["https://serverless.com/author/ericwyne/"],"translators":["Aceyclee"],"translatorslink":["zhihu.com/people/Aceyclee"],"tags":null,"keywords":null,"outdated":null},"wordCount":{"words":157,"sentences":26,"paragraphs":26},"fileAbsolutePath":"/opt/build/repo/content/blog/2018-12-05-serverless-twitter-camp-fire.md","fields":{"slug":"/blog/2018-12-05-serverless-twitter-camp-fire/","keywords":["serverless","无服务器","云函数","Serverless","org","住房","Twitter","函数","受灾","机器人","山火"]}}},{"node":{"id":"98602143-b837-5f50-a24f-3b1ec76044d7","frontmatter":{"thumbnail":"https://s3-us-west-2.amazonaws.com/assets.blog.serverless.com/sqquid/sqquid-serverless-thumb.jpg","authors":["RonPeled"],"categories":["user-stories"],"date":"2018-12-17T00:00:00.000Z","title":"SQQUID：100% 无服务器初创公司","description":"SQQUID 将 AWS Lambda 和无服务器框架用于其核心产品和营销网站。我们来看看一个完全无服务器的初创公司是怎样的。","authorslink":null,"translators":null,"translatorslink":null,"tags":null,"keywords":null,"outdated":null},"wordCount":{"words":266,"sentences":42,"paragraphs":42},"fileAbsolutePath":"/opt/build/repo/content/blog/2018-12-17-sqquid-one-hundred-percent-serverless.md","fields":{"slug":"/blog/2018-12-17-sqquid-one-hundred-percent-serverless/","keywords":["go","serverless","无服务器","无服务器架构","服务器","架构","Lambda","集成","FaaS","串行","系统"]}}},{"node":{"id":"29dc2e58-d2ba-56f9-aee1-d21b0bc62e0e","frontmatter":{"thumbnail":"https://s3-us-west-2.amazonaws.com/assets.blog.serverless.com/ao-com-story/ao-serverless-thumbnail.png","authors":["NickGottlieb"],"categories":["user-stories"],"date":"2019-04-24T00:00:00.000Z","title":"AO.com：逐渐转向无服务器优先","description":"AO.com 的 SCV 团队率先尝试无服务器服务。折服于无服务器框架的快速周转时间和低维护成本，整个团队逐渐转向无服务器优先。","authorslink":null,"translators":null,"translatorslink":null,"tags":null,"keywords":null,"outdated":null},"wordCount":{"words":236,"sentences":42,"paragraphs":35},"fileAbsolutePath":"/opt/build/repo/content/blog/2019-04-24-ao-serverless-first.md","fields":{"slug":"/blog/2019-04-24-ao-serverless-first/","keywords":["serverless","无服务器","服务器","团队","Lambda","功能","构建"]}}},{"node":{"id":"752d08d1-387a-5bde-acf3-98141baab294","frontmatter":{"thumbnail":"https://img.serverlesscloud.cn/2020414/1586871710979-%E5%85%AC%E5%85%B1%E7%94%A8.png","authors":["Anycodes"],"categories":["user-stories"],"date":"2019-06-20T00:00:00.000Z","title":"如何用 Serverless 为 Python 云函数打包依赖","description":"在使用无服务器云函数SCF时通常会遇到导入第三方库的问题，很多小伙伴比较头疼是：应该如何打包进去？这里，推荐几个不错的方法。","authorslink":["https://zhuanlan.zhihu.com/ServerlessGo"],"translators":null,"translatorslink":null,"tags":["云函数","Serverless"],"keywords":"Serverless,Serverless应用,无服务器云函数","outdated":null},"wordCount":{"words":81,"sentences":43,"paragraphs":43},"fileAbsolutePath":"/opt/build/repo/content/blog/2019-06-20-for-python-cloud-functions.md","fields":{"slug":"/blog/2019-06-20-for-python-cloud-functions/","keywords":["java","serverless","无服务器","无服务器云函数","云函数","serverlesscloud","安装","serverless","pillowtest"]}}},{"node":{"id":"2dc78814-9d77-555b-a1bb-ad202c8ec2d1","frontmatter":{"thumbnail":"https://s3-us-west-2.amazonaws.com/assets.blog.serverless.com/cloudforecast/thumbnail.png","authors":["FrancoisLagier"],"categories":["user-stories"],"date":"2019-08-07T00:00:00.000Z","title":"Serverless：初创企业的理想选择？（CloudForecast 案例分析）","description":"CloudForecast 是 2018 年成立的一家独立初创企业，本文将介绍他们决定选择 Serverless 的原因。","authorslink":["https://serverless.com/author/francoislagier/"],"translators":["Aceyclee"],"translatorslink":["zhihu.com/people/Aceyclee"],"tags":null,"keywords":null,"outdated":null},"wordCount":{"words":211,"sentences":29,"paragraphs":29},"fileAbsolutePath":"/opt/build/repo/content/blog/2019-08-07-serverless-for-startups.md","fields":{"slug":"/blog/2019-08-07-serverless-for-startups/","keywords":["serverless","云函数","serverless","函数","Serverless","utm","Framework","blog","CloudForecast","cloudforecast"]}}},{"node":{"id":"97450b07-658b-5207-8216-1c7b9b51b115","frontmatter":{"thumbnail":"https://img.serverlesscloud.cn/2020114/1578988490344-v2-8b2cd2c5275aa2c5a3c5083a148a7a9f_1200x500.jpg","authors":["Anycodes"],"categories":["user-stories"],"date":"2019-09-01T00:00:00.000Z","title":"如何通过 Serverless 与自然语言处理，让搜索引擎「看」到你的博客","description":"Serverless 与自然语言处理结合的一个小应用","authorslink":["https://www.zhihu.com/people/liuyu-43-97"],"translators":null,"translatorslink":null,"tags":["个人博客","serverless"],"keywords":"Serverless 自然语言处理","outdated":null},"wordCount":{"words":106,"sentences":34,"paragraphs":34},"fileAbsolutePath":"/opt/build/repo/content/blog/2019-09-01-search-engine-blog.md","fields":{"slug":"/blog/2019-09-01-search-engine-blog/","keywords":["serverless","云函数","keywords","serverlesscloud","summary"]}}},{"node":{"id":"ae4fd2f8-515c-5aec-b584-38427ef33f7e","frontmatter":{"thumbnail":"https://img.serverlesscloud.cn/2020114/1578989800047-part-00492-780.jpg","authors":["Anycodes"],"categories":["guides-and-tutorials","user-stories"],"date":"2019-09-16T00:00:00.000Z","title":"突破传统 OJ 瓶颈，「判题姬」接入云函数","description":"通过 Serverless 实现在线编程","authorslink":["https://www.zhihu.com/people/liuyu-43-97"],"translators":null,"translatorslink":null,"tags":["在线编程","云函数"],"keywords":"Serverless 在线编程,Serverless OJ","outdated":null},"wordCount":{"words":169,"sentences":30,"paragraphs":30},"fileAbsolutePath":"/opt/build/repo/content/blog/2019-09-16-online-Judge.md","fields":{"slug":"/blog/2019-09-16-online-Judge/","keywords":["python","serverless","云函数","代码","函数","serverless"]}}}],"totalCount":64}},"pageContext":{"isCreatedByStatefulCreatePages":false,"blogId":"1dd5ab16-83ee-57de-adf8-e53200d90472","previousBlogId":"635582b7-be92-5517-b7c6-0a1c5d2c6cde","nextBlogId":"4715b7fd-70d9-51ec-98e3-d168c38cfb64","categories":["user-stories"]}}}