Application service related information processing method and device, equipment and storage medium

By starting a thread for each application and processing in parallel, directly obtaining and calculating resource usage information and service costs of each application, the problem of long-term AI service cost statistics in the prior art is solved, and faster information acquisition and calculation is achieved.

CN119782107APending Publication Date: 2025-04-08BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411716764.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

In the prior art, the service cost statistics of AI services are long, mainly because each step needs to traverse all data from the previous step for processing.

Method used

By starting a thread for each application in the application list, and obtaining the resource usage information of the i-th application through the i-th thread, the service cost of the target service corresponding to the i-th application is determined. Each thread runs in parallel, avoiding the process of establishing and reading multiple tables.

Benefits of technology

The overall processing time for obtaining information and calculating the service costs corresponding to multiple applications is shortened, and the problem of long-term service cost statistics of AI services is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119782107A_ABST
    Figure CN119782107A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a processing method and device for service related information of an application, equipment and a storage medium. The method comprises the steps of obtaining an application list; aiming at each application in the application list, starting a thread; resource usage information of the ith application is obtained through the ith thread, i is an integer from 1 to N, and N is the number of the applications in the application list; under the condition that the resource usage information of the ith application is obtained, the service cost of the target service corresponding to the ith application is determined through the ith thread according to the resource usage information of the ith application, and the threads corresponding to all the applications in the application list run in parallel. By applying the technical scheme provided by the embodiment of the invention, the problem of long time consumption of service cost statistics of the AI service in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a method, device, equipment and storage medium for processing service-related information of an application. Background Art

[0002] Artificial Intelligence (AI) services refer to various services provided using artificial intelligence technology. These services can automatically identify users' explicit and implicit needs and meet these needs proactively, efficiently and safely.

[0003] Currently, AI services can be evaluated through cost statistics services, that is, the cost of AI services can be calculated, and then the AI ​​services can be evaluated through these cost data to facilitate the optimization of subsequent services and the implementation of cost reduction and efficiency improvement strategies.

[0004] However, currently in the process of obtaining the cost of AI services, each step will store all the required data in a new list, and then in the next step, all the data in the previous list will be traversed and processed, which makes the service cost statistics process time-consuming. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a method, device, equipment and storage medium for processing application service-related information to solve the problem that the service cost statistics of AI services in the prior art take a long time. The specific technical solution is as follows:

[0006] In a first aspect, a method for processing service-related information of an application is provided, the method comprising:

[0007] Get the application list;

[0008] For each application in the application list, start a thread;

[0009] Obtain resource usage information of the i-th application through the i-th thread, where i is an integer from 1 to N, and N is the number of applications in the application list;

[0010] When the resource usage information of the i-th application is obtained, the service cost of the target service corresponding to the i-th application is determined through the i-th thread according to the resource usage information of the i-th application.

[0011] The threads corresponding to the applications in the application list run in parallel.

[0012] Optionally, the method further comprises:

[0013] Obtaining parameter information of a target resource through an i-th thread, wherein the target resource includes hardware resources included in each container in the i-th application, and the parameter information of the target resource includes at least one of a utilization rate and an occupied amount;

[0014] According to the parameter information of the target resource, an allocation strategy for allocating hardware resources to each container of the i-th application is adjusted.

[0015] Optionally, the resource usage information of the i-th application includes parameter information of each hardware resource included in the target resource, the parameter information of the hardware resource includes the usage duration of the hardware resource in R time units and type information of the hardware resource, the target resource includes the hardware resources included in each container in the i-th application, and R is a positive integer;

[0016] The determining, according to the resource usage information of the i-th application, the service cost of the target service corresponding to the i-th application includes:

[0017] According to the type information, obtaining a first cost of each hardware resource included in the target resource within the R time units;

[0018] The service cost of the target service corresponding to the i-th application within the target time period is determined according to the first cost and the usage duration of each hardware resource included in the target resource within the R time units.

[0019] Optionally, the method further comprises:

[0020] In the case where parameter information of a first hardware resource included in a first container within a first application is not obtained, determining a first interval and a first number according to parameter information of a target interface, wherein the target interface is an interface called by a thread corresponding to the first application, the first application is one of the applications in the application list, the first container is one of the containers within the first application, and the first hardware resource is one of the hardware resources included in the first container;

[0021] calling the target interface at the first interval through the thread corresponding to the first application to reacquire parameter information of the first hardware resource;

[0022] When the number of calls to the target interface reaches the first number and the parameter information of the first hardware resource is still not obtained, first indication information is recorded, wherein the first indication information is used to indicate that the parameter information of the first hardware resource cannot be obtained.

[0023] Optionally, the method further comprises:

[0024] The service cost of the service that calls the target service is determined according to the service cost of the target service and the calling parameters of the service that calls the target service.

[0025] Optionally, the method further comprises:

[0026] Obtaining, through the i-th thread, application identification information of the i-th application, identification information of the target service, and container information of a container within the i-th application;

[0027] The correspondence between the application identification information of the i-th application, the identification information of the target service, the container information of the container of the i-th application, and the service cost of the target service is stored.

[0028] Optionally, the method further comprises:

[0029] Receive modification operations;

[0030] In response to the modification operation, the configuration parameters corresponding to the modification operation in the configuration file are modified, wherein the configuration file includes configuration parameters of a service corresponding to at least one application.

[0031] Optionally, obtaining resource usage information of the i-th application through the i-th thread includes:

[0032] The first function is called through the i-th thread to obtain resource usage information of the i-th application;

[0033] The determining, according to the resource usage information of the i-th application, the service cost of the target service corresponding to the i-th application includes:

