The server revolution of 2020
Did you know that graphite documents, Twitter, Mango TV that we use every day all use Serverless technology in whole or in part?
Actually zhihu is also using leanCloud.
Technology has made it possible to build a high-availability server comparable to a big factory without spending a dime and hiring a strong back-end team.
1. Graphite document case
Graphite documentation is not supported by a normal server or microservice architecture. It grows in the cloud through the Serverless architecture.
As an event-driven fully managed computing service developed earlier in China, Ali Cloud Function Compute has been implemented by many clients such as Marina Technology, Weibo, Mango TV, Graphite Document, etc. Let’s take a look at how some of China’s leading Internet companies are using functional computing to boost their business.
The needs of customers
When multiple graphite document users work together to edit the same document/form, the same content may be modified and conflict may occur. Graphite documentation needs to implement a set of services to handle document editing conflicts in real time and smooth peak loads at a reasonable cost.
The solution
Computationally intensive logic such as real-time document collaboration is implemented as functions that are triggered by HTTP requests.
Use effect
By using the function to calculate the resource scaling capability at the millisecond level, the problem of computing resource expansion with sudden increase in morning and evening peak usage is solved, and the server cost is saved by 58%. Since CPU – intensive computing load balancing is no longer considered, the development efficiency and process stability are greatly improved.
2. Nodersurvey Annual report
Nodersurvey is the leading annual Node trend report by companies like Alibaba and Tencent.
nodersurvey.github.io/reporters/
In the future keywords, Serverless becomes the most concerned topic.
What is Serverless
Server side service is to provide us with stable and reliable service,
In addition to reduce costs, improve efficiency.
Such as:
- Dynamic expansion – Turn off unnecessary machines in time
- Reduce costs – As few people as possible don’t buy what you can rent
In order to achieve this goal, the purpose of the backend is constantly evolving.
1. Evolution of Internet architecture
The evolution of the Internet architecture can be divided into three phases:
- Monomer era
- The age of microservices
- Serverless
1.1 Monomer Age
It means that all the applications are installed on one server. For example, the earliest netease and Sohu may have started from a Unix host.
This is a bit like the original arcade games from the hardware + software + operating system are all made by the same company.
1.2 Micro-service era
Microservice architecture is an architectural concept that aims to decouple solutions by decomposing functionality into discrete services. Its main function is to decompose functions into discrete services, so as to reduce the coupling of the system and provide more flexible service support.
In a nutshell, it’s about taking complex things apart. You need a big team.
This is a bit like Tencent’s King of Glory team. You can see the size of their organization from the size of their annual bonus
1.3 Serverless
Serverless architecture does not mean that a server is not required, but rather that third-party cloud computing providers provide developers with required functionality, such as databases, messaging, and authentication, as a service. The core idea is to let developers focus on building and running applications without having to manage servers.
This is the equivalent of developing a game where we just focus on the procedural logic. Everything else is outsourced.
Reminds me of the blue Hole days when 3D models, game engines, were basically bought from the game market and assembled. The organization of the entire blue hole is not large.
2. Cloud service architecture evolution
In order to achieve automatic scaling of our service resources, the vast majority of applications are currently completed using cloud technology.
! [image-20201114184313929](/Users/xiaran/Library/Application Support/typora-user-images/image-20201114184313929.png)
You know what? Less than 30 percent of the backend programmers actually write code so what do they do the rest of the time?
With the advent of the era of cloud computing, traditional IT architecture and operation and maintenance have brought many new technologies, including virtual machines, containers, and microservices.
These technologies serve the following purposes:
- To reduce the cost
- To improve efficiency
How can this be achieved? The answer should be to minimize operations and IT architecture for business users and focus on building their own business applications,
The cloud will do the rest.
Front-end development + back-end development => Cloud development + end development
2.1 BareMetal Server
It can be regarded as the exclusive physical server lease service. So there is no need to rent the computer room, pull the cable, install the server.
2.2 Virtual Machines Virtual machine services
Replacing a physical machine with a virtual machine largely eliminates the need to install an operating system and basic software.
We just need to rent the virtual machine.
2.3 Container Container Deployment
Equivalent to lightweight virtual machine, mainly represented by Docker technology.
2.4 Serverless
Serverless architecture does not mean that a server is not required, but rather that third-party cloud computing providers provide developers with required functionality, such as databases, messaging, and authentication, as a service. The core idea is to let developers focus on building and running applications without having to manage servers.
Simply upload the code.
The final conclusion is that
BareMetal | Virtual machines | Container | Serverless | ||
---|---|---|---|---|---|
function | Business code | â | â | â | â |
Layer | eggjs/spring | â | â | â | â |
The runtime | Node/Java/Python | â | â | â | |
infrastructure | Kubeless | â | â | ||
Hardware devices | Network, hardware | â |
You can see that the best solution so far is Serverless.
Serverless architecture
Some people say that,
Programming = algorithm + data structure
So,
Application = logic + storage,
We can divide applications into stateless business logic and stateful services.
Serverless(application) = Faas (Business logic) + Baas (state retention)
If we want to build a complete service on Top of Serverless, we need to split the application into these two parts.
Let’s take a small program as an example
1. Faas
Faas stands for Function as a service, which we usually call Function computation, or Function running service. The idea is to package up and resell computing on the cloud. All you need is the user to upload the function.
The characteristics of
-
Stateless Stateless
-
Code + dependency configuration
case
-
Amazon AWS Lamabda
-
Google Cloud Functions
-
Aliyun FC
-
Tencent Cloud SCF – Serverless Cloud Function serverless.cloud.tencent.com/start?c=ft
You also need a gateway if you want functions to be called via Http requests
- AWS API gateway
2. Baas
Bass Backend as a Service means that we can rent remote Backend services without writing them ourselves. Most of these services are stateful services, such as storage services like MongoDB and authentication services.
The characteristics of
- A stateful
- Provide service apis
Service providers
- LeanCloud
Copy the code
- Firebase
4. Application scenarios
Finally, let’s talk about the serverless application scenario.
First of all, I think all friends who want to start a business can consider directly putting their projects on Serverless.
1. Entrepreneurial projects
With a toC project, you won’t have a large number of users until you get financing. Timely emergent scenarios can also be easily dynamically expanded. The key is to effectively save money for back-end staff. Finding a back-end team that can fully build a microservices architecture is a huge number. Moreover, whether the team is reliable and efficient is also a problem, which brings many uncertain factors to the promotion of the project.
Wait till we have an investment.
You don’t even have to pay for it
Link in the
Cloud.tencent.com/act/pro/ser…
2. Event request scenario
- Custom image
- The Internet of things
- Burial site records
- Regular script
3. Scenario with high O&M costs
- Page screenshot – Pupteer screenshot + SSR rendering
- Big data computing
4. Traffic burst scenario
- Activity and promotion
- Regular scene (takeout has obvious peaks and valleys every day)
Young people should speak martial virtue!!give a like
,Focus on
,collection
Arrange it all!!
- This is element3, the open source project of our Flower Mountain front end team
- A front-end component library that supports VUE3
đ issue 7 | all things can be Serverless technology projects