The author source | | Harry Chen Serverless public number

This article aims to introduce the difficulties of Serverless in applications today, and help users to avoid some problems and know the direction in advance.

The wave

Since Serverless emerged in 2014, there have been countless warriors exploring the way ahead. Alibaba, Tencent, Amazon, Baidu, Huawei and so on have continuously launched their own cloud services, hoping to share a share in this wave. In addition to the original Amazon, the domestic war has been tepid, in addition to seizing the market, but also constantly seeking new solutions, hoping that one day, with new solutions to attract a large number of users.

From the global point of view, the overall trend of Serverless is quite good, especially the promotion of Tencent Ali in China, continuous upsurge. Compared with other keywords, we find that Serverless and microservices are growing continuously. Generally speaking, lightweight, distributed and maintainable is a trend, which is in line with the current coding habits.

▲ Data from Google Trends

Ali Cloud by the original initial advantages, and the first to support the reservation/volume instances of mixed scaling and pre-paid model of these capabilities, constantly expand the user base, and at the same time in the annual Double 11 double 12 activities of the application, the overall stability of a step up. At the same time, in the Trusted Cloud Conference held in July 2020, Ali Cloud Function Computing FC passed the trusted cloud function as a service certification in the first batch with full marks in all 21 tests.

▲ Pictures from Aliyun 2020 Online Summit

Tencent through the existing small program system, combined with the small program cloud development, and Serverless binding, so that users grow up quickly, this move is just right, can let many developers seamlessly enjoy the ability of the cloud, both convenient and can expand influence.

▲ Pictures from Tencent Cloud

In a year of marketing and promotion, people constantly try and use, stirring up a lot of water in China, some of them will migrate their business to Serverless system as a whole, and some timid, watching from a distance.

Fortunately, with the continuous promotion of large companies, such as Ali Taobao, Feizu, Autonavi, Kaola, JINGdong, Didi, Byte and so on, more and more enterprises begin to gradually try to migrate their business to Serverless environment. On the one hand, it sets a good example for others who are watching, but also promotes the positive cycle of the whole ecology.

Aside from these large enterprises, small and medium-sized enterprises, individual developers are still the majority of the field of science and technology, except for those who wait and see, the rest, are eager to try, want to use but can not touch the crowd, now each cloud manufacturer is making efforts to fight for, it is also this part of the people. And the biggest existing problem is also this part of the user.

trouble

A long time ago, the software we developed changed from C/S and MVC architecture to SOA, from single architecture, to servitization, and then to more fine-grained microservitization. At the beginning of application development, it was designed to cope with high concurrency, fault tolerance and other features unique to the business, requiring high performance and scalability.

Mythical Man-month Fred Brooks wrote about this decades ago (1975) in The Mythical Man-month.

So is Serverless the silver bullet between software development complexity and efficiency?

From CNCF Cloud Native Interactive Landscape, we can find that there are many enterprises engaged in infrastructure (hosting platform), among which ali Cloud, Tencent, Huawei and Amazon are known. The Framework and the upper level of the business tool scene is not very much, aside from aws tools, only Python, JavaScript and Java tools, The well-known Serverless Framework plus Spring Cloud Fucntion basically covers a large part of the world’s scenarios.

For development languages like Python and JavaScript, which inherently support Lambda, FaaS is a perfect match. The Serverless Framework research report also illustrates this very well. NodeJS and Python are the top two languages used by FaaS.

▲ The picture comes from Ali Cloud technology blog

As we know, Java applications are slow to start because of the large memory footprint of the JVM, which is not suitable for the FaaS scenario, and this is why Java usage is low.

So language fitness is a very big part of the overall Serverless architecture. This leads to one of the biggest problems: the audience and base. As the front end, most of the scenes are displayed and rendered in the front page, dealing with JavaScripts/HTML/CSS, and rarely involving the server side. The only intersection is the Node.js developer, which has good output in the front and back end fields.

And JavaScript in the dominant trend of various cloud platforms, whether in use, it is this part of the crowd. This group belongs to the front end and is differentiated from the front end, but compared with the traditional back end, it is still difficult to increase rapidly.

How to meet the needs of the original has been satisfied as much as possible, but also to expand the use of the crowd, harvest the market, this is the cloud platform competing for the place, is also the current dilemma.

choice

In order to solve the current crowd problem, only to keep trying, at least the domestic cloud manufacturers have been breaking through in this respect. What we can see, this year, has been doing:

  • Meet the needs of users at different levels and in different scenarios;
  • Try new technologies to break existing language dilemmas.

The Serverless product on Ali Cloud is to help tens of thousands of enterprise customers such as Weibo, graphite documents, learn with who, Timing, Unilever and so on successfully land Serverless, covering front-end full stack, small program, new retail, game interactive entertainment, online education and other application scenarios of the whole industry. It can be seen that in terms of business landing, Ali Cloud is still very fast.