[0034] Calling the second function to determine the service cost of the target service corresponding to the i-th application according to the resource usage information of the i-th application;

[0035] Both the first function and the second function are implemented based on the object-oriented dynamic type language Python.

[0036] In a second aspect, a device for processing service-related information of an application is provided, the device comprising:

[0037] A first acquisition module is used to acquire an application list;

[0038] A thread starting module, used for starting a thread for each application in the application list;

[0039] A first information acquisition module, configured to acquire resource usage information of an i-th application through an i-th thread, wherein i is an integer from 1 to N, and N is the number of applications in the application list;

[0040] The first determination module is used to determine the service cost of the target service corresponding to the i-th application according to the resource usage information of the i-th application through the i-th thread when the resource usage information of the i-th application is obtained.

[0041] The threads corresponding to the applications in the application list run in parallel.

[0042] In a third aspect, an electronic device is provided, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0043] Memory, used to store computer programs;

[0044] The processor is used to implement the steps of the method for processing service-related information of the application described in the first aspect when executing the program stored in the memory.

[0045] According to a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of the method for processing service-related information of the application described in the first aspect are implemented.

[0046] In a fifth aspect, a computer program product is provided, which includes computer instructions, which are stored in a computer-readable storage medium and are suitable for being read and executed by a processor, so that an electronic device having the processor performs the steps of the method for processing service-related information of the application described in the first aspect.

[0047] By applying the technical solution provided in the embodiments of the present application, it is possible to obtain an application list, thereby starting a thread for each application in the application list, and obtaining resource usage information of the i-th application through the i-th thread. Then, when the resource usage information of the i-th container is obtained, the service cost of the target service corresponding to the i-th application is determined according to the resource usage information of the i-th application through the i-th thread, wherein i is an integer from 1 to N, N is the number of applications in the application list, and the threads corresponding to the applications in the application list run in parallel.

[0048] In the prior art, when calculating the service costs of services corresponding to multiple applications, starting from the bottom-level hardware resources, regardless of which container each hardware resource belongs to, the usage information of each hardware resource is uniformly obtained to construct a first table, and then the information of the first table is read for summary and collation, and statistics are obtained on which hardware resources are included in the same container, and then the resource usage information of each container is obtained based on the hardware resources included in the same container to construct a second table; then the information of the second table is read for summary and collation, and statistics are obtained on which containers the same application is included, and then the resource usage information of each application is obtained based on the containers included in the same application to construct a third table; and then the information in the third table is read again, and the service cost corresponding to each application is calculated according to the resource usage information of each application, and stored in a fourth table.

[0049] It can be seen that in the prior art, the process of counting the service costs of services corresponding to multiple applications requires the establishment of multiple tables and the reading of information in multiple tables, which makes the process of service cost statistics time-consuming. In the embodiment of the present application, a thread can be started for each application in the application list, and from the perspective of the application, each thread only obtains the resource usage information of the application corresponding to the thread, does not obtain the resource usage information of other applications, and does not mix the resource usage information of the application corresponding to the thread with the resource usage information of other applications, that is, in the embodiment of the present application, one thread is responsible for the storage and reading of the relevant data of an application, and each thread is independent of each other. Therefore, the embodiment of the present application does not need to execute the above-mentioned process of establishing and reading the first table, the second table and the third table, avoiding the waste of time by establishing multiple tables and repeatedly reading information. Therefore, the embodiment of the present application can shorten the information acquisition time; and the parallel operation of multiple threads further shortens the overall processing time for calculating the service costs of services corresponding to multiple applications. Therefore, the embodiment of the present application can solve the problem of long service cost statistics of AI services in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0051] Figure 1 A flowchart of a method for processing service-related information of an application in an embodiment of the present application;

[0052] Figure 2 This is one of the schematic diagrams of a specific implementation of the method for processing service-related information used in the embodiments of the present application;

[0053] Figure 3 This is a second schematic diagram of a specific implementation of the method for processing service-related information used in an embodiment of the present application;

[0054] Figure 4 A structural block diagram of a device for processing service-related information of an application in an embodiment of the present application;

[0055] Figure 5 This is a structural block diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0056] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0057] It should be understood that the references to "one embodiment" or "an embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present application. Therefore, the references to "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0058] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0059] The technical solutions in the embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application.

[0060] like Figure 1 FIG. 1 is a flow chart of a method for processing service-related information of an application in an embodiment of the present application, which may specifically include the following steps:

[0061] Step 101: Get an application list.

[0062] The application list may include applications corresponding to the AI ​​services for which service costs need to be determined.

[0063] In addition, the application list of multiple AI services can be obtained by calling a third-party interface of a Docker-based application engine; illustratively, the application list can include applications of all AI services.

[0064] It should be noted that the Docker-based application engine can be used to deploy AI services; Docker is a set of platform-as-a-service products. It is based on virtualization technology at the operating system level and packages software and its dependencies into containers; that is, the software that hosts the container is called the Docker engine.

[0065] Step 102: Start a thread for each application in the application list.

[0066] In the embodiment of the present application, the application list includes identification information of N applications, then in step 102, N threads are started, and the N applications correspond one-to-one to the N threads.

[0067] The application list may include a key or a unique key of each application. In step 102, a thread is started for each key or a unique key, so that the started thread is bound or a corresponding relationship is established with the key or the unique key of the application.

[0068] Step 103: Obtain resource usage information of the ith application through the ith thread, where i is an integer from 1 to N, and N is the number of applications in the application list.

