Request processing method and apparatus, electronic device, and computer storage medium
AssigneeBeijing Baidu Netcom Science Technology Co., Ltd.
InventorsYan Gao, Yixing Sun
Life of this patent
Estimating the term…
Abstract
A request processing method and apparatus, an electronic device, and a computer storage medium are provided, which are related to the technical field of cloud computing. The request processing method includes: receiving a content delivery network (CDN) request; acquiring a dynamic code corresponding to the CDN request, wherein the dynamic code is a pre-configured code; compiling the dynamic code in real time to obtain a compiled code; and executing the compiled code. The request processing method provided in an embodiment of the present application may improve the flexibility of request processing of a CND system, and has no concurrency limitation.
Claims7
A request processing method, comprising:
- receiving a content delivery network (CDN) request;
- acquiring a dynamic code corresponding to the CDN request, wherein the dynamic code is a pre-configured code used for deployment of the request and which can be changed anytime during the deployment by a user of the CDN;
- compiling the dynamic code in real time to obtain a compiled code;
- executing the compiled code;
- detecting an occupancy rate of resources used to execute the compiled code;
- and
- in a case that the occupancy rate exceeds a set threshold value, terminating execution of the compiled code and returning an abnormal state code, or
- in a case that the occupancy rate does not exceed the set threshold value, continuing execution of the compiled code until the execution is completed;
- wherein the acquiring the dynamic code corresponding to the CDN request comprises:
- acquiring the dynamic code from a CDN edge node inside a CDN edge system corresponding to domain name information in the CDN request;
- wherein the compiling the dynamic code in real time to obtain the compiled code comprises:
- determining whether the dynamic code comprises an unsafe feature by performing static detection on the dynamic code;
- and
- performing dynamic calculation on the dynamic code to generate the compiled code in a case that a result of the static detection does not comprise the unsafe feature.
A request processing apparatus, comprising:
- at least one processor;
- and
- a memory communicatively connected to the at least one processor, wherein
- the memory stores instructions executable by the at least one processor, the instructions are executed by the at least one processor to enable the at least one processor to:
- receive a content delivery network (CDN) request;
- acquire a dynamic code corresponding to the CDN request, wherein the dynamic code is a pre-configured code used for deployment of the request and which can be changed anytime during the deployment by a user of the CDN;
- compile the dynamic code in real time to obtain a compiled code;
- execute the compiled code;
- detect an occupancy rate of resources used to execute the compiled code;
- and
- in a case that the occupancy rate exceeds a set threshold value, terminate execution of the compiled code and return an abnormal state code, or
- in a case that the occupancy rate does not exceed the set threshold value, continue execution of the compiled code until the execution is completed;
- wherein the instructions are executed by the at least one processor to further enable the at least one processor to:
- acquire the dynamic code from a CDN edge node inside a CDN edge system corresponding to domain name information in the CDN request;
- wherein the instructions are executed by the at least one processor to further enable the at least one processor to:
- determine whether the dynamic code comprises an unsafe feature by performing static detection on the dynamic code;
- and
- perform dynamic calculation on the dynamic code to generate the compiled code in a case that a result of the static detection does not comprise the unsafe feature.
A non-transitory computer readable storage medium storing computer instructions, wherein the computer instructions cause a computer to:
- receive a content delivery network (CDN) request;
- acquire a dynamic code corresponding to the CDN request, wherein the dynamic code is a pre-configured code used for deployment of the request and which can be changed anytime during the deployment by a user of the CDN;
- compile the dynamic code in real time to obtain a compiled code;
- execute the compiled code;
- detect an occupancy rate of resources used to execute the compiled code;
- and
- in a case that the occupancy rate exceeds a set threshold value, terminate execution of the compiled code and return an abnormal state code, or
- in a case that the occupancy rate does not exceed the set threshold value, continue execution of the compiled code until the execution is completed;
- wherein the computer instructions cause a computer to further:
- acquire the dynamic code from a CDN edge node inside a CDN edge system corresponding to domain name information in the CDN request;
- wherein the computer instructions cause a computer to further:
- determine whether the dynamic code comprises an unsafe feature by performing static detection on the dynamic code;
- and
- perform dynamic calculation on the dynamic code to generate the compiled code in a case that a result of the static detection does not comprise the unsafe feature.
Dependencies are inferred from the claim text.