In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Enterprise Serverless application is what kind of actual combat, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this to learn, I hope you can gain something.
Serverless 2020 : Trends and challenges
First, let's talk about trends for Serverless in 2020. I started working with Serverless about 3-4 years ago, and this year, I found the following characteristics, which I would divide into three parts:
First, for developers, Serverless greatly empowers developers through pay-as-you-go, flexible scaling features, allowing them to focus on implementing the business without having to consider the underlying resources.
Second, for more and more enterprises, starting in 2019, they gradually began to try, deeply use and even embrace Serverless. Because Serverless can significantly reduce costs and reduce operations. This is very attractive to enterprises, especially non-technology enterprises. And in 2020, we can already see more businesses implementing their business with Serverless.
Third, we can see that cloud services and Serverless are becoming more and more closely integrated. BaaS itself is an important part of Serverless. So in 2020, more and more cloud services are being delivered via Serverless. For example, PG SQL provides Serverless DB, Serverless HTTP, and Serverless AI services mentioned in the morning.
However, at the same time, we also found that with the development of these trends, we also faced many challenges, which were still discussed in three aspects:
For developers, how to provide a complete development, debugging and troubleshooting capabilities, and provide more powerful scalability, is very critical. That is, ecological construction.
For enterprises, the problems they face are more detailed, and many concepts will encounter many practical problems in the practice of industrialization. Including the division of permissions, resource management, CI/CD and other solutions, how to seamlessly adapt to the enterprise architecture?
Finally, for the cloud, the combination is more and more close, but in order to ensure universality and universality, cloud products themselves will have more complex configurations, and the direct combination of cloud resources needs to bring relatively large learning costs, which also brings many challenges to enterprises.
Serverless Typical scenarios
Well, in the practice of enterprises, we also found that Serverless is very good at supporting several typical scenarios. Here, we also hope to share with you:
The first is Serverless SSR, which is a front-end scenario. The background is because CSR is client-side rendering, requiring browser-side execution of js files to get interactive pages. However, the disadvantage is that SEO is not friendly enough, and the performance of the first screen is insufficient. However, because SSR involves the server side, it needs to consider the expansion and contraction of node server capacity, operation and maintenance, etc., which makes many developers discouraged. But Serverless SSR can support this scenario well.
The second is to combine gateway + function to provide a common RESTful platform, which is a typical scenario used by 70% of users in a Serverless survey conducted 19 years ago. That is to say, Serverless of front-end and back-end resources, providing the ability to add, delete and query.
Finally, Serverless's full-stack app is also very marketable. By providing front-end, back-end, and database side. The combination of different components can perfectly support the deployment of full-stack applications without losing flexibility, and can be well separated from the front and back ends.
Deploy enterprise-class Serverless applications
Let's talk about a few requirements for deploying enterprise applications. Some of the experiences here are in the actual cloud process, customer feedback, and mentioned a lot of problems. It is also the problem that we actually solve when we help customers look at the problem together.
For example, one of our customers wants All in Serverless, and they have all encountered these problems, so we can look at how to solve them together.
There are several features to consider when we help enterprise customers deploy Serverless applications:
rights management
Division of resources and environment
Operation and maintenance, troubleshooting capability
CI/CD
Next, let's take a look at how enterprise customers solve these problems in the cloud process:
rights management
Currently, in large enterprises, users and user groups who need to use the main account + sub-account are divided into permissions. But how to segregate permissions between subaccounts and deploy resources more securely has always been a challenge. To ensure isolation and fine-grained control between child accounts, the Serverless Framework development platform supports obtaining corresponding permissions by specifying configuration roles in the serverless.yml file. At the same time, roles that support different O & M configurations can only be invoked by a certain sub-account, thus ensuring strict isolation.
Resource/Environment Division
With the growth of resources in the cloud process of enterprise customer Serverless architecture, it is inevitable that resource management difficulties will arise, and problems such as effective division of resources and isolation of environment will be required. So, how does Tencent Cloud Serverless Framework solve this problem?
This is mainly through flexible references to several fields such as stage, app and org in the yaml configuration, and provides out-of-the-box resource management views in the console, thus effectively isolating the underlying resources in different environments.
For example, in the corresponding yaml configuration, the stage field can read the configuration from.env; in addition, the corresponding resource name can be dynamically named in the way of ${app}-${stage}. This creates identically configured, isolated resources for different environments.
Operation and maintenance/troubleshooting
Operation and troubleshooting has always been a problem that customers feedback a lot in Serverless architecture, mainly focusing on the following two aspects:
Lack of application-level monitoring overview, high configuration threshold;
The link is long, opaque, and difficult to troubleshoot.
Tencent Serverless Framework provides out-of-the-box application-level monitoring view, combined with advanced log query function, which can effectively reduce the learning cost of configuration and quickly troubleshoot positioning problems.
CI/CD
For enterprise customers, access to automated CI/CD processes is necessary, mainly with the following advantages:
Reduce duplication and improve publishing efficiency
Reduce risk and avoid manual failures
Process transparency, adequate verification and testing
In response to the demand of enterprise customers to connect CI/CD, Serverless Framework not only supports the connection of open source CI/CD products, such as Jenkins, Github Actions, etc., but also supports one-click connection with Coding products, thus providing CI/CD solutions with "0" configuration for Serverless applications to automate the process of building and deploying.
Practical: Rapid deployment of Next. js-based Serverless SSR applications
Finally, through the actual combat of a Serverless SSR, demonstrate the rapid deployment of an SSR application, and provide dynamic and static separation (static resource hosting to object storage), providing out-of-the-box application level monitoring capabilities. Thus, perfect scaffolding capability is realized, and it is convenient to get through and expand for authority management, gray scale and CICD.
operational scenario
Tencent Cloud (Cloud) Next.js component uses Tencent Serverless Framework, based on Serverless services on cloud (such as API gateway, cloud function, etc.), to achieve "0" configuration, convenient development, and rapid deployment of web applications using Next.js framework. Next.js component supports rich configuration expansion, providing development/hosting capabilities for web application projects that are convenient, practical, and low in development cost.
Next.js Features:
Pay-as-you-go: charges are based on usage requested, and no charges are made when there are no requests.
"0" configuration: only need to care about the project code, then deploy, Serverless Framework will take care of all configuration.
Fast deployment: Deploy your entire app in seconds.
Real-time log: View business status through real-time log output, making it easy to develop applications directly in the cloud.
Cloud debugging: Project debugging can be done directly in the cloud, thus avoiding differences in local environments.
Easy collaboration: status information and deployment logs from the cloud console facilitate multiplayer collaborative development.
prerequisite
Node.js is installed (see Node.js installation guide).
Create a Next.js project locally and initialize:
$ mkdir serverless-next && cd serverless-next$ npm init next-app src Operation Step 1. installation
Install Serverless CLI globally via npm
$ npm install -g serverless2. configured
Create the serverless.yml file in the project root directory (serverless-next in this case):
$ touch serverless.yml
Configure serverless.yml as follows:
# serverless.ymlcomponent: nextjs # (required) Component name, here nextjsname: nextjsDemo # (required) Instance name org: orgDemo # (optional) Used to record organization information, default value is your Tencent Cloud (Cloud) account appidapp: appDemo # (optional) The next.js application name stage: dev # (optional) Used to distinguish environment information, default value is devinputs: src: src: ./ src exclude: - .env functionName: nextjsDemo region: ap-shanghai runtime: Nodejs10.15 apigatewayConf: protocols: - http - https environment: release
See more configuration and description>>
3. deployment
3.1 Building static resources
Go to the next project directory and build static resources:
$ cd src && npm run build
3.2 Deployment to the Cloud
Go back to the project root directory where the serverless.yml file is located and run the following command to deploy:
$ sls deployserverless ⚡ frameworkAction: "deploy" - Stage: "dev" - App: "appDemo" - Instance: "nextjsDemo"region: ap-shanghaiapigw: serviceId: service-xxxxxx subDomain: service-xxxxxx-10000000.sh.apigw.tencentcs.com environment: release url: https://service-xxxxxx-10000000.sh.apigw.tencentcs.com/release/scf: functionName: nextjsDemo runtime: Nodejs10.15 namespace: default59s › nextjsDemo › Success
Authentication is required during deployment. If your account is not logged in or registered with Tencent Cloud, you can directly authorize login and registration through the QR code in the WeChat scan command line.
If you want to see more information about the deployment process, you can view real-time log information about the deployment process using the sls deploy --debug command (sls is short for serverless command).
4. development and debugging
Once the Next.js application is deployed, the project can be redeveloped by developing debugging capabilities to develop a production application. After modifying and updating code locally, you don't need to run serverless deploy every time to deploy repeatedly. You can detect and automatically upload changes to native code directly via serverless dev. You can turn on development debugging by running serverless dev in the directory where the serverless.yml file is located. serverless dev also supports real-time output of cloud logs. After each deployment, you can access the project and output the call log in real time on the command line, which is convenient for viewing business conditions and troubleshooting.
In addition, we found through pressure testing that the performance of this architecture is equal to that of self-built node server, and even has more advantages in response time; and in terms of price calculation, based on Serverless Auto Scaling, pay-as-you-go features, it has a very significant advantage.
5. View deployment status
In the directory where the serverless.yml file is located, view the deployment status by issuing the following command:
$ serverless infoserverless ⚡ frameworkLast Action: ifo (a few seconds ago)Deployments: 21Status: activeregion: ap-shanghaiapigw: serviceId: service-xxxxxx subDomain: service-xxxxxx-10000000.sh.apigw.tencentcs.com environment: release url: https://service-xxxxxx-10000000.sh.apigw.tencentcs.com/release/scf: functionName: nextjsDemo runtime: Nodejs10.15 namespace: defaultnextjsDemo › Info successfully loaded
Finally, I believe the era of Serverless has arrived, empowering developers, helping enterprises go cloud, and redefining the concept of cloud!
Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.