[0069] Among them, a single AI service is deployed in the application in the form of a single or multiple containers, that is, a single application corresponds to a single AI service, which can contain multiple containers; a single container includes multiple hardware resources; therefore, to calculate the service cost of a single AI service, the resource usage information of each container included in the application corresponding to the AI ​​service is required, wherein the resource usage information of a single container includes the length of time that each hardware resource included in the container is used.

[0070] That is, it can be understood that the resource usage information of the i-th application includes the duration for which each hardware resource in each container included in the i-th application is used.

[0071] Step 104: when the resource usage information of the ith application is obtained, the service cost of the target service corresponding to the ith application is determined by the ith thread according to the resource usage information of the ith application, wherein the threads corresponding to the applications in the application list run in parallel.

[0072] In an embodiment of the present application, a thread is started for each application through step 102, then in step 103, resource usage information of each application is obtained through the thread corresponding to the application, and then the service cost of the service corresponding to the corresponding application is calculated through the thread corresponding to each application based on the obtained resource usage information.

[0073] It can be seen from the above steps 101 to 104 that in the embodiment of the present application, an application list can be obtained, so that for each application in the application list, a thread is started, and the resource usage information of the i-th application is obtained through the i-th thread. Then, when the resource usage information of the i-th container is obtained, the service cost of the target service corresponding to the i-th application is determined according to the resource usage information of the i-th application, where i is an integer from 1 to N, N is the number of applications in the application list, and the threads corresponding to the applications in the application list run in parallel.

[0074] In the prior art, when calculating the service costs of services corresponding to multiple applications, starting from the bottom-level hardware resources, regardless of which container each hardware resource belongs to, the usage information of each hardware resource is uniformly obtained to construct a first table, and then the information of the first table is read for summary and collation, and statistics are obtained on which hardware resources are included in the same container, and then the resource usage information of each container is obtained based on the hardware resources included in the same container to construct a second table; then the information of the second table is read for summary and collation, and statistics are obtained on which containers the same application is included, and then the resource usage information of each application is obtained based on the containers included in the same application to construct a third table; and then the information in the third table is read again, and the service cost corresponding to each application is calculated according to the resource usage information of each application, and stored in a fourth table.

[0075] It can be seen that in the prior art, the process of calculating the service costs of services corresponding to multiple applications requires the establishment of multiple tables and the reading of information in the multiple tables, which makes the process of calculating the service costs time-consuming.

[0076] In the embodiment of the present application, a thread can be started for each application in the application list, and from the perspective of the application, each thread only obtains the resource usage information of the application corresponding to the thread, does not obtain the resource usage information of other applications, and does not mix the resource usage information of the application corresponding to the thread with the resource usage information of other applications. That is, in the embodiment of the present application, one thread is responsible for the storage and reading of relevant data of an application, and each thread is independent of each other. Therefore, the embodiment of the present application does not need to execute the above-mentioned process of establishing and reading the first table, the second table and the third table, avoiding the waste of time by establishing multiple tables and repeatedly reading information. Therefore, the embodiment of the present application can shorten the information acquisition time; and multiple threads running in parallel further shorten the overall processing time for calculating the service costs of services corresponding to multiple applications. Therefore, the embodiment of the present application can solve the problem of time-consuming service cost statistics of AI services in the prior art.

[0077] In short, in the prior art, the process of counting the service costs of services corresponding to multiple applications requires the establishment of multiple tables and the reading of information in multiple tables, which makes the process of service cost statistics time-consuming. In contrast, in the embodiment of the present application, each application only needs to undergo data processing once, so that a dictionary can be generated and stored in a public list in the end. The public list does not need to undergo any traversal, and the embodiment of the present application uses multiple processes for data processing, which greatly improves the processing performance.

[0078] In an optional embodiment of the present application, the method further includes the following steps A-1 to A-2:

[0079] Step A-1: ​​acquiring parameter information of a target resource through the i-th thread, wherein the target resource includes hardware resources included in each container in the i-th application, and the parameter information of the target resource includes at least one of utilization rate and occupancy;

[0080] Step A-2: According to the parameter information of the target resource, an allocation strategy for allocating hardware resources to each container of the i-th application is adjusted.

[0081] Exemplarily, the hardware resource may include at least one of a central processing unit (CPU), a graphics processing unit (GPU), and a memory. In this case, the parameter information of the target resource may include at least one of a CPU utilization rate, a GPU utilization rate, and a memory occupancy rate.

[0082] It can be seen from steps A-1 to A-2 that in an embodiment of the present application, at least one of the utilization and occupancy of the hardware resources included in each container within the i-th application can also be obtained through the i-th thread, so that the allocation strategy for allocating hardware resources to each container of the application is adjusted according to at least one of the utilization and occupancy of these hardware resources.

[0083] In an optional embodiment of the present application, the above step A-2 may include:

[0084] When it is determined according to the parameter information of the target resource that the first condition is met, reducing the cth hardware resource for the ath container, or increasing the instance running on the cth hardware resource included in the ath container, wherein the first condition is: the utilization rate of the cth hardware resource included in the ath container in the ith application is less than a first threshold, or the occupied amount is less than a second threshold;

[0085] When it is determined according to the parameter information of the target resource that the second condition is met, a cth hardware resource is added to the ath container, or an instance running on the cth hardware resource included in the ath container is reduced, wherein the second condition is: a utilization rate of the cth hardware resource included in the ath container in the ith application is greater than or equal to a first threshold, or an occupied amount is greater than or equal to a second threshold.

