All Products
Search
Document Center

Function Compute (2.0):Lagou Education

Last Updated:Jan 18, 2024

This topic describes how to handle traffic surges during peak hours based on Function Compute, Object Storage Service (OSS), API Gateway, and Simple Log Service. In this topic, Lagou Education is used as an example.

Customer profile

Lagou Education is a sub-brand of Beijing Lagou Network Technology Co., Ltd., which a job-matching platform that focuses on Internet career opportunities. Backed by many high-quality Internet resources, Lagou publishes recruitment information in the industry to provide humanized, personalized, and professional information services for job seekers. It helps high-quality talents and outstanding enterprises meet each other. Lagou has a young team that loves the Internet. They are committed to building the most professional Internet recruitment platform.

Lagou Education provides a platform which is similar to a practical university to help Internet professionals communicate and improve their technical abilities. Lagou Education has developed a series of courses and services to provide learning opportunities for professionals in the Internet industry based on the experience of Lagou in the Internet talent service industry. Lagou Education has set up two learning modes, which are Columns and Training Camps. Courses in Lagou Education cover the R&D, product, design, operation, and marketing fields.

Pain points

Lagou Education offers programming courses as part of its education programs. The programming courses are supplemented with images, text, audio files, and video files. The most attractive feature of the programming courses is interactive learning. This feature allows students to acquire knowledge and master skills based on hands-on practices. At the core of the programming courses is an online system that can return execution results in real time after students type in code online. Users of Lagou Education expected that the online programming system has the following benefits:

  1. Support for multiple programming language runtimes: Lagou Education provides courses for a variety of programming languages and technical frameworks. Therefore, the system must be able to support the runtimes of multiple programming languages and extend the supported runtime languages in a quick and convenient way.

  2. Support for a large number of concurrent requests: Lagou Education gathers a large number of excellent teachers and students. Tens of thousands of students attend each course. Therefore, the online programming system must be able to handle massive concurrent requests at the customer level.

  3. High security: The online programming system must not break down or affect other business areas due to malicious code or poorly written code that might be submitted, such as those that contain endless loops.

Solution

image

Lagou Education integrates with Function Compute, a serverless service developed by Alibaba Cloud, to address the critical pain points of its system. Based on Function Compute, students need only to write code in one of the supported programming languages to implement execution logic and upload the code. Function Compute instances can also be triggered by HTTP requests or events to execute the logic and respond to the requests. In addition, Function Compute is seamlessly interconnected with other Alibaba Cloud services, including OSS, API Gateway, Simple Log Service, Message Service (MNS), and Tablestore. This helps Lagou Education build a system that can handle traffic surges during peak hours.

Benefits

  1. Support for multiple programming language runtimes: Function Compute supports Java, Python, Node.js, PHP, and .Net Core. It can also build the runtime of other languages by using custom containers, such as custom Go runtime, custom Ruby runtime, and custom PowerShell runtime.

  2. Elastic scaling and high availability: To support high concurrency in systems that are built on traditional servers, more machines are required. This method is not flexible to address traffic surges or traffic varies over time. This is because the startup speeds of servers are relatively slow. Function Compute eliminates the need for cold boot by using instances in provisioned mode and on-demand mode. An instance can start within milliseconds. Users can also configure only one instance to process concurrent requests. The instance can be scaled out to handle sudden traffic surges with ease.

  3. Thorough security protection mechanism: For Function Compute, security enjoys the highest priority in every aspect of the service and system design. Function Compute provides the same isolation protection level for programs as Elastic Compute Service (ECS). Function Compute runs on virtual machines, not in containers. In addition, Function Compute provides robust protection against distributed denial-of-service (DDoS) attacks and attacks on the network, data, and code.