[云计算技术文章之其一] 利用 IBM 云功能构建无服务器应用程序

前言

  • 最近一两个星期,手头上的项目陆续交付出去了,个人的空闲时间就多了些,于是业余活动就增多了起来,终于也有时间开始整理文档,写写博客了。
  • 近期的业余活动,除了继续学习吴恩达老师的深度学习课程,看一看 Stephen Boyd 的著作《Convex Optimization》学习一些数学知识,还加入了腾讯云的“云+翻译社”,闲下来时翻译一些比较新的技术文章张张姿势,身为技术人,可不能跟不上时代啊。
  • 翻译社第一期活动是“云计算相关技术的前瞻性研究”,虽然跟我的学习方向不怎么对口,但是我也领了五篇比较简单的文章趁机涨涨姿势。
  • 其中有三篇文章被专栏采纳了,说明这几篇翻译还是及格的。所以我打算在这两天整理整理,把中英对照版发在这里。
  • 发在专栏的原文地址如下:

版权相关

翻译人:StoneDemo,该成员来自云+社区翻译社
原文链接:Composing Serverless Apps With IBM Cloud Functions
原文作者:Niklas Heidloff


Composing Serverless Apps With IBM Cloud Functions

题目:利用 IBM 云功能构建无服务器应用程序

At Serverlessconf, IBM announced a new key capability (as an IBM Research preview) of IBM Cloud Functions. With the new tool Composer, apps can be created that contain multiple cloud functions. These apps coordinate the invocations of actions and the data flow. Compared to the previously available action sequences, the new functionality is much more flexible.

在 IBM(国际商业机器公司) 的 Serverlessconf 网站上,官方发布了 IBM Cloud Functions 的一项新功能(作为 IBM Research 的一个预览版)。我们可以使用新工具 Composer,以创建包含多个云功能的应用程序,这些应用程序会协调动作的调用与数据流。新功能比起以前使用的动作序列相比,更为灵活了。

Cloud functions are typically rather simple and focussed on specific tasks, which is why people often refer to cloud functions as microservices. Cloud-native applications usually have many microservices. While the implementation of the microservices is rather simple, the key challenge is the orchestration layer above the microservices. That’s why frameworks like Kubernetes, with additions like Istio, have become very popular. With the new Composer tool, developers can now build apps that leverage multiple cloud functions and that require more complex, coordinated flows for end-to-end solutions.

云功能一般来说是非常简单,且专注于特定任务的,这也是人们通常将云功能称为微服务的原因。云本地应用程序通常包含了许多的微服务。微服务的实现非常简单,其技术难点在于微服务之上的流程编排层。这就是像 Kubernetes 这样的框架,与 Istio 这样的附加组件已变得非常流行的原因。开发人员现在可以使用新工具 Composer 来构建能够利用多种云功能的应用程序,但这需要更复杂、协调一致的流程来实现端到端的解决方案。

Composer is an IBM Cloud Functions programming model for composing individual functions into larger applications. Compositions, informally named apps, run in the cloud using automatically managed compute and memory resources. Composer is an extension of the function-as-a-service computing model, and enables stateful computation, control flow, and rich patterns of data flow. Composer has two parts. The first is a library for describing compositions, programmatically. The library is currently available in Node.js. The second is a runtime that executes the composition.

Composer 是 IBM Cloud Functions 编程模型,该模型用于将各个独立功能组合成更大的应用程序。组合模式、非正式命名程序,都是使用自动管理的计算与内存资源运行在云服务器中。Composer 是对功能服务(FaaS)计算模型的一个扩展,它支持状态计算、控制流和丰富的数据流模式。Composer 由两部分组成:第一个,是以编程方式描述组合模式的库,该库目前在 Node.js 中是可用的。第二个则是执行组合模式的运行时环境。

Let’s take a look at a simple example. With the new Composer functionality, different functions can be invoked depending on the result of a previous function. The screenshot shows the new tool ‘fsh’ (functional programming shell), which displays the flow graphically.

现在我们来看一个简单的例子。使用新的 Composer 功能,我们可以根据前一个功能的返回结果来决定调用特定的下一功能。下面的屏幕截图展示了新工具“fsh”(函数式编程壳),它以图形的方式来显示流程。

这里写图片描述

扫描二维码关注公众号,回复: 2093771 查看本文章

The apps (compositions) can be defined via JSON, which is executed by a runtime component. In addition to ‘if’, many other composition methods are supported.

应用程序(组合模式)可以通过由运行时环境组件所执行的 JSON 来定义。除了 “if” 方式之外,目前还支持许多其他构图方法

这里写图片描述

What I really like is the second approach to defining apps, which I think is more natural for developers. While you can define apps as JSON configurations, you can also write Node.js code that uses the Composer SDK, and you can use constructs as variables, try/catch statements, loops, data forwarding, and much more.

我所喜欢的是第二种定义应用程序的方法,因为我认为这一方法对于开发者而言更为自然。您可以将应用程序定义为 JSON 配置,也可以编写使用 Composer SDK 的 Node.js 代码,并使用构造变量,try / catch语句,循环,数据转发等等。

这里写图片描述

The Node.js code is compiled into JSON, which is executed by the runtime. In order to handle the state of the apps, developers need to provision Redis datastores (see the documentation for details). The managed runtime, together with the datastore, allows hosting and running serverless apps.

To find out more, check out the quick start guide.

Node.js 代码会被编译成 JSON,并由运行时环境来执行。开发人员需要配置 Redis 数据存储以处理应用程序的状态(详情参阅:文档)。运行时环境与数据存储允许托管和运行无服务器式应用程序。

若想要了解更多信息,请查看快速入门指南

猜你喜欢

转载自blog.csdn.net/qq_16775897/article/details/79083619
今日推荐