[0086] For example, a service deploys a 16-core CPU and 1 GPU for a single container. If the CPU utilization is very low (for example, the CPU utilization is lower than the first threshold), only an 8-core CPU can be allocated. If the GPU utilization is low (for example, the GPU utilization is lower than the second threshold), you can consider deploying multiple instances in this container (which can be understood as multi-process processing), thereby saving computing resources.

[0087] Or, for example, in terms of memory usage, because each physical memory is limited, for example, a machine has 8 GPUs, 64-core CPUs and 64G memory. If 1 GPU, 8 CPUs and 16G memory are allocated to a container when allocating resources, then the last 4 GPUs are idle, so the allocation strategy can be adjusted according to memory usage. Therefore, it is understandable that the memory usage is to observe whether the container memory utilization is too high, because once the memory usage exceeds the allocated memory, the service cannot continue to perform related processing and the container will be killed.

[0088] In an optional embodiment of the present application, the resource usage information of the i-th application includes parameter information of each hardware resource included in the target resource, the parameter information of the hardware resource includes the usage duration of the hardware resource in R time units and type information of the hardware resource, the target resource includes the hardware resources included in each container in the i-th application, and R is a positive integer;

[0089] In the above step 104, the service cost of the target service corresponding to the i-th application is determined according to the resource usage information of the i-th application, including the following steps B-1 to B-2:

[0090] Step B-1: acquiring a first cost of each hardware resource included in the target resource within the R time units according to the type information (eg, model);

[0091] Step B-2: Determine the service cost of the target service corresponding to the i-th application within the target time period based on the first cost and the usage duration of each hardware resource included in the target resource within the R time units.

[0092] Among them, in step B-2, the service cost of the target service corresponding to the i-th application within R time units can be determined based on the first cost and the usage time of each hardware resource included in the target resources within the R time units, and then, based on the service cost of the target service corresponding to the i-th application within R time units, the service cost of the target service corresponding to the i-th application within the target time period can be determined.

[0093] Optionally, determining the service cost of the target service corresponding to the i-th application within R time units according to the first cost and the usage duration of each hardware resource included in the target resource within the R time units includes:

[0094] According to the formula Calculate the service cost Y of the target service corresponding to the i-th application within R time units i ,in, represents the sum of the usage time of the jth hardware resource in the ith application within R time units, represents the first cost of the jth hardware resource in the ith application within R time units, M represents the number of hardware resources in the ith application, and the hardware resources in the ith application refer to the hardware resources included in the container in the ith application;

[0095] The determining, according to the service cost of the target service corresponding to the i-th application in the target time period, includes:

[0096] According to the formula P i =Y i *b, calculate the service cost P of the target service corresponding to the i-th application within the target time period i , where b represents the number of time units included in the target time period.

[0097] The following takes the time unit as 5 minutes, R=12, and the target time period as 1 day as an example to introduce the specific implementation process of the above step B-2:

[0098] Assume that application 1 corresponds to service 1, and there are two containers in application 1. The first container includes CPU1 and GPU1, and the second container includes CPU2 and GPU2. The usage time of CPU1, CPU2, GPU1, and GPU2 is collected or recorded every 5 minutes. Then:

[0099] The service cost of service 1 within 1 hour = the sum of CPU1 usage time within 12 5-minute periods * the cost corresponding to the type of CPU1 + the sum of GPU1 usage time within 12 5-minute periods * the cost corresponding to the type of GPU1 + the sum of CPU2 usage time within 12 5-minute periods * the cost corresponding to the type of CPU2 + the sum of GPU2 usage time within 12 5-minute periods * the cost corresponding to the type of GPU2;

[0100] Furthermore, the service cost of service 1 in one day = the service cost of service 1 in one hour * 24.

[0101] From the above, it can be seen that when a container contains multiple GPUs, the embodiments of the present application can also perform cost calculation.

[0102] In addition, it should be noted that the correspondence between the type information of the hardware resources and the cost can be stored in advance, so when the cost of a certain hardware resource is needed, the specific cost can be found in the correspondence based on its type information.

[0103] In an optional embodiment of the present application, the method further includes the following steps C-1 to C-3:

[0104] Step C-1: determining a first interval and a first number according to parameter information of a target interface when parameter information of a first hardware resource included in a first container within a first application is not obtained, wherein the target interface is an interface called by a thread corresponding to the first application, the first application is one of the applications in the application list, the first container is one of the containers within the first application, and the first hardware resource is one of the hardware resources included in the first container;

[0105] Step C-2: calling the target interface according to the first interval through the thread corresponding to the first application to reacquire parameter information of the first hardware resource;

[0106] Step C-3: When the number of calls to the target interface reaches the first number and the parameter information of the first hardware resource has not been obtained, record first indication information (such as writing the first indication information to a log), wherein the first indication information is used to indicate that the parameter information of the first hardware resource cannot be obtained.

[0107] The parameter information of the target interface is used to indicate the stability of the target interface and the time it takes to return a result;

[0108] Specifically, the stronger the stability of the target interface, the greater the success rate of frequent retries to obtain data, and the weaker the stability of the target interface, the lower the success rate of frequent retries to obtain data; therefore, it can be set that the stronger the stability of the target interface, the smaller the first interval and the larger the first number; conversely, the weaker the stability of the target interface, the larger the first interval and the smaller the first number.

[0109] The longer it takes to return the result, the larger the first interval and the smaller the first number; the shorter it takes to return the result, the smaller the first interval and the larger the first number; for example, data retrieval takes a long time, while data transmission takes a short time;

[0110] In addition, exemplarily, the stability of the target interface can be represented by the load, that is, the larger the load of the target interface, the worse its stability; in this case, the smaller the load of the target interface can be set, the smaller the first interval and the larger the first number; conversely, the larger the load of the target interface, the larger the first interval and the smaller the first number.