In addition to functional calculation FC and SAE two products, Ali Cloud Serverless product matrix also includes Serverless Kubernetes oriented to container orchestration, ECI oriented to container instances, etc. They constitute the most complete Serverless product family of any cloud vendor today.

Basically, Ali Cloud has opened up the way of migrating various existing scenarios to Serverless, including application migration, containerization, functionalization and other aspects. At the same time, it also attracts customers with practical business value (money) from the perspective of flexibility. Obviously, Ali Cloud has recognized the current shackles, trying to break through different scenes, different languages.

In contrast, Tencent cloud, at this level, is more inclined to experience, one-stop, rapid deployment, so that users at a very low cost, experience as viscosity to attract users. The following ads are often seen when we visit public accounts/websites.

This year, we received a lot of training notifications from Tencent Cloud, from Serverless Framework integration at the beginning of the year to Serverless Days later, and CloudBase Serverless cloud integration product solutions and so on.

From the container layer Custom Runtime solution, to the application layer platform solution, Tencent Cloud also has a one-to-one correspondence, even at the end of last year, also released the first Serverless Mysql database in China (interesting).

All of these changes are derived from the needs of different user levels. They are all competing for a user group and the future commercial system.

As cloud computing continues to deepen its influence across all sectors, the changing needs of each sector are also forcing cloud computing to optimize itself. On the user side, apart from the determined enterprise, there are more fleece fans who come in for free (don’t look down on them, they will do anything strange for free), and users who want to learn and deploy personal services.

Cloud platforms want to attract the latter. The problem for this group remains unresolved. We will find that the existing cloud platform is still in a stage of attracting users and letting users explore by themselves, and there is no comparison or difference between Serverless and traditional.

jealousy

Last year, Ali Double promote with Serverless to carry a large volume of traffic, there are other companies have applied Serverless to business cases, these are actually established in a strong enough security system under the practice, how to apply to their own or enterprise business, is the real difficulty.

What is simple for an enterprise, such as requesting several virtual machines, can be very difficult for an individual developer. Big companies have all kinds of caching services and all kinds of back-pocket capabilities, while small companies and individual developers can just listen and laugh. Before, Netflix implemented business microservitization, dismantled a lot of interface models, and made enough distributed architecture and management system, which not all companies could learn and implement. Only experience has settled.

For users, in these complicated publicity, it is actually quite difficult to choose the most suitable scheme for them. They usually get familiar with it first and then start with the platform they know better. There are several questions at the core:

  • I have an application, how do I use Serverless?
  • I have an application. Do I need to be a function to access Serverless?
  • How can my business remain stable after joining Serverless?
  • Most importantly, Serverless, how do I pay for my business?

For example, the traditional application how to Serverless, the existing platform provides the migration of existing business Serverless scheme, the basic use of Custom Runtime scheme, through HTTP protocol communication to complete the response processing of events (that is, to develop a specific port, Do the forwarding scheme from inside the container).

▲ Image from Ali Cloud Custom Runtime solution

Migrating applications to the Serverless platform in this way is now the dominant approach and is recommended for cloud platforms. But do so, whether really do not have sequela?

There is definitely an answer, the most obvious being boot time. The cold start time of the container + the start time of the business, if it is a function, can basically start up and provide the service in 2s, while the application contains too much logic, resulting in the start time can be as long as 2-10s, which is the average estimated time for node.js business, if it is other languages, the time will be significantly increased.

The overall accessibility of functions is limited to a small range, and application startup generally takes longer.

As a result, the overall app experience is less acceptable if it is purely elastic. Of course, we can solve the cold start problem with reserved mode (fixed containers), but you can do the price calculation and see if ECS is cheaper.

The second problem is the package size. The existing functions are deployed, and the cloud platform is generally controlled at 50M. This is not only because of the storage problem, but also because the function will download the package when starting up, decompress it, and in order to speed up the startup and reduce the network overhead, the package must be as small as possible. The package size of an application, if it’s a pure Node.js application, is fine. Resources can get stuck in 100 megabytes, but with front-end resources (traditional server rendering, etc.), the package size can go up to a few hundred megabytes. The front-end may not care about the size of the imported package (after all, webPack packs are automatically removed). But this can be a major pitfall for getting up to a Serverless environment.

The third problem is the development mode. Many business code writing methods need to be changed due to the limitations of Serverless itself, which not only requires an understanding of the operating mechanism of the Serverless environment, but also requires corresponding solutions. For example, file upload, traditional application can complete form upload, but under the interception of Serverless gateway, it needs to be done in different ways, which makes the code of traditional application development and Serverless application development not unified, resulting in some maintenance costs.

There are also fixed network environments that can lead to network isolation and inability to connect to specific services. Custom container environment, previous modification of Nginx to support specific protocols, routing and forwarding are not implemented. Even Serverless’s best elastic behavior, such as local caches, fixed IP proxies, and so on, can cause the code to differ from the original application.

With all the possible problems, could you simply migrate your business to Serverless?

Calm down. In our overall practice, Serverless does bring us benefits. Last month, a client told me that it used to cost thousands of yuan per month to use Ali Cloud ECS, but now it only costs 8 yuan per month to use Serverless (real scenario). It can be said that this attraction is very huge.

This is particularly attractive to individual users, especially students/Indies, who can deliver features at a very low price.

Although Serverless has some problems, it really saves money. As long as there is no state of business and no strict startup requirements (certain optimization can be made to reduce startup time), understanding the basic principles of Serverless can avoid the problems I described above.

Well, Serverless must be the best way to save money right now and the best partner for your wallet.

trend

Over the past year, we’ve seen the front end users split between those who want to move further towards cloud native, and those who want a fully configured approach that will reduce the chance of coding (nocode). The other side wants to evolve from the original application model and deploy it as a large, integrated application to reduce development collaboration costs.

For example, Serverless Framework, Tencent changed three different versions of YML last year to support pure function, scenario-oriented business.

▲ YML configuration for Serverless Framework

Tencent Yunyun development launched in the second half of the year also has a similar way, but the configuration has changed from YML to JSON, but the core has not changed too much.

{
  "envId": "fx",
  "framework": {
    "plugins": {
      "server": {
        "use": "@cloudbase/framework-plugin-node",
        "inputs": {
          "entry": "./api/index.js",
          "path": "/api",
          "name": "github-stats-api",
          "wrapExpress": true
        }
      },
      "pin": {
        "use": "@cloudbase/framework-plugin-node",
        "inputs": {
          "entry": "./api/pin.js",
          "path": "/api/pin",
          "name": "github-stats-pin",
          "wrapExpress": true
        }
      }
    }
  }
}
Copy the code

▲ Tencent cloud development of full configuration JSON

Ali Cloud’s template.yml has not changed much over the years.

However, Serverless Devs launched at the end of the year attracted a wave of attention, and gradually moved the center of the local tool chain to the supporting management platform. I think there will be different changes in the future.

Unlike Ali Cloud, which is sold separately, Tencent Cloud development comes up with a package sale method (function + storage + database resources) to meet users. This has a very big advantage in the development of small programs, tools + resources integration, Tencent has done very well.

As mentioned before, cloud vendors are gradually making up for their shortcomings, using different scenarios to do differentiated competition, which is what users are happy to see.

However, there is not much change in the user’s mind. Because the platform is well wrapped (beautiful), we find that the latter half (application development) gradually occupy the upper hand. No matter how to get started, the business is developed in the mode of application, with the idea of application development in development, deployment and debugging. You just treat the Serverless container as the original server, at best adding some restrictions on the original server, such as not being able to log in, etc.

From the choice of the scheme, we also found that the front end prefers to develop business in an integrated way (front and back end together), which makes the whole system deviate from the original idea very much.

But this is the situation inside Alibaba, and it has to be said that this is a retro trend (and probably a domestic one as well), and probably the one most accessible to developers for the future.

hope

In an earlier InfoQ article titled Serverless Applications Report 2019: Two-thirds of Landing Practices Succeed? According to the article, there are three most direct drivers for enterprises and developers to use Serverless:

  • First, “reducing operating costs” is the number one reason to adopt Serverless. With Serverless, there is no need to purchase server racks that are idle most of the time for potential traffic peaks.

  • Second, “automatic on-demand expansion”, after the adoption of Serverless, can be extended to the current usage at any time, eliminating accidents or seasonal traffic peak trouble;

  • Third, “no server maintenance”, because most developers in the enterprise are software engineers, not system administrators, so they are not good at software repair, protection and management, but after using Serverless, these work can be handed over to suppliers, they only need to focus on software development.

Every bit is attractive enough, but there is a sting and a sugar in this honey, and we’d better think about how best to use it before we use it.

It is hoped that the future Serverless form can be enough to meet the demands of business, whether it is functional state or application state, it can be endowed with more powerful scenes and capabilities. The original ability of Serverless domestic manufacturers can also lead the world and contribute to the technology industry.

This article is just a piece of advice. It is a personal opinion, not a personal choice of platform.

Serverless Ebook download

Book highlights:

  • Starting from the evolution of architecture, it introduces Serverless architecture and technology selection and construction of Serverless thinking.
  • Understand the operating principle of Serverless architecture popular in the industry;
  • Master 10 Serverless real cases, live learning and use.

Download link: developer.aliyun.com/topic/downl…