Suggestions about serverless services

Through fast, flexible and huge elastic scaling, the serverless architecture can well solve the performance bottleneck of key functions, but it is not perfect: not only need to modify the design to adapt to it, adjust the familiar programming model, but also solve Issues such as planning budget, security, etc. But in general, it provides another choice for applications on the cloud-and has an irresistible temptation: greatly simplifying the entire process of applications from development to deployment and maintenance. The development of information technology in different fields is not the same. Admittedly, this has always been the case, because the viable solutions people find for the problems of the day often predate the problems themselves.

Through fast, flexible and huge elastic scaling, the serverless architecture can well solve the performance bottleneck of key functions, but it is not perfect: not only need to modify the design to adapt to it, adjust the familiar programming model, but also solve Issues such as planning budget, security, etc. But in general, it provides another choice for applications on the cloud-and has an irresistible temptation: greatly simplifying the entire process of applications from development to deployment and maintenance.

Simplifying the entire process of writing code and deploying applications is every developer's dream, and serverless architecture (Serverless) is just such a solution. When adopting this architecture, you need to consider its limitations, cost issues, and security issues .

The development of information technology in different fields is not the same. Admittedly, this has always been the case, because the viable solutions people find for the problems of the day often predate the problems themselves. Compared with the slow progress of technologies such as virtualization and cloud computing, programming languages ​​have almost stood still for a decade. It was not until the emergence of a new round of programming languages ​​​​and methods such as Python, Ruby, Node, and Swift that this situation was broken. These two fields may seem unrelated, yet we are about to see both co-evolve and blossom together.

This new combined field is serverless computing (Serverless). The easy-to-deploy collection of container instances, the ubiquity of external services based on REST APIs, and the ease of implementing new programming languages ​​for REST APIs make providing interfaces with REST APIs an easy and viable option. These technologies combine to create a whole new form of computing. We are already familiar with many aspects of this new form of programming (such as how to design and implement REST APIs, how to design and implement microservices), but there are still some aspects that are not well-known.

Suggestions for Serverless Services Suggestions for Serverless Services

Learned from Node.js

      My first Node.js program is not much different from most people's - set up the listening port and path, write the code to handle the corresponding execution and exit logic, and then use the browser to access the corresponding URI. After implementing the basic functionality, it was natural for me to further improve the application by taking advantage of Node's concurrent execution and other new advantages.

     But what this application provides is not a REST API, it simply responds to HTML pages containing different content according to different request content. After combining with REST, the Node application becomes a computing node. What remains unchanged is that when a request is received, it executes logic and then exits. At the same time, as part of the infrastructure, it will keep listening on a specific port.

infrastructure

However, in order to implement a simple but complete and runnable Node application (or Python / Djang / Java / Spring / RoR, etc.), network configuration, firewall configuration, operating system configuration and tuning, storage configuration, and if you use After installing the Web Application Firewall (WAF: Web Application Firewall), you also need to configure the WAF. Although, DevOps can make all of this a little easier, but imagine if you didn't have to do all this extra configuration at all?

serverless architecture

     In response to this problem, more and more companies continue to propose solutions. They think about whether it is possible for developers to write code, deploy applications, and easily get those applications when they need them, without any extra work when they are not needed, and scale on demand ? Can even configuration like a WAF be automated and application access limited to the correct subset of people/machines? What if deploying an app was really as easy as uploading a zip file, or writing code in an editor and hitting "deploy"? Finally, if access to databases and storage is pre-configured, how is this configuration included?

     This is undoubtedly a huge attraction for developers. After writing the code, it is the dream of many developers to deploy it without the seemingly necessary configuration (whether it is a physical environment, a virtual environment or a cloud environment). This can't help but remind people of some real-world examples. The first thing to bear the brunt is to deal with the performance bottleneck during the peak period. Say you have a perfectly functioning online order system, and during peak sales periods (like Black Friday), the system often crashes because it takes too long to verify shipping addresses.

Wouldn't it be great if you had a serverless function that just returned whether the entered address was valid, so you could hand off address validation to it? What's more, this feature allows rapid expansion to almost unlimited capacity (of course, network bandwidth still needs to be considered)! Now, this bottleneck is no longer a problem, you only pay for the computing resources (CPU time) actually used by this function. This means that the more you call, the more you pay, but most of the time, the fee is small. You only pay for the computing resources you actually use.

Wouldn't it be nice if all of this could be done on your site or in the cloud for an affordable price! There are already such products (Microsoft Functions, AWS Lambda, and nanoscale.io, etc.) that provide all of the above.

not rainbow after rain

      Serverless computing isn't perfect, either. When choosing a supplier, things to look out for include:

  1. Tool support . It has to support your development tools, especially CI/CD/ARA support is crucial. If you can't integrate serverless computing into your existing development environment and overall pipeline, then it's not good enough.
  2. Billing and charging methods . Never forget that these service providers have the same goal as your business to make money. Make sure you understand that the money they make goes out of your budget. All on-demand resources have some added factor as it relies on an unpredictable customer base and their vagaries of usage. But be aware of what you will be charged, and what rights the provider reserves to change billing methods.
  3. security features . Separating a large amount of code from your core application and putting it in the cloud may require a large investment in security and writing some additional code. Make sure your provider can either help with the above, or allow you to keep your code behind firewalls and WAFs.
  4. your overall architecture . While our examples above do a good job of demonstrating the "low hanging fruit" (the low hanging fruit), slightly more complex cases can run into issues such as data access, data security, cost issues, and even high availability. Make sure your team has delved into how to implement serverless computing architectures and has a good grasp of this programming model.

build the right app

In the future, some applications will be fully serverless, especially for applications that are more cost-effective than using cloud instances. Even without such applications, it becomes more cost-effective to allocate as few resources as possible on the infrastructure. At the same time, use serverless computing as a solution to solve the performance bottleneck caused by various relatively independent functions, or to test whether the capacity of the application can be increased without increasing the infrastructure budget. In general, in the field of information technology, serverless architecture is undoubtedly one of the solutions to how to correctly choose the architecture to achieve business goals.

related articles:

About the author: Hu Yingming, senior engineer of Trend Micro, translator of DockOne community

The article comes from the WeChat public account: Docker

 

Guess you like

Origin blog.csdn.net/yaxuan88521/article/details/132434568