[0111] As described in the above steps C-1 to C-3, in an embodiment of the present application, for any hardware resource (such as CPU, GPU, memory) included in any container within any application, if the corresponding interface is not obtained when it is called for the first time, retries can be performed at different times and intervals based on the parameter information of the interface. If it ultimately fails, the above first indication information is recorded, thereby improving the reliability of the data to a certain extent and obtaining abnormal situations when maintaining services.

[0112] It is understandable that when the above-mentioned first indication information is generated, an alarm mechanism may also be introduced to alarm for frequently occurring anomalies and facilitate timely maintenance services.

[0113] It should also be noted that during the acquisition of the application's resource usage information, some information may be missing. For example, if the CPU or GPU type information is missing, the prior art will directly use the default model to calculate the cost. If the usage time is missing, it will not be included in the data of the query. For this reason, in an embodiment of the present application, not only can an interface retry function be added, but the statistical logic can also be optimized. For example, if the CPU and GPU models are still missing, this problem will be recorded, and the cost calculation will still use the default model, but the interface query failure can be subsequently counted to facilitate problem troubleshooting.

[0114] In an optional embodiment of the present application, the method further includes the following step D-1:

[0115] Step D-1: Determine the service cost of the service that calls the target service according to the service cost of the target service and the calling parameters of the service that calls the target service.

[0116] The call parameter may include at least one of a call volume and a quota.

[0117] In addition, a service can be allocated to multiple businesses for use, that is, the total call volume of a service can be allocated to multiple businesses; for example, the total call volume of the service is C, which is allocated to business 1 and business 2 in the ratio of k1:k2. If the service cost of the service is Y, the business cost of business 1 is: C*k1(k1+k2), and the business cost of business 2 is: C*k2(k1+k2).

[0118] It can be seen from this that in the embodiment of the present application, the business cost can be further calculated based on the service cost of the service and the calling parameters of the business that calls the service, so as to evaluate the business based on the business cost.

[0119] In an optional embodiment of the present application, the method further includes the following steps E-1 to E-2:

[0120] Step E-1: Obtaining, through the i-th thread, application identification information of the i-th application, identification information of the target service, and container information of the container in the i-th application;

[0121] Step E-2: storing the correspondence between the application identification information of the i-th application, the identification information of the target service, the container information of the container of the i-th application, and the service cost of the target service.

[0122] Among them, the application identification information may include the application ID; the service identification information may include at least one of the service name, service version, and service tag; the container information includes the container ID, the host machine name, the number, type and identification information of the included hardware resources, the cluster name, etc.; it should be noted that the cluster is used to divide hardware resources, that is, a certain number of physical machines, and a single application can obtain hardware resources from a single cluster.

[0123] In addition, by storing the correspondence between application identification information, target service identification information, container information, and target service service cost, the correspondence between applications, containers, services, and service costs can be clarified to facilitate determining which applications or containers or services to adjust based on service costs.

[0124] In addition, the correspondence between the key or primary key and the application identification information, container information, and service identification information may be pre-stored, so that the corresponding application identification information, container information, and service identification information may be searched based on the key or primary key.

[0125] In an optional embodiment of the present application, the method further includes the following steps F-1 to F-2:

[0126] Step F-1: receiving a modification operation;

[0127] Step F-2: In response to the modification operation, modify the configuration parameters corresponding to the modification operation in the configuration file, wherein the configuration file includes configuration parameters of a service corresponding to at least one application.

[0128] Among them, the configuration parameters may include: the domain name of the interface used to obtain the resource usage information of the application, the number of times the parameter information of the hardware resources is re-acquired (i.e., the first number mentioned above), the database configuration (i.e., the database used to obtain the resource usage information of the application), and at least one of the costs corresponding to the type information of the hardware resources.

[0129] In addition, in the prior art, some configuration parameters of the service are often determined as a fixed value in the code, and there is no external interface to configure the parameters. In the embodiment of the present application, such parameters can be uniformly organized into a configuration file to facilitate unified management and update of configuration parameters. It is understandable that these parameters can also be configured in the cloud distribution center, and the parameters can be dynamically updated directly without updating the service.

[0130] In an optional embodiment of the present application, in the above step 103, the obtaining resource usage information of the i-th application through the i-th thread includes:

[0131] The first function is called through the i-th thread to obtain resource usage information of the i-th application;

[0132] In the above step 104, determining the service cost of the target service corresponding to the i-th application according to the resource usage information of the i-th application through the i-th thread includes:

[0133] Calling the second function to determine the service cost of the target service corresponding to the i-th application according to the resource usage information of the i-th application through the i-th thread;

[0134] Wherein, both the first function and the second function are implemented based on the object-oriented dynamic type language Python.

[0135] Among them, Python is a high-level programming language. In Python, a data processing process can be divided into multiple independent functions, thereby improving the readability, maintainability and reusability of the code.

[0136] In addition, the method of using functions to split the data processing process can be, for example:

[0137] 1. Define independent functions: define different steps of data processing in different functions, each function completes a specific task;

[0138] 2. Call functions: Call these functions in the main program and execute them in sequence according to the data processing flow.

[0139] In addition, functions in Python are divided into the following four types:

[0140] 1. Built-in functions: such as print(), type(), !&n(), etc.; these functions can be used directly without definition and import.

[0141] 2. Custom function: A custom function is a function defined by the user; the function name and parameter list are defined by the def keyword, and can return a value or not as needed.

[0142] 3. Anonymous function: An anonymous function, also known as a lambda function, is a simple way to define a function. It consists of an expression and can accept any number of parameters but can only return the value of one expression.

[0143] 4. Higher-order functions: A higher-order function is a function that accepts one or more functions as parameters and returns a function as a result. Common higher-order functions include map(), filter(), reduce(), etc. They can easily process data types such as lists and dictionaries.

[0144] In the embodiment of the present application, the above-mentioned suitable types can be selected as needed to implement the specific functions of the above-mentioned first function and second function. In addition, the code blocks of the functions implemented by Python are independent of each other, so when logic modification is required, it can be done in blocks without affecting the overall structure.

[0145] In addition, it should be noted that in the prior art, three Structured Query Language (SQL) statements are used to obtain, classify, calculate, and save the hourly service cost, daily service cost, and daily business cost. Among them, although the SQL statement has less code, a large amount of calculation logic is nested and stacked, which makes it difficult to understand and has poor readability. At the same time, the calculation logic of each part is not separated into different functions. If you want to modify one logic, it will affect the overall structure.

[0146] The logic of the above steps 103 to 104 of the embodiment of the present application can use Python to divide simple operations such as accessing data and data calculation into independent functions. There will not be a large amount of nested and stacked calculation logic, which will cause great difficulty in understanding and poor readability, and it will be convenient for reuse in subsequent iterations of other functions.

[0147] In summary, the specific implementation of the method for processing service-related information of an application in an embodiment of the present application can be described as follows:

[0148] like Figure 2 As shown, the information collection process includes the following steps 201 to 205:

[0149] Step 201: Obtain an application list; for example, a third-party interface of an application engine based on Docker may be called to obtain an application list of multiple AI services;

[0150] Step 202: Start multiple threads, that is, start a thread pool, which includes a thread corresponding to each application in the application list; each thread executes steps 203 to 205 for the application corresponding to the thread;

[0151] Step 203: Obtain identification information and container information of the application, that is, according to the key or primary key of each application included in the application list, obtain identification information and container information of the application, wherein the identification information of the application includes the application ID, and the container information includes the container IDs of all containers in the application, the host name, the GPU identification and quantity, the CPU identification and quantity, the memory, and the cluster name;

[0152] Step 204: Obtain hardware type information and resource usage information of the application, that is, the type of CPU and GPU included in each container in the application and the resource usage information of the application can be obtained through the hardware query interface, wherein the resource usage information of the application includes the duration of use of each CPU and GPU included in each container in the application within multiple time units (for example, 5 minutes);

[0153] It is understandable that the CPU utilization, GPU utilization and memory usage of each container in the application can also be obtained through the hardware query interface to adjust the allocation strategy of allocating hardware resources to each container of the application.

[0154] Step 205: Information storage, that is, storing the information obtained in the above steps in the target list by application, that is, information belonging to the same application is stored as the same record in the list in the database;

[0155] It should be noted that in the above information collection process, if a certain interface is called but data is not successfully obtained, retries can be performed at different times and intervals according to the stability of the called interface. If it still fails in the end, the abnormal situation is recorded in the log file for subsequent processing, thereby improving the reliability of the data to a certain extent, and the abnormal situation can be obtained when maintaining the service;

[0156] like Figure 3As shown, the service cost statistics process includes the following steps 301 to 303:

[0157] Step 301: reading data, i.e. obtaining resource usage information of one of the applications from a database;

[0158] Step 302: Calculate the service cost of R time units (e.g., 12 5-minute units, i.e., 1 hour), that is, determine the first cost of each hardware resource in the R time units according to the type of hardware resources (i.e., at least one of CPU, GPU, and memory) included in each container in the same application, and then calculate the service cost of the service corresponding to the application in the R time units according to the resource usage information of the application read;

[0159] Step 303: Calculate the service cost within the target time period (e.g., 1 day), that is, convert the service cost of the service corresponding to each application in R time units into the service cost of the target time period, and store it in the above target list in the database;

[0160] Each thread executes the above steps 301 to 203 for the application corresponding to the thread;

[0161] Step 304: Calculate the business cost, that is, calculate the business cost of each business line according to the service call volume, quota and other information of different businesses, and store it in the database.

[0162] It should be noted that the above information collection process and service cost statistics process can be implemented by using Python, so there will not be a large number of nested calculation logics, which will cause the problem of great difficulty in understanding and poor readability. That is, in this way, simple operations such as accessing data and data calculation are divided into independent functions, which is convenient for reuse in subsequent iterations of other functions;

[0163] In addition, parameters such as the domain name of the interface called in the above information collection process, the number of times the interface is re-called to obtain data, the database involved in the data collected in the information collection process, and the cost corresponding to the type information of hardware resources can be organized into a configuration file to facilitate unified management and updating of configuration parameters.

[0164] From the above, it can be seen that the embodiments of the present application, in order to optimize the performance and data accuracy of the cost service and enhance the maintainability of the service, can maintain and iterate the service at a lower cost; and in terms of service performance and data accuracy, the statistical algorithm is optimized and a more efficient data access method is used; in terms of enhancing the maintainability of the service, more configurable parameters are provided.

[0165] In addition, AI services themselves will occupy computing resources, which include the costs of purchasing equipment, maintaining equipment, venues, electricity, etc. If the computing resources required by AI services to achieve a certain function cannot be accurately counted, then the impact of each AI service on profits cannot be determined, and it is also impossible to determine whether a certain AI service is worth using or which computing resources should be used. Therefore, the embodiments of the present application can facilitate the management of AI services, so that AI services can be better used to obtain benefits.

[0166] Corresponding to the above method embodiment, the embodiment of the present application also provides a device for processing service-related information of an application. The device for processing service-related information of an application described below and the method for processing service-related information of an application described above can refer to each other.

[0167] See also Figure 4 As shown, the device 400 for processing application service related information may include the following modules:

[0168] The first acquisition module 401 is used to acquire an application list;

[0169] A thread starting module 402, used for starting a thread for each application in the application list;

[0170] A first information acquisition module 403 is configured to acquire resource usage information of an i-th application through an i-th thread, wherein i is an integer from 1 to N, and N is the number of applications in the application list;

[0171] The first determination module 404 is used to determine the service cost of the target service corresponding to the i-th application through the i-th thread according to the resource usage information of the i-th application when the resource usage information of the i-th application is obtained;

[0172] The threads corresponding to the applications in the application list run in parallel.

[0173] As can be seen from the above, in the embodiment of the present application, the application list can be obtained through the first acquisition module 401, so that the thread start module 402 starts a thread for each application in the application list, and triggers the first information acquisition module 403 to obtain the resource usage information of the i-th application through the i-th thread, and then when the resource usage information of the i-th container is obtained, the first determination module 404 determines the service cost of the target service corresponding to the i-th application according to the resource usage information of the i-th application, wherein i is an integer from 1 to N, N is the number of applications in the application list, and the threads corresponding to the applications in the application list run in parallel.

[0174] It can be seen that in the embodiment of the present application, a thread can be started for each application in the application list, and each thread only obtains the resource usage information of the application corresponding to the thread, and does not obtain the resource usage information of other applications. In this case, there is no need to execute the above-mentioned process of establishing and reading the first table, the second table, and the third table, thereby avoiding the waste of time by establishing multiple tables and repeatedly reading information. Therefore, the embodiment of the present application can shorten the information acquisition time; and the parallel operation of multiple threads further shortens the overall processing time for calculating the service costs of services corresponding to multiple applications. Therefore, the embodiment of the present application can solve the problem of time-consuming service cost statistics of AI services in the prior art.

[0175] In some embodiments of the present application, the device further comprises:

[0176] A second acquisition module is used to acquire parameter information of a target resource through an i-th thread, wherein the target resource includes hardware resources included in each container in the i-th application, and the parameter information of the target resource includes at least one of a utilization rate and an occupied amount;

[0177] The policy adjustment module is used to adjust the allocation policy of allocating hardware resources to each container of the i-th application according to the parameter information of the target resource.

[0178] In some embodiments of the present application, the resource usage information of the i-th application includes parameter information of each hardware resource included in the target resource, the parameter information of the hardware resource includes the usage duration of the hardware resource in R time units and type information of the hardware resource, the target resource includes the hardware resources included in each container in the i-th application, and R is a positive integer;

[0179] The first determining module 404 includes:

[0180] An acquisition submodule, configured to acquire, according to the type information, a first cost of each hardware resource included in the target resource within the R time units;

[0181] A determination submodule is used to determine the service cost of the target service corresponding to the i-th application within the target time period according to the first cost and the usage time of each hardware resource included in the target resource within the R time units.

[0182] In some embodiments of the present application, the device further comprises:

[0183] a second determination module, configured to determine a first interval and a first number of times according to parameter information of a target interface when parameter information of a first hardware resource included in a first container in a first application is not obtained, wherein the target interface is an interface called by a thread corresponding to the first application, the first application is one of the applications in the application list, the first container is one of the containers in the first application, and the first hardware resource is one of the hardware resources included in the first container;

[0184] an information re-acquisition module, configured to call the target interface at the first interval through the thread corresponding to the first application to re-acquire parameter information of the first hardware resource;

[0185] A recording module is used to record first indication information when the number of calls to the target interface reaches the first number and the parameter information of the first hardware resource has not been obtained, wherein the first indication information is used to indicate that the parameter information of the first hardware resource cannot be obtained.

[0186] In some embodiments of the present application, the device further comprises:

[0187] The third determining module is used to determine the service cost of the service that calls the target service according to the service cost of the target service and the calling parameters of the service that calls the target service.

[0188] In some embodiments of the present application, the device further comprises:

[0189] A third acquisition module is used to acquire, through the i-th thread, application identification information of the i-th application, identification information of the target service, and container information of the container in the i-th application;

[0190] The storage module is used to store the corresponding relationship between the application identification information of the i-th application, the identification information of the target service, the container information of the container of the i-th application, and the service cost of the target service.

[0191] In some embodiments of the present application, the device further comprises:

[0192] An operation receiving module, used for receiving a modification operation;

[0193] The modification module is used to modify the configuration parameters corresponding to the modification operation in the configuration file in response to the modification operation, wherein the configuration file includes the configuration parameters of the service corresponding to at least one application.

[0194] In some embodiments of the present application, the first information acquisition module 403 is specifically used to:

[0195] The first function is called through the i-th thread to obtain resource usage information of the i-th application;

[0196] When the first determination module 404 determines the service cost of the target service corresponding to the i-th application according to the resource usage information of the i-th application through the i-th thread, it is specifically used to:

[0197] Calling the second function, determining the service cost of the target service corresponding to the i-th application according to the resource usage information of the i-th application through the i-th thread;

[0198] Wherein, both the first function and the second function are implemented based on the object-oriented dynamic type language Python.

[0199] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0200] The present application also provides an electronic device, such as Figure 5 As shown, it includes a processor 501, a communication interface 502, a memory 503 and a communication bus 505, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 505.

[0201] Memory 503, used for storing computer programs;

