CN116700998A - Application program interface management method, terminal device and storage medium - Google Patents
Application program interface management method, terminal device and storage medium Download PDFInfo
- Publication number
- CN116700998A CN116700998A CN202310976033.9A CN202310976033A CN116700998A CN 116700998 A CN116700998 A CN 116700998A CN 202310976033 A CN202310976033 A CN 202310976033A CN 116700998 A CN116700998 A CN 116700998A
- Authority
- CN
- China
- Prior art keywords
- container
- service
- resource configuration
- api
- memory
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000007726 management method Methods 0.000 title claims abstract description 13
- 238000013468 resource allocation Methods 0.000 claims abstract description 31
- 238000000034 method Methods 0.000 claims description 52
- 238000012360 testing method Methods 0.000 claims description 17
- 238000012508 change request Methods 0.000 claims description 9
- 238000004891 communication Methods 0.000 description 5
- 238000002955 isolation Methods 0.000 description 5
- 230000002159 abnormal effect Effects 0.000 description 3
- 239000008186 active pharmaceutical agent Substances 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 230000003139 buffering effect Effects 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5016—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5061—Partitioning or combining of resources
- G06F9/5077—Logical partitioning of resources; Management or configuration of virtualized resources
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45562—Creating, deleting, cloning virtual machine instances
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/50—Indexing scheme relating to G06F9/50
- G06F2209/5012—Processor sets
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/50—Indexing scheme relating to G06F9/50
- G06F2209/5013—Request control
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/50—Indexing scheme relating to G06F9/50
- G06F2209/503—Resource availability
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The application discloses a management method of an application program interface, a terminal device and a storage medium, wherein the management method of the application program interface comprises the following steps: receiving a resource allocation request of an API interface sent by a client, and acquiring a service grade identifier carried by the resource allocation request; determining a resource configuration parameter according to the service grade identifier, wherein the resource configuration parameter comprises a mirror image identifier, a container memory and a CPU core number; acquiring an image file corresponding to the image identifier, creating a container of the API interface conforming to the resource configuration parameter according to the image file, and deploying service resources of the API interface to the container; and when an access request of the API interface is received, scheduling the service resource of the API interface according to the access request. And deploying the service resources of the API interfaces through the container, and isolating the service resources of different API interfaces.
Description
Technical Field
The present application relates to the field of internet technologies, and in particular, to a method for managing an application program interface, a terminal device, and a storage medium.
Background
In the big data scenario, the data service is the last gateway in the big data processing link that is finally output to the business application, and is used to provide API (Application Programming Interface, application program interface) services for various businesses, and carries a great amount of data transmission pressure and risk. In the related API service management scheme, the API service is deployed in a cluster mode, however, in this mode, all APIs share one hardware resource, and when the hardware resource is abnormal, all API services are not available.
The foregoing is provided merely for the purpose of facilitating understanding of the technical solutions of the present application and is not intended to represent an admission that the foregoing is prior art.
Disclosure of Invention
The embodiment of the application aims to solve the technical problem that all API services are not available when hardware resources are abnormal due to the fact that in a related API service management scheme, an API service is deployed in a cluster mode, however, all APIs share one hardware resource in the mode.
In order to achieve the above object, an embodiment of the present application provides a method for managing an application program interface, where the method for managing an application program interface includes:
receiving a resource allocation request of an API interface sent by a client, and acquiring a service grade identifier carried by the resource allocation request;
determining a resource configuration parameter according to the service grade identifier, wherein the resource configuration parameter comprises a mirror image identifier, a container memory and a CPU core number;
acquiring an image file corresponding to the image identifier, creating a container of the API interface conforming to the resource configuration parameter according to the image file, and deploying service resources of the API interface to the container;
and when an access request of the API interface is received, scheduling the service resource of the API interface according to the access request.
Optionally, before the step of receiving the resource configuration request of the API interface sent by the client and obtaining the service class identifier carried by the resource configuration request, the method further includes:
when a resource configuration change request is detected, acquiring a service grade identifier and a resource configuration parameter corresponding to the resource configuration change request;
updating the resource configuration parameters to a resource configuration list according to the service grade identification;
the step of determining the resource configuration parameters according to the service level identifier comprises the following steps:
and acquiring the resource allocation list, and acquiring the resource allocation parameters from the resource allocation list according to the service grade identification.
Optionally, after the step of obtaining the resource configuration parameter from the resource configuration list, the service level identifier includes:
creating a target resource configuration list of the API interface according to the service grade identifier and the resource configuration parameter;
when a target resource configuration request of the API interface is received, acquiring a target resource configuration parameter corresponding to the target resource configuration request, and updating the target resource configuration parameter to the target resource configuration list;
and when a reconfiguration request of the API interface is received, creating a container conforming to the target resource configuration parameters according to the image file, and deploying service resources of the API interface to the container.
Optionally, the step of obtaining the image file corresponding to the image identifier, creating a container of the API interface according to the image file and the resource configuration parameter, and deploying the service resource of the API interface to the container includes:
acquiring the available memory of the current terminal equipment and the container memory of the container;
when the container memory is larger than the available memory, determining the minimum memory required by the API interface;
and when the minimum memory is smaller than the available memory, updating the container memory into the minimum memory, executing the mirror image file corresponding to the mirror image identifier, creating a container of the API interface according to the mirror image file, and deploying service resources of the API interface to the container.
Optionally, the step of determining the minimum memory required by the API interface when the container memory is greater than the available memory includes:
acquiring service resources of the API interface and deploying the service resources on the local of the terminal equipment;
testing all services of the API interface to obtain a test result of all the services, wherein the test result comprises a memory consumed by testing all the services of the API interface;
and determining the minimum memory required by the API according to the test result and the occupied memory of the service resource.
Optionally, the step of obtaining the image file corresponding to the image identifier, creating a container of the API interface according to the image file and the resource configuration parameter, and deploying a service resource of the API interface to the container includes:
updating the resource configuration parameters to the mirror image file;
starting the mirror image file, creating a container of the API interface according to the container memory, and configuring CPU cores corresponding to the CPU cores for the container;
and acquiring the service resource corresponding to the API interface, and deploying the service resource to the container.
Optionally, the step of scheduling the service resource of the API according to the access request when the access request of the API is received includes:
when a task request of the API interface is received, creating a task process of the task request based on the container;
and controlling the task process to execute the code program corresponding to the task request, and calling the service resource corresponding to the task request.
Optionally, after the step of controlling the task process to execute the code program corresponding to the task request and call the service resource corresponding to the task request, the method further includes:
and counting the residual memory of the container, and generating a resource use report based on the execution condition of the access request and the residual memory.
In addition, in order to achieve the above object, the present application further provides a terminal device, including: the system comprises a memory, a processor and a management program of an application program interface stored in the memory and capable of running on the processor, wherein the management program of the application program interface realizes the steps of the management method of the application program interface when being executed by the processor.
In addition, in order to achieve the above object, the present application also provides a computer-readable storage medium having stored thereon a management program of an application program interface, which when executed by a processor, implements the steps of the management method of an application program interface as described above.
The method, the device and the storage medium for managing the application program interface provided by the embodiment of the application acquire the service grade identification carried by the resource allocation request by receiving the resource allocation request of the API interface sent by the client, and then determine the resource allocation parameter according to the service grade identification, wherein the resource allocation parameter comprises a mirror image identification, a container memory and a CPU kernel number, the mirror image file corresponding to the mirror image identification is acquired, and the container of the API interface conforming to the resource allocation parameter is created according to the mirror image file, so that the service resource of the API interface is deployed to the container, and when the access request of the API interface is received, the service resource of the API interface is scheduled according to the access request. By creating the corresponding container according to the service level corresponding to the API interface, the container deploys the service resources of the API interface, so that the isolation between the service resources of different API interfaces is realized, and the use of other API interfaces is not affected even if the container is damaged.
Drawings
FIG. 1 is a flowchart illustrating an embodiment of a method for managing an application program interface according to the present application;
FIG. 2 is a detailed flowchart of step S30 in a second embodiment of the method for managing an application program interface according to the present application;
FIG. 3 is a detailed flowchart of step S40 in a third embodiment of the method for managing an application program interface according to the present application;
fig. 4 is a schematic diagram of a terminal structure of a hardware running environment according to an embodiment of the present application.
The achievement of the objects, functional features and advantages of the present application will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
In the related API service management scheme, the API service is deployed in a cluster mode, however, all APIs share one hardware resource in the mode, and when the hardware resource is abnormal, the technical problem that all the API services are not available is caused.
In order to solve the above-mentioned drawbacks of the related art, the present application provides a management method of an application program interface, which mainly includes the following steps:
the method comprises the steps of obtaining a service grade identifier carried by a resource configuration request through receiving the resource configuration request of an API interface sent by a client, and then determining a resource configuration parameter according to the service grade identifier, wherein the resource configuration parameter comprises a mirror image identifier, a container memory and a CPU kernel number, creating a container of the API interface which is consistent with the resource configuration parameter according to a mirror image file corresponding to the mirror image identifier, thereby deploying service resources of the API interface to the container, and scheduling the service resources of the API interface according to the access request when the access request of the API interface is received. By creating the corresponding container according to the service level corresponding to the API interface, the container deploys the service resources of the API interface, so that the isolation between the service resources of different API interfaces is realized, and the use of other API interfaces is not affected even if the container is damaged.
In order to better understand the above technical solution, exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the application to those skilled in the art.
Referring to fig. 1, in an embodiment of a method for managing an application program interface according to the present application, the method for managing an application program interface includes the following steps:
step S10: receiving a resource allocation request of an API interface sent by a client, and acquiring a service grade identifier carried by the resource allocation request;
in this embodiment, the client allocates resources to the API interface through the resource allocation page. The resource allocation page displays all the created API interface names and the service grade identifiers corresponding to the API interfaces in a list form. The service class identifier may be represented by high, medium, or low, or by arabic numerals 1, 2, or 3, or by english letter A, B, C, which is not particularly limited in this embodiment. The service grade identification characterizes the service corresponding to the API interface and the importance degree of the service. It can be understood that the higher the importance of the service, the larger the allocated container memory and CPU core number are, so as to ensure that there is enough space to deploy the service resources of the API interface, and at the same time, accelerate the processing efficiency of the API interface. The client can correspondingly adjust the service level identifier corresponding to the API interface on the resource allocation page, and click the service level identifier corresponding to the API interface can check the resource allocation parameter corresponding to the service level identifier, so that the size of a container created by the service level identifier and the number of configured CPU cores are obtained.
Optionally, with the continuous increase of different service modules, the originally fixed service level identifier may become insufficient to meet the requirement of the newly added service module, so the application also provides a setting page of the service level identifier, which is used for adding the new service level identifier and setting the resource configuration parameter corresponding to the service level identifier. It should be noted that, the resource configuration parameters are set according to service levels corresponding to different services. And determining the service grade corresponding to the service according to the access frequency and/or the attention degree of the user to the service and/or the service resource required by the service. It will be appreciated that the higher the frequency and/or the degree of interest of a user in a service and/or the more service resources required, the higher the importance of that service, and the higher the corresponding service level.
Step S20: determining a resource configuration parameter according to the service grade identifier, wherein the resource configuration parameter comprises a mirror image identifier, a container memory and a CPU core number;
in this embodiment, different service class identifiers correspond to different resource configuration parameters. The client only needs to set the service grade identification corresponding to the API interface, and does not need to pay attention to how to set the resource configuration parameters of the API interface, so that the professional requirements of personnel for resource configuration by the API interface can be reduced.
Optionally, before the step of receiving the resource configuration request of the API interface sent by the client and obtaining the service class identifier carried by the resource configuration request, the method further includes: when a resource configuration change request is detected, acquiring a service grade identifier and a resource configuration parameter corresponding to the resource configuration change request;
updating the resource configuration parameters to a resource configuration list according to the service grade identification; the step of determining the resource configuration parameters according to the service level identifier comprises the following steps: and acquiring the resource allocation list, and acquiring the resource allocation parameters from the resource allocation list according to the service grade identification.
In this embodiment, the resource configuration list stores the resource configuration parameters corresponding to all the service class identifiers. The client can change the resource configuration parameters of the resource configuration list so as to adapt to the requirements of different services. It can be appreciated that, to improve the security of the resource configuration list, when a resource configuration change request is detected, the user authority of the client needs to be verified, and when the client has the change authority, the modification of the resource configuration parameters in the resource configuration list is allowed.
Optionally, after the step of obtaining the resource configuration list and obtaining the resource configuration parameter from the resource configuration list according to the service level identifier, the method includes: creating a target resource configuration list of the API interface according to the service grade identifier and the resource configuration parameter; when a target resource configuration request of the API interface is received, acquiring a target resource configuration parameter corresponding to the target resource configuration request, and updating the target resource configuration parameter to the target resource configuration list; and when a reconfiguration request of the API interface is received, creating a container conforming to the target resource configuration parameters according to the image file, and deploying service resources of the API interface to the container.
In this embodiment, in the resource configuration list, one service level identifier corresponds to only one set of resource configuration parameters, so that the resource configuration parameters corresponding to all API interfaces with the same service level identifier are completely consistent, but as the iteration of the service resource increases, the original resource configuration parameters will not be applicable any more for different API interfaces, but when the importance level corresponding to the API interface is consistent with that of the original API interface, it is not reasonable to increase the service level corresponding to the API interface. Therefore, in order to adapt to the service resource requirements of different API interfaces, after the container of the API interface is created for the first time, the target resource configuration list of the API interface is created, so that the client dynamically modifies the resource configuration parameters according to the service resource requirements of the API interface without influencing the resource configuration of other API interfaces.
Step S30: acquiring an image file corresponding to the image identifier, creating a container of the API interface conforming to the resource configuration parameter according to the image file, and deploying service resources of the API interface to the container;
step S40: and when an access request of the API interface is received, scheduling the service resource of the API interface according to the access request.
In this embodiment, a container conforming to the resource configuration parameters is created through the image file, and service resources of the API interfaces are deployed into the container, so that isolation between service resources of different API interfaces is achieved, and even if the container is damaged, use of other API interfaces is not affected. When an access request of an API interface is received, the access request is executed by calling service resources in a container of the API interface, and service resources of other API interfaces are not involved, so that isolation among the API interfaces is realized.
It will be appreciated that the containers referred to in this disclosure are also referred to as dockers, and that the containers are separated from one another by a namespace (namespace) between the different containers.
In the technical scheme provided by the embodiment, a service level identifier carried by a resource configuration request is obtained by receiving the resource configuration request of an API interface sent by a client, and then a resource configuration parameter is determined according to the service level identifier, wherein the resource configuration parameter comprises a mirror image identifier, a container memory and a CPU kernel number, a mirror image file corresponding to the mirror image identifier is obtained, and a container of the API interface conforming to the resource configuration parameter is created according to the mirror image file, so that service resources of the API interface are deployed to the container, and when an access request of the API interface is received, the service resources of the API interface are scheduled according to the access request. By creating the corresponding container according to the service level corresponding to the API interface, the container deploys the service resources of the API interface, so that the isolation between the service resources of different API interfaces is realized, the use of other API interfaces is not affected even if the container is damaged, and the safety of the API interface service is improved.
Referring to fig. 2, in the second embodiment, based on the first embodiment, before the step S30, it includes:
step S50: acquiring the available memory of the current terminal equipment and the container memory of the container;
step S60: when the container memory is larger than the available memory, determining the minimum memory required by the API interface;
step S70: and when the minimum memory is smaller than the available memory, updating the container memory into the minimum memory, executing the mirror image file corresponding to the mirror image identifier, creating a container of the API interface according to the mirror image file, and deploying service resources of the API interface to the container.
In this embodiment, before creating a container, it is detected whether the available memory of the current terminal device meets the container memory required for creating the container, and when the available memory of the current terminal device is smaller than the container memory, the container memory in the resource configuration parameters corresponding to the API interface is updated to the minimum memory by determining the minimum memory required for the API interface, so that the container can be created smoothly, and the requirement of deploying the service resources of the API interface is met.
Optionally, service resources of the API interface can be deployed locally in advance, then each service of the API interface is tested, and the minimum memory required for deploying the API interface is determined according to the test result and the occupied memory of the service resources. The present embodiment is not particularly limited thereto. It should be noted that the test result includes the memory consumed by each service.
Optionally, the step of obtaining the image file corresponding to the image identifier, creating a container of the API interface according to the image file and the resource configuration parameter, and deploying a service resource of the API interface to the container includes: updating the resource configuration parameters to the mirror image file; starting the mirror image file, creating a container of the API interface according to the container memory, and configuring CPU cores corresponding to the CPU cores for the container; and acquiring the service resource corresponding to the API interface, and deploying the service resource to the container.
In this embodiment, the corresponding mirror image templates are determined in advance according to the service level identifier, and are stored in the mirror image repository in association with each other, and when the resource configuration request is received, the mirror image templates associated with the service level identifier are determined according to the service level identifier, and the mirror image templates can be understood as mirror image files, so that the mirror image files are started to create corresponding containers.
In the technical scheme provided by the embodiment, the minimum memory required by the API interface is determined by acquiring the available memory of the current terminal device and the container memory of the container when the container memory is greater than the available memory, so that when the minimum memory is smaller than the available memory, the container memory is updated to the minimum memory, then the image file corresponding to the image identifier is acquired, the container of the API interface conforming to the resource configuration parameters is created according to the image file, and the service resources of the API interface are deployed to the container. The minimum memory required by the API is determined, and the container memory in the resource configuration parameters corresponding to the API is updated to be the minimum memory, so that when the available memory of the terminal equipment is insufficient, the container can still be created, and the requirement of deploying the service resources of the API is met.
Referring to fig. 3, in a third embodiment, based on any of the above embodiments, step S40 includes:
step S41: when a task request of the API interface is received, creating a task process of the task request based on the container;
step S4: and controlling the task process to execute the code program corresponding to the task request, and calling the service resource corresponding to the task request.
In this embodiment, the API interface provides different services, and when an access request is received, the code program can be acquired according to the address of the access request. And creating a task process of the task request to execute the code program and call the service resource of the API interface.
Optionally, after the step of controlling the task process to execute the code program corresponding to the task request and call the service resource corresponding to the task request, the method further includes: and counting the residual memory of the container, and generating a resource use report based on the execution condition of the access request and the residual memory.
In this embodiment, after execution of each task request is completed, a report of the CPU resource usage situation may be generated by using the control groups of the container, so as to obtain the CPU resource usage situation, and when the CPU resource usage memory is greater than a preset threshold, cache may be released and garbage resources may be deleted, thereby improving the execution efficiency of the task request. It is understood that cgroups includes a plurality of cgroups.
It will be appreciated that the present application enables allocation of resources and execution of task requests through the cgroup in the container. The cpu group consists of cpuset, cpuacct, freezer and memory, wherein the cpu group allocates independent cpu and memory for the task. The CPU usact automatically generates a report of the CPU resource usage by the tasks in the cgroup. The freezer is responsible for suspending or resuming tasks in the cgroup. The memory is used for setting the limit of tasks in the cgroup on the memory usage amount, and automatically generating reports of the tasks on the memory resource usage. Besides, cgroup can limit the resources isolated by the nacespace, and can set weights for the resources, control the process, stop the process and other operations.
In the technical scheme provided by the embodiment, when an API task request is received, a task process of the task request is created based on the container, then the task process is controlled to execute a code program corresponding to the task request, a service resource corresponding to the task request is called, after the task process is controlled to execute the code program corresponding to the task request, the remaining memory of the container is counted after the service resource corresponding to the task request is called, a resource usage report is generated based on the execution condition of the access request and the remaining memory, the resource usage condition of the CPU is timely obtained, and when the CPU resource usage memory is greater than a preset threshold, buffering and garbage resource deletion can be released, so that the execution efficiency of the task request is improved.
Referring to fig. 4, fig. 4 is a schematic diagram of a terminal structure of a hardware running environment according to an embodiment of the present application.
The terminal of the embodiment of the application can be a computer.
As shown in fig. 4, the terminal may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), a mouse, etc., and the optional user interface 1003 may further include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also optionally be a storage device separate from the processor 1001 described above.
It will be appreciated by those skilled in the art that the terminal structure shown in fig. 4 is not limiting of the terminal and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
As shown in fig. 4, a management program of an operating system, a network communication module, a user interface module, and an application program interface may be included in the memory 1005 as one type of computer storage medium.
In the terminal shown in fig. 4, the network interface 1004 is mainly used for connecting to a background server and performing data communication with the background server; the processor 1001 may be configured to call a hypervisor of an application program interface stored in the memory 1005 and perform the following operations:
receiving a resource allocation request of an API interface sent by a client, and acquiring a service grade identifier carried by the resource allocation request;
determining a resource configuration parameter according to the service grade identifier, wherein the resource configuration parameter comprises a mirror image identifier, a container memory and a CPU core number;
acquiring an image file corresponding to the image identifier, creating a container of the API interface conforming to the resource configuration parameter according to the image file, and deploying service resources of the API interface to the container;
and when an access request of the API interface is received, scheduling the service resource of the API interface according to the access request.
Further, the processor 1001 may call a hypervisor of an application program interface stored in the memory 1005, and further perform the following operations:
when a resource configuration change request is detected, acquiring a service grade identifier and a resource configuration parameter corresponding to the resource configuration change request;
updating the resource configuration parameters to a resource configuration list according to the service grade identification;
the step of determining the resource configuration parameters according to the service level identifier comprises the following steps:
and acquiring the resource allocation list, and acquiring the resource allocation parameters from the resource allocation list according to the service grade identification.
Further, the processor 1001 may call a hypervisor of an application program interface stored in the memory 1005, and further perform the following operations:
creating a target resource configuration list of the API interface according to the service grade identifier and the resource configuration parameter;
when a target resource configuration request of the API interface is received, acquiring a target resource configuration parameter corresponding to the target resource configuration request, and updating the target resource configuration parameter to the target resource configuration list;
and when a reconfiguration request of the API interface is received, creating a container conforming to the target resource configuration parameters according to the image file, and deploying service resources of the API interface to the container.
Further, the processor 1001 may call a hypervisor of an application program interface stored in the memory 1005, and further perform the following operations:
acquiring the available memory of the current terminal equipment and the container memory of the container;
when the container memory is larger than the available memory, determining the minimum memory required by the API interface;
and when the minimum memory is smaller than the available memory, updating the container memory into the minimum memory, executing the mirror image file corresponding to the mirror image identifier, creating a container of the API interface according to the mirror image file, and deploying service resources of the API interface to the container.
Further, the processor 1001 may call a hypervisor of an application program interface stored in the memory 1005, and further perform the following operations:
acquiring service resources of the API interface and deploying the service resources on the local of the terminal equipment;
testing all services of the API interface to obtain a test result of all the services, wherein the test result comprises a memory consumed by testing all the services of the API interface;
and determining the minimum memory required by the API according to the test result and the occupied memory of the service resource.
Further, the processor 1001 may call a hypervisor of an application program interface stored in the memory 1005, and further perform the following operations:
updating the resource configuration parameters to the mirror image file;
starting the mirror image file, creating a container of the API interface according to the container memory, and configuring CPU cores corresponding to the CPU cores for the container;
and acquiring the service resource corresponding to the API interface, and deploying the service resource to the container.
Further, the processor 1001 may call a hypervisor of an application program interface stored in the memory 1005, and further perform the following operations:
when a task request of the API interface is received, creating a task process of the task request based on the container;
and controlling the task process to execute the code program corresponding to the task request, and calling the service resource corresponding to the task request.
Further, the processor 1001 may call a hypervisor of an application program interface stored in the memory 1005, and further perform the following operations:
and counting the residual memory of the container, and generating a resource use report based on the execution condition of the access request and the residual memory.
In addition, in order to achieve the above object, the present application further provides a terminal device, including: the system comprises a memory, a processor and a management program of an application program interface stored in the memory and capable of running on the processor, wherein the management program of the application program interface realizes the steps of the management method of the application program interface when being executed by the processor.
In addition, in order to achieve the above object, the present application also provides a computer-readable storage medium having stored thereon a management program of an application program interface, which when executed by a processor, implements the steps of the management method of an application program interface as described above.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of embodiments, it will be clear to a person skilled in the art that the above embodiment method may be implemented by means of software plus a necessary general hardware platform, but may of course also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/ram. Magnetic disk. Optical disk) as described above, comprising instructions for causing a terminal device (which may be a computer) to perform the method according to the embodiments of the present application.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the application, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.
Claims (10)
1. A method for managing an application program interface, the method for managing an application program interface comprising:
receiving a resource allocation request of an API interface sent by a client, and acquiring a service grade identifier carried by the resource allocation request;
determining a resource configuration parameter according to the service grade identifier, wherein the resource configuration parameter comprises a mirror image identifier, a container memory and a CPU core number;
acquiring an image file corresponding to the image identifier, creating a container of the API interface conforming to the resource configuration parameter according to the image file, and deploying service resources of the API interface to the container;
and when an access request of the API interface is received, scheduling the service resource of the API interface according to the access request.
2. The method for managing an application program interface according to claim 1, wherein before the step of receiving a resource configuration request of an API sent by a client and obtaining a service class identifier carried by the resource configuration request, the method further comprises:
when a resource configuration change request is detected, acquiring a service grade identifier and a resource configuration parameter corresponding to the resource configuration change request;
updating the resource configuration parameters to a resource configuration list according to the service grade identification;
the step of determining the resource configuration parameters according to the service level identifier comprises the following steps:
and acquiring the resource allocation list, and acquiring the resource allocation parameters from the resource allocation list according to the service grade identification.
3. The method for managing an application program interface according to claim 2, wherein after the step of obtaining the resource configuration parameters from the resource configuration list, the service class identification includes:
creating a target resource configuration list of the API interface according to the service grade identifier and the resource configuration parameter;
when a target resource configuration request of the API interface is received, acquiring a target resource configuration parameter corresponding to the target resource configuration request, and updating the target resource configuration parameter to the target resource configuration list;
and when a reconfiguration request of the API interface is received, creating a container conforming to the target resource configuration parameters according to the image file, and deploying service resources of the API interface to the container.
4. The method for managing an application program interface according to claim 2, wherein the step of obtaining the image file corresponding to the image identifier, creating a container of the API according to the image file, and deploying the service resource of the API to the container comprises:
acquiring the available memory of the current terminal equipment and the container memory of the container;
when the container memory is larger than the available memory, determining the minimum memory required by the API interface;
and when the minimum memory is smaller than the available memory, updating the container memory into the minimum memory, executing the mirror image file corresponding to the mirror image identifier, creating a container of the API interface according to the mirror image file, and deploying service resources of the API interface to the container.
5. The method of claim 4, wherein determining the minimum memory required by the API when the container memory is greater than the available memory comprises:
acquiring service resources of the API interface and deploying the service resources on the local of the terminal equipment;
testing all services of the API interface to obtain a test result of all the services, wherein the test result comprises a memory consumed by testing all the services of the API interface;
and determining the minimum memory required by the API according to the test result and the occupied memory of the service resource.
6. The method for managing an application program interface according to claim 1, wherein the step of obtaining an image file corresponding to the image identifier, creating a container of the API according to the image file, and deploying a service resource of the API to the container includes:
updating the resource configuration parameters to the mirror image file;
starting the mirror image file, creating a container of the API interface according to the container memory, and configuring CPU cores corresponding to the CPU cores for the container;
and acquiring the service resource corresponding to the API interface, and deploying the service resource to the container.
7. The method for managing an application program interface according to claim 1, wherein the step of scheduling the service resource of the API according to the access request upon receiving the access request of the API comprises:
when a task request of the API interface is received, creating a task process of the task request based on the container;
and controlling the task process to execute the code program corresponding to the task request, and calling the service resource corresponding to the task request.
8. The method for managing an application program interface according to claim 7, wherein after the step of controlling the task process to execute the code program corresponding to the task request and call the service resource corresponding to the task request, further comprising:
and counting the residual memory of the container, and generating a resource use report based on the execution condition of the access request and the residual memory.
9. A terminal device, characterized in that the terminal device comprises: memory, a processor and a management program for an application program interface of a terminal device stored on the memory and executable on the processor, which when executed by the processor, implements the steps of the method for managing an application program interface of any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that it stores thereon a management program of an application program interface of a terminal device, which when executed by a processor, implements the steps of the application program interface management method according to any one of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310976033.9A CN116700998A (en) | 2023-08-04 | 2023-08-04 | Application program interface management method, terminal device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310976033.9A CN116700998A (en) | 2023-08-04 | 2023-08-04 | Application program interface management method, terminal device and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116700998A true CN116700998A (en) | 2023-09-05 |
Family
ID=87831483
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310976033.9A Pending CN116700998A (en) | 2023-08-04 | 2023-08-04 | Application program interface management method, terminal device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116700998A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118250294A (en) * | 2024-05-28 | 2024-06-25 | 济南浪潮数据技术有限公司 | Shared storage service implementation method, program product, equipment and medium of cloud platform |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112256436A (en) * | 2020-11-09 | 2021-01-22 | 上海钐昆网络科技有限公司 | Resource allocation method, device, equipment and computer storage medium |
US20220292303A1 (en) * | 2021-03-11 | 2022-09-15 | Hewlett Packard Enterprise Development Lp | Systems and methods of resource configuration optimization for machine learning workloads |
CN115618409A (en) * | 2022-10-08 | 2023-01-17 | 中国建设银行股份有限公司 | Database cloud service generation method, device, equipment and readable storage medium |
-
2023
- 2023-08-04 CN CN202310976033.9A patent/CN116700998A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112256436A (en) * | 2020-11-09 | 2021-01-22 | 上海钐昆网络科技有限公司 | Resource allocation method, device, equipment and computer storage medium |
US20220292303A1 (en) * | 2021-03-11 | 2022-09-15 | Hewlett Packard Enterprise Development Lp | Systems and methods of resource configuration optimization for machine learning workloads |
CN115618409A (en) * | 2022-10-08 | 2023-01-17 | 中国建设银行股份有限公司 | Database cloud service generation method, device, equipment and readable storage medium |
Non-Patent Citations (1)
Title |
---|
BATTOR: "将 ASP.Net Core WebApi 应用打包至 Docker 镜像", pages 1 - 7, Retrieved from the Internet <URL:https://www.cnblogs.com/battor/p/publish_aspnet_core_webapi_to_docker_image.html> * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118250294A (en) * | 2024-05-28 | 2024-06-25 | 济南浪潮数据技术有限公司 | Shared storage service implementation method, program product, equipment and medium of cloud platform |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20210058338A1 (en) | Method and system for managing applications | |
US20170083357A1 (en) | Managing a server template | |
US20170085419A1 (en) | System and method for deploying an application | |
JP6658882B2 (en) | Control device, VNF placement destination selection method and program | |
EP1577766A2 (en) | Side-by-side drivers | |
US20080172736A1 (en) | Multi-Installer Product Advertising | |
US20120210323A1 (en) | Data processing control method and computer system | |
CN116700998A (en) | Application program interface management method, terminal device and storage medium | |
US20100131942A1 (en) | Suite-based integration and deployment of business products | |
EP2256633A2 (en) | Service provider management device, service provider management program, and service provider management method | |
CN110069265B (en) | Service cluster upgrading method and device and storage medium | |
CN113032125A (en) | Job scheduling method, device, computer system and computer-readable storage medium | |
US11442756B2 (en) | Common service resource application method, related device, and system | |
KR102118487B1 (en) | Automatic quality inspection system and method of container based application for ci/cd | |
CN111027871A (en) | Project resource allocation method and device and readable storage medium | |
CN107977243A (en) | A kind of third party's interface call method and device | |
EP3321808A1 (en) | Verification system and verification method | |
CN111443984B (en) | Container deployment method and device of network function virtualization NVF system | |
CN110599112B (en) | Network page development and maintenance method and device | |
CN108628620B (en) | POS application development implementation method and device, computer equipment and storage medium | |
JP2014013457A (en) | Patch determination program, patch determination method, and information processing device | |
CN115309558A (en) | Resource scheduling management system, method, computer equipment and storage medium | |
US20210256600A1 (en) | Connector leasing for long-running software operations | |
CN114070855B (en) | Resource allocation method, resource allocation device, resource allocation system, and storage medium | |
CN114064054A (en) | Micro-service publishing method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |