入门 Serverless:如何实现 Hello World?

本文介绍了 Serverless 架构的概念,强调了它如何简化运维和降低成本。通过一个简单的云函数示例,展示了如何在腾讯云上创建和测试一个 Hello World 函数。文章还探讨了 Serverless 的优点,如弹性伸缩和按量付费,以及缺点,如冷启动和调试难度。最后,鼓励读者深入探索 Serverless 的潜力。
摘要由CSDN通过智能技术生成

近年来,IT 技术的更新迭代速度非常快,每个时间点都有典型的代表名词以及概念,就目前而言,人工智能领域中的机器学习、深度学习、强化学习等名词和概念就非常热,同时区块链、物联网等技术发展也是异常火热。

在云计算领域,有这样一个技术被众多云厂商认为是“风口项目”,甚至可以颠覆现有云计算中的某些格局,为此包括 AWS、谷歌以及腾讯云、阿里云等在内的云厂商,都为此投入了重大人力以及精力进行相关产品建设,它就是 Serverless 技术。

自 2006 年 8 月 9 日,Google 首席执行官埃里克·施密特(Eric Schmidt)在搜索引擎大会(SESSanJose2006)首次提出“云计算”(Cloud Computing)的概念之后,云计算的发展可以用日新月异这个词来形容。

入门Serverless:如何实现 Hello World?

在短短十几年的发展过程中,云计算也从 IaaS 到 PaaS,再到 SaaS,逐渐将去服务器化趋势表现得愈发明显。就目前的情况来看,全球各大 IT 企业,都在紧罗密布的部署自己的“云事业”,尤其是 Serverless 相关概念的推广和产品的推出以及项目的落地,包括 AWS、Google Cloud、Azure、阿里云、腾讯云、华为云等在内的云厂商,无一例外的向 Serverless 进军。或许云计算下一个阶段,可能就是 BaaS+FaaS+Others,即 Serverless,当然也可能这个阶段就是!

什么是 Serverless

Serverless 可以说是一种架构,一种云计算发展的产物,至于具体说什么是 Serverless,可能没有谁无法给一个明确的概念,如果非要给出一个概念,那或许可以参考 Martin Fowler 在《Serverless Architectures》中对 Serverless 这样定义:

Serverless was first used to describe applications that significantly or fully incorporate third-party, cloud-hosted applications and services, to manage server-side logic and state. These are typically “rich client” applications—think single-page web apps, or mobile apps—that use the vast ecosystem of cloud-accessible databases (e.g., Parse, Firebase), authentication services(e.g., Auth0, AWS Cognito), and so on. These types of services have been previously described as “(Mobile) Backend as a service", and I use “BaaS” as shorthand in the rest of this article. Serverless can also mean applications where server-side logic is still written by the application developer, but, unlike traditional architectures, it’s run in stateless compute containers that are event-triggered, ephemeral (may only last for one invocation), and fully managed by a third party. One way to think of this is “Functions as a Service” or “FaaS”.(Note: The original source for this name—a tweet by @marak—isno longer publicly available.) AWS Lambda is one of the most popular implementations of a Functions-as-a-Service platform at present, but there are many others, too.

当然这个描述貌似很长,读起来也有点干涩难懂。不过,大家可以简单粗暴的把 Serverless 认为是 BaaS + FaaS,如果用一张图来表示上面的描述,可以是:

入门Serverless:如何实现 Hello World?

说到这里,不同的人可能已经对 Serverless 有了不同的勾勒,但是可能普遍还有一个疑问,我怎么用 Serverless?向云服务器上传我项目?还是像一种框架,用来写代码?用了它我可以得到什么?性能的提升?效率的提高?成本的降低?

首先,我们以一个常见的 Web 服务为例:

入门Serverless:如何实现 Hello World?

在这个图中,服务器中可能涉及路由规则、鉴权逻辑以及其他各类

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值