[0202] The processor 501 is used to execute the program stored in the memory 503, and implements the following steps:

[0203] Get the application list;

[0204] For each application in the application list, start a thread;

[0205] Obtain resource usage information of the i-th application through the i-th thread, where i is an integer from 1 to N, and N is the number of applications in the application list;

[0206] When the resource usage information of the i-th application is obtained, the service cost of the target service corresponding to the i-th application is determined according to the resource usage information of the i-th application;

[0207] The threads corresponding to the applications in the application list run in parallel.

[0208] The communication bus 505 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus 505 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0209] The communication interface 502 is used for communication between the terminal and other devices.

[0210] The memory 503 may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory 503 may also be at least one storage device located away from the aforementioned processor.

[0211] The above-mentioned processor 501 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0212] In another embodiment provided by the present application, a computer-readable storage medium is also provided, which stores instructions. When the computer-readable storage medium is executed on a computer, the computer executes the steps of the method for processing service-related information of any application in the above embodiments.

[0213] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the steps of the method for processing service-related information of any application in the above embodiments.

[0214] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loading and executing computer program instructions on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integrated. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.

[0215] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0216] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0217] The above are only preferred embodiments of the present application and are not intended to limit the protection scope of the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application are included in the protection scope of the present application.

Claims

1. A method for processing service-related information of an application, characterized in that: The method comprises: Get the application list; For each application in the application list, start a thread; Obtain resource usage information of the i-th application through the i-th thread, where i is an integer from 1 to N, and N is the number of applications in the application list; When the resource usage information of the i-th application is obtained, the service cost of the target service corresponding to the i-th application is determined through the i-th thread according to the resource usage information of the i-th application; The threads corresponding to the applications in the application list run in parallel.

2. The method according to claim 1, characterized in that: The method further comprises: Obtaining parameter information of a target resource through an i-th thread, wherein the target resource includes hardware resources included in each container in the i-th application, and the parameter information of the target resource includes at least one of a utilization rate and an occupied amount; According to the parameter information of the target resource, an allocation strategy for allocating hardware resources to each container of the i-th application is adjusted.

3. The method according to claim 1, characterized in that The resource usage information of the i-th application includes parameter information of each hardware resource included in the target resource, wherein the parameter information of the hardware resource includes the usage duration of the hardware resource in R time units and type information of the hardware resource, and the target resource includes the hardware resources included in each container in the i-th application, where R is a positive integer; The determining, according to the resource usage information of the i-th application, the service cost of the target service corresponding to the i-th application includes: According to the type information, obtaining a first cost of each hardware resource included in the target resource within the R time units; The service cost of the target service corresponding to the i-th application within the target time period is determined according to the first cost and the usage duration of each hardware resource included in the target resource within the R time units.

4. The method according to claim 3, characterized in that The method further comprises: In the case where parameter information of a first hardware resource included in a first container within a first application is not obtained, determining a first interval and a first number according to parameter information of a target interface, wherein the target interface is an interface called by a thread corresponding to the first application, the first application is one of the applications in the application list, the first container is one of the containers within the first application, and the first hardware resource is one of the hardware resources included in the first container; calling the target interface at the first interval through the thread corresponding to the first application to reacquire parameter information of the first hardware resource; When the number of calls to the target interface reaches the first number and the parameter information of the first hardware resource is still not obtained, first indication information is recorded, wherein the first indication information is used to indicate that the parameter information of the first hardware resource cannot be obtained.

5. The method according to claim 1, characterized in that The method further comprises: The service cost of the service that calls the target service is determined according to the service cost of the target service and the calling parameters of the service that calls the target service.

6. The method according to claim 1, characterized in that The method further comprises: Obtaining, through the i-th thread, application identification information of the i-th application, identification information of the target service, and container information of a container within the i-th application; The correspondence between the application identification information of the i-th application, the identification information of the target service, the container information of the container of the i-th application, and the service cost of the target service is stored.

7. The method according to claim 1, characterized in that The method further comprises: Receive modification operations; In response to the modification operation, the configuration parameters corresponding to the modification operation in the configuration file are modified, wherein the configuration file includes configuration parameters of a service corresponding to at least one application.

8. The method according to any one of claims 1 to 7, characterized in that: The obtaining resource usage information of the i-th application through the i-th thread includes: The first function is called through the i-th thread to obtain resource usage information of the i-th application; The determining, through the i-th thread according to the resource usage information of the i-th application, the service cost of the target service corresponding to the i-th application includes: Calling the second function to determine the service cost of the target service corresponding to the i-th application according to the resource usage information of the i-th application through the i-th thread; Wherein, both the first function and the second function are implemented based on the object-oriented dynamic type language Python.

9. A device for processing service-related information of an application, characterized in that: The device comprises: A first acquisition module is used to acquire an application list; A thread starting module, used for starting a thread for each application in the application list; A first information acquisition module, configured to acquire resource usage information of an i-th application through an i-th thread, wherein i is an integer from 1 to N, and N is the number of applications in the application list; The first determination module is used to determine the service cost of the target service corresponding to the i-th application through the i-th thread according to the resource usage information of the i-th application when the resource usage information of the i-th application is obtained. The threads corresponding to the applications in the application list run in parallel.

10. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor is used to implement the steps of processing service-related information of the application as claimed in any one of claims 1 to 8 when executing the program stored in the memory.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the program implements the steps of processing service-related information of the application according to any one of claims 1 to 8.

12. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium and are suitable for being read and executed by a processor, so that an electronic device having the processor performs the steps of processing service-related information of the application as described in any one of claims 1 to 8.