Resource management method, device and equipment and readable storage medium
By separately allocating server resources according to the dimensions of the business process, the problem of resource preemption when multiple database instances share the same server resources is solved, ensuring the stability of business operations and full utilization of resources.
Patent Information
- Application Number
- CN202310372819.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-29
- Publication Date
- 2024-10-15
AI Technical Summary
When multiple database instances share the same server resources, it is easy to seize thread pool resources, causing the database instance process to crash and affecting business operations.
Separately allocate server resources according to the dimensions of the business process, obtain business requests, query the resource occupancy of target resource groups, and perform resource management based on pre-established resource groups and thresholds to ensure resource allocation and release.
It avoids resource conflicts between different business processes and ensures the stability of business operations and full utilization of resources.
Smart Images

Figure CN118779089A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a resource management method, apparatus, device and readable storage medium. Background Art
[0002] As business applications increase, it is necessary to deploy a database instance corresponding to each business service on the backend server side, which requires a large amount of server resources. In order to improve the utilization of server resources, multiple database instances can share the same server resources. For example, related technologies create a thread pool for each business request on the same server to enable multiple database instances to share the same server resources.
[0003] During the research and practice of related technologies, the inventors of the present application discovered that when the related technologies implement multiple database instances sharing the same server resources, since the multiple database instances are mixedly deployed on the server, multiple database instances are prone to preemption of thread pool resources, causing different database instances to affect each other during runtime, thereby causing the process of the data service instance to crash, affecting the business operation service. Summary of the invention
[0004] The embodiments of the present application provide a resource management method, apparatus, device and readable storage medium, which can allocate server resources separately according to the dimensions of business processes, avoid the impact between different business processes, and ensure the stability of business operations.
[0005] The present application provides a resource management method, including:
[0006] Obtaining a service request, and determining a target service process to which the service request belongs according to a service type of the service request, wherein the target service process has a corresponding target process identifier;
[0007] Querying the target resource group corresponding to the target process identifier, and determining the resource occupancy of the target resource group;
[0008] The target resource group is a resource group pre-established according to a resource allocation indicator corresponding to a service type of the target service process, and each resource group is associated with a corresponding resource amount threshold;
[0009] When it is detected that the resource occupancy is less than the resource amount threshold of the target resource group, the service request is executed based on the target service process running in the target resource group.
[0010] Accordingly, an embodiment of the present application provides a resource management device, including:
[0011] An acquisition unit, used for acquiring a service request and determining a target service process to which the service request belongs according to a service type, wherein the target service process has a corresponding target process identifier;
[0012] A query unit, used to query the target resource group corresponding to the target process identifier, and determine the resource occupancy of the target resource group;
[0013] The target resource group is a resource group pre-established according to a resource allocation indicator corresponding to a service type of the target service process, and each resource group is associated with a corresponding resource amount threshold;
[0014] The execution unit is configured to execute the service request based on the target service process running in the target resource group when it is detected that the resource occupancy is less than the resource amount threshold of the target resource group.
[0015] In some implementations, the resource management device further includes a creation unit, configured to:
[0016] Query resource allocation indicators based on the business type of the target business process;
[0017] Determine the target resources corresponding to the resource allocation indicator, and construct a target resource group according to the target resources;
[0018] The target business process is independently run through the target resource grouping.
[0019] In some implementations, the creation unit is further configured to:
[0020] Obtain multiple resource usages of the business types of the target business process within the target time period;
[0021] A resource allocation indicator is determined according to an average of the plurality of resource occupancy amounts.
[0022] In some implementations, the creation unit is further configured to:
[0023] Obtaining a target process identifier of the target business process, and constructing a unique mapping relationship between the target process identifier and the target resource group;
[0024] The target service process identified by the target process having the mapping relationship established is run through the target resource group.
[0025] In some implementations, the creation unit is further configured to:
[0026] Adding the target process identifier to the process task list corresponding to the target resource group;
[0027] Acquire a unit identifier of a data operation unit allocated to the target resource group;
[0028] A unique mapping relationship between the unit identifier and the target process identifier in the task list is constructed.
[0029] In some implementations, the execution unit is further configured to:
[0030] Determine a database port associated with the target resource group;
[0031] Based on the target business process running in the target resource group, data processing is performed on the business request associated with the target process identifier to obtain a business execution result;
[0032] The business execution result is stored through the database port.
[0033] In some implementations, the resource management device further includes a first releasing unit, configured to:
[0034] Detecting the memory usage of the target resource group when running the target service process;
[0035] When the memory occupancy is greater than the memory allocation threshold of the target resource group, releasing the mapping relationship between the target resource group and the target process identifier;
[0036] The target resource group whose mapping relationship has been released is released.
[0037] In some implementations, the resource management device further includes an adjustment unit, configured to:
[0038] Detecting the data transmission rate of the data reading and writing device associated with the target resource group;
[0039] When the data transmission rate is greater than the transmission speed threshold of the target resource group, the data transmission rate of the data reading and writing device associated with the target resource group is reduced.
[0040] In some implementations, the resource management device further includes a second releasing unit, configured to:
[0041] When it is detected that the resource occupancy is equal to the resource amount threshold of the target resource group, the execution of the service request is stopped, and the mapping relationship between the target resource group and the target process identifier is released;
[0042] The target resource group whose mapping relationship has been released is released.
[0043] In some implementations, the resource management device further includes a management unit, configured to:
[0044] When it is detected that the resource occupancy is greater than the resource amount threshold of the target resource group, sending a service execution request to a resource management page associated with the local device for the service request;
[0045] When receiving the service execution instruction fed back by the resource management page, executing the service request based on the target service process running in the target resource group;
[0046] When receiving the stop execution instruction fed back by the resource management page, stop executing the service request.
[0047] In some implementations, the resource management device further includes a detection unit, configured to:
[0048] Detect the total memory usage of the local device;
[0049] The query unit is used to query the target resource group corresponding to the target process identifier when the total memory occupancy is less than the memory supply threshold of the local device.
[0050] In addition, an embodiment of the present application further provides a computer device, including a processor and a memory, wherein the memory stores a computer program, and the processor is used to run the computer program in the memory to implement the steps in any resource management method provided in the embodiment of the present application.
[0051] In addition, an embodiment of the present application further provides a computer-readable storage medium, which stores a plurality of instructions, and the instructions are suitable for a processor to load to execute the steps in any one of the resource management methods provided in the embodiment of the present application.
[0052] In addition, an embodiment of the present application also provides a computer program product, including computer instructions, which, when executed, implement the steps of any resource management method provided in the embodiment of the present application.
[0053] The embodiment of the present application can obtain a business request and determine the target business process to which it belongs based on the business type of the business request, where the target business process has a corresponding target process identifier; query the target resource grouping corresponding to the target process identifier, and determine the resource occupancy of the target resource grouping; wherein the target resource grouping is a resource grouping pre-established based on the resource allocation indicator corresponding to the business type of the target business process, and each resource grouping is associated with a corresponding resource quantity threshold; when it is detected that the resource occupancy is less than the resource quantity threshold of the target resource grouping, the business request is executed based on the target business process running in the target resource grouping. It can be concluded that when this solution receives any type of business request, it can first determine the target business process to which the business request belongs in the server, and then determine the target resource grouping independently allocated to the target business process to run, and determine the resource occupancy of the target resource grouping, and by comparing the resource occupancy with the resource threshold of the target resource grouping, determine whether the target resource grouping has sufficient resources to respond to the business request, and finally, when it is determined that the target resource grouping has sufficient resources, execute the business request through the target business process run by the target resource grouping; in this way, server resources are allocated separately according to the dimensions of the business process to avoid the impact between different business processes, ensure the stable operation of the business process, and achieve full utilization of resources while ensuring the stability of business operations. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0055] Figure 1 is a schematic diagram of a scenario of a resource management system provided in an embodiment of the present application;
[0056] Figure 2 It is a schematic diagram of the steps of the resource management method provided in the embodiment of the present application;
[0057] Figure 3 is another step flow chart of the resource management method provided in the embodiment of the present application;
[0058] Figure 4 It is a scenario diagram of the resource management method provided in the embodiment of the present application;
[0059] Figure 5 A flowchart of a resource management method for each business process provided in an embodiment of the application;
[0060] Figure 6is a schematic diagram of the structure of a resource management device provided in an embodiment of the present application;
[0061] Figure 7 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0062] 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 only 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 those skilled in the art without creative work are within the scope of protection of this application.
[0063] The embodiments of the present application provide a resource management method, device, equipment and readable storage medium. Specifically, the embodiments of the present application will be described from the dimension of the resource management device, which can be integrated in a computer device, which can be a server or a user terminal and other devices. Among them, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. Among them, the user terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a smart home appliance, a car terminal, an intelligent voice interaction device, an aircraft, etc., but is not limited to this.
[0064] It can be understood that in the specific implementation of this application, data related to user information, user usage records, user status, etc. are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0065] The resource management method provided in the embodiments of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving, business requests and other scenarios involving resource management. These scenarios are not limited to being implemented by cloud services, cloud technologies and the like, and are specifically described by the following embodiments:
[0066] For example, see Figure 1 , is a schematic diagram of a scenario of a resource management system provided in an embodiment of the present application. The scenario includes a terminal and / or a server.
[0067] A service client may be installed on the terminal, and the user may rotate or configure the service on the service client to send a service request to the server through the service client; in addition, the user may also select or configure the service on the web page to send a service request to the server.
[0068] The server can obtain a business request and determine the target business process to which it belongs based on the business type of the business request, where the target business process has a corresponding target process identifier; query the target resource grouping corresponding to the target process identifier, and determine the resource occupancy of the target resource grouping; wherein the target resource grouping is a resource grouping pre-established based on the resource allocation indicator corresponding to the business type of the target business process, and each resource grouping is associated with a corresponding resource quantity threshold; when it is detected that the resource occupancy is less than the resource quantity threshold of the target resource grouping, the business request is executed based on the target business process running in the target resource grouping.
[0069] Among them, the resource management process may include: determining the target business process to which the business request belongs, querying the target resource grouping that runs the target business process, determining the resource occupancy of the target resource grouping, determining the resource availability of the target resource grouping, executing the business request through the target resource grouping, etc.
[0070] It should be noted that the order of the following embodiments is not intended to limit the preferred order of the embodiments.
[0071] In the embodiment of the present application, the resource management device will be described from the perspective of the resource management device, and the resource management device can be specifically integrated into a computer device such as a terminal or a server. Figure 2 , Figure 2 This is a schematic diagram of the steps of a resource management method provided in an embodiment of the present application. In the embodiment of the present application, the resource management device is specifically integrated on a server as an example. When the processor on the server executes the program instructions corresponding to the resource management method, the specific process is as follows:
[0072] 101. Obtain a service request, and determine a target service process to which the request belongs according to the service type of the service request.
[0073] In the embodiment of the present application, the response to each service request triggered by the front end requires the support of the backend database, and the response process of the service request requires a database instance to interact with the backend database to perform service data, thereby realizing the response to the service request. Among them, the database instance can be understood as a service process, and the service process may include one or more threads, each of which can be used to respond to the service request, which can be understood as the executor of the service request or related tasks.
[0074] In the embodiment of the present application, the response to the business request needs to occupy the operating resources, and the operating resources of the server are limited to the hardware equipment for data processing. In order to make full use of the operating resources in each data processing hardware device, databases associated with multiple different types of businesses can be deployed in the same server to achieve full utilization of resources. However, when databases of multiple different types of businesses share a server, there will generally be a situation where multiple different types of business processes are running at the same time. In order to avoid the mutual influence of multiple business processes during operation, the embodiment of the present application sets up independent operating resources on the server side for business processes of different business types, so as to avoid different types of business processes from competing for operating resources with each other, and effectively prevent the phenomenon of mutual influence between different business processes, thereby ensuring that the business processes can run healthily and reliably.
[0075] Among them, the business request can be an information interaction request initiated by an application, website, etc., which is used to request the corresponding data processing end to perform data operations to obtain the running status or operation status of the relevant business. For example, taking an instant messaging application as an example, when the instant messaging application adds a chat object friend, a business request for adding a chat object friend can be sent to the data processing end, so that the instant messaging business process in the background server responds to the business request, so as to record the response status of adding the chat friend in the back-end database; for another example, taking a commodity shopping application as an example, when a user completes a commodity order, the commodity shopping application or webpage will send a commodity order business request to the background, so that the business process running in the background server responds to the request and records the response status of the commodity order in the back-end database. It should be noted that the response status referred to above can be understood as a data operation result or a response result.
[0076] The business type may be information indicating a business category, which may be indicated by a business unique identifier to indicate the corresponding business type, and is used to reflect the identity or attributes of the business, etc. For example, the business type may be an identifier in the form of a registration number, name, any number, code, custom text, etc. associated with the corresponding business to indicate the business type. For example, the business type of a purchase order on a commodity shopping platform may be regarded as a purchase business corresponding to the commodity shopping platform, and the business type of a business request for a chat message of an instant messaging may be regarded as a message business, etc.
[0077] In the embodiments of the present application, the same business platform or system may have multiple business functions, each of which may correspond to a backend, that is, a business process on the server side, and the business type may also be understood as a business function type; for example, a communication application is not limited to including: instant chat function, video call function, resource payment function, shopping function, etc., then each business function type corresponds to a business process, and the business request of each business function type is executed through the relevant target business process. It should be noted that the business types can be distinguished only under the same business platform or system, and each business type can be represented by a unique business identifier, which can help distinguish business processes with similar business function types under different business platforms or systems.
[0078] The target business process may be a program for responding to business requests, which runs in the server and is used to realize the interaction between the business request and the backend database. It belongs to a database instance. When the target process responds to the business request, its response process is not limited to data definition, data query, data maintenance, data change, database operation control, etc. Through the target business process, the business data interaction between the business request of the user front end and the backend database of the server side can be realized. For example, the target business process may be a MySQL process, which is used to store the business execution results in a relational database after making corresponding data processing for the business request.
[0079] Among them, the target business process has a corresponding target process identifier, which refers to the process identifier (Process identifier, Pid) of the target business process in the operating system, which is used to represent the identity of the target business process so as to distinguish it from other processes in the process management system.
[0080] In an embodiment of the present application, the server side can receive a business request issued by a business client or a web page. The business request has a corresponding business type, which is used to represent the attributes or identity of the business request. Through the business type, the back end of the business client responsible for business processing requests and data management in the server can be queried, that is, the target business process to which the business request belongs on the server side is determined; it can be understood that since the server side has pre-allocated independent operating resources for the target business process, it is possible to subsequently query its independent operating resources based on the target process identifier of the target business process and use them to respond to the current business request.
[0081] Exemplarily, taking the client of a shopping platform as an example, when the client sends a business request for a product transaction order to the server side, the server side can determine the business type of the business request for the product transaction order, and determine the platform category, business category and other related information to which the business request belongs based on the business type. Thus, based on the relevant information of the business request determined above, the target business process to which it belongs on the server side is determined, so that the server side can subsequently determine the operating resources used to run the target business process based on the target process identifier of the target business process, and use the determined operating resources to run the target business process to respond to the business request.
[0082] By means of the above method, when a service request is obtained, the target service process to which the service request belongs can be determined in real time, so that the service request can be responded to later by grouping resources used to run the target service process.
[0083] 102. Query the target resource group corresponding to the target process identifier, and determine the resource usage of the target resource group.
[0084] In an embodiment of the present application, after determining the target business process to which the business request belongs, the target resource grouping used to run the target business process can be queried based on the target process identifier associated with the target business process to determine the running resources used to support the current business request response; further, the resource occupancy in the target resource grouping is determined in order to understand the resource usage, and then determine whether to respond to the business request through the target business process running in isolation through the target resource grouping based on the resource usage.
[0085] It should be noted that the resources referred to in the embodiments of the present application may be hardware resources on the server, such as central processing unit (CPU), memory, disk input / output (IO) and other hardware resources. In order to prevent the business processes corresponding to multiple databases deployed on the server from affecting each other, the embodiments of the present application may configure independent hardware resource isolation groups for each business process, so as to isolate the operation of the business process on the hardware resources and avoid affecting each other.
[0086] The target resource group is a resource group pre-established according to the resource allocation index corresponding to the business type of the target business process, and each resource group is associated with a corresponding resource amount threshold. Specifically, the target resource group can be used to independently run a target business process, and belongs to a resource isolation group, which has corresponding hardware resources, such as an operating unit with a specific number of CPUs, a limited amount of usable memory, and a specific disk read and write rate, etc., that is, each resource isolation group is pre-configured according to a corresponding number of hardware resources, and has a corresponding resource amount threshold. Taking memory resources as an example, assuming that the memory space configured for the target resource group is 50 gigabytes (Gibibyte, GB), the resource amount threshold of the memory can be 50GB. For another example, assuming that the disk read and write rate configured for the target resource group is 100 megabytes (Mbyte, MB) / second, the resource amount threshold of the read and write rate (transmission speed) is 100MB / second, so that the resource isolation group runs the target business process in accordance with the above resource amount threshold.
[0087] The resource occupancy may be the number of resources currently in use among the hardware resources allocated to the target resource group. For example, in the target resource group, since the resources pre-allocated to the target resource group are limited, in order to ensure the health of the resources of the target resource group, it is necessary to detect the resource occupancy corresponding to the target resource group in real time. Taking memory resources as an example, the resource occupancy of the memory refers to the amount of content space actually occupied by the target resource group when running the current target business process, such as 10G, 30G, 40G, etc.
[0088] In some implementations, when querying the target resource grouping for running the target business process, the query can be made according to the target process identifier. Specifically, in order to realize independent operation of the target business process for isolation, when starting to run the target business process through the target resource grouping, the target process identifier corresponding to the target business process is added to the process task list of the target resource grouping, so that the target resource grouping is associated with the target business process. Therefore, the target resource grouping for running the target business process can be queried through the target identifier.
[0089] In the embodiment of the present application, since the hardware resources in the server are limited, in order to ensure that the resources of the server can support the operation of each business process, when a business request is received, the total resource usage of the server side can be determined at any time before responding to the business request. For example, before step 102, the total resource usage of the server is determined, such as the total usage of one or more resources such as memory, read / write speed, and CPU, so as to subsequently determine whether to respond to the business request.
[0090] In some implementations, after receiving the service request, the server may determine the total amount of memory currently used by the server to determine whether to subsequently allocate a target resource group for the service request. For example, before step 102, it may also include: detecting the total amount of memory occupied by the local device; then step 102 may include: when the total amount of memory occupied is less than the memory supply threshold of the local device, querying the target resource group corresponding to the target process identifier.
[0091] The local device may be a server local device, specifically referring to the execution subject of the resource management method. For example, when the resource management method is applied to a terminal, the local device refers to the terminal device, which is not specifically limited here.
[0092] The memory supply threshold may be the total amount of memory provided by the local device to each business process. Specifically, when the local device runs its own operating system and related program processes, it needs to occupy certain memory resources for the operation of the local device itself. In addition to the memory resources required for its own operation, other memory resources can be regarded as memory resources provided for other processes, and the total amount of memory resources provided for other processes can be used as the memory supply threshold. In addition, the total amount of memory resources of the local device can also be used as the memory supply threshold.
[0093] The total memory usage may be the memory resource usage corresponding to all current processes in the local device. In addition, it may also be the total memory resource usage occupied by other processes except the operation of the local device itself.
[0094] Specifically, taking the server as a local device as an example, in order to ensure the stability of the business processes already running in the server, the usage of memory resources in the server can be detected in real time. For example, when a new business request is received, the actual total amount of memory resources occupied by the server is detected, and the total amount of memory occupied is compared with the memory supply threshold. When the total amount of memory occupied is less than the memory supply threshold of the local device, it means that there is still usable memory space in the server. At this time, the subsequent response process can be executed for the business request, such as querying the target resource group occupied by the business request during subsequent execution.
[0095] For example, assuming that the total memory space of the server is 10TB (Terabyte), by detecting the total memory space occupied in the server in real time, when the total memory space occupied when a business request is received is 8TB, it is determined that there is remaining memory space in the server, and the target resource grouping used to support the response to the business request can be further determined to determine whether the resources allocated to the target resource grouping (such as memory, read / write speed or CPU) can support the response to the business request.
[0096] In an embodiment of the present application, in order to ensure that the business requested by the front-end can be responded to, a back-end corresponding to each business, that is, a target business process, needs to be run in the server. In order to enable each business process to run independently and avoid mutual interference between business processes due to the allocation of running resources, a separate resource grouping can be set up for each business process to independently run the corresponding business process, thereby realizing independent management of the running resources used to run each business process.
[0097] In some implementations, in order to independently manage each business process through the running resources of the server, a resource isolation group may be separately allocated to each business process so that the corresponding business process can be independently run through the resource isolation group. For example, before "querying the target resource group corresponding to the target process identifier" in step 102, the following may also be included:
[0098] (a.1) Query resource allocation indicators according to the business type of the target business process;
[0099] (a.2) Determine the target resources corresponding to the resource allocation indicators, and construct target resource groups based on the target resources;
[0100] (a.3) Run the target business process independently through target resource grouping.
[0101] Among them, the resource allocation indicator can be an allocation indicator when allocating running resources to the target business process, which is used to indicate the resource amount of the target resource group corresponding to the target business process, for example, indicating the allocated quantity of resources such as the CPU's computing unit, memory, read and write rate when configuring the target resource group.
[0102] It should be noted that the resource allocation index can be determined based on the resource occupancy of the target business process in the past, such as determining the resource allocation index based on the average value, maximum value, etc. of multiple resource occupancy amounts in the past. Specifically, taking the average value of resource occupancy amounts as an example, step (a.1) may include: obtaining multiple resource occupancy amounts of the business types of the target business process in a target time period, and the target time period may refer to any time period, such as the past month, week, day, hour, etc.; and then determining the resource allocation index based on the average value of multiple resource occupancy amounts.
[0103] Exemplarily, when determining the resource allocation index, the memory space, disk IO, CPU running unit and other resource occupancy of the target business process during its past operation can be obtained respectively. For example, the memory space, disk IO and other resource occupancy of each week in the past three weeks can be obtained respectively to obtain three resource occupancy combinations. Each resource occupancy combination includes the resource occupancy of memory space and disk IO. Among them, when determining the weekly resource occupancy, the maximum resource occupancy can be taken. Finally, the memory resource occupancy of the three resource occupancy combinations is averaged. Similarly, the resource occupancy of disk IO is also averaged, thereby obtaining the resource allocation index.
[0104] Further, after obtaining the resource allocation index of the target business process, the target resource group can be configured from the server according to the resource allocation index. For example, if the number of running resources corresponding to the resource allocation index is 2 CPU computing units, 50GB memory space, 100MB / second disk read / write rate, etc., then determine whether there are enough resources in the server according to the above resource allocation index. When there are sufficient resources, select the target resources in the server according to the above resource allocation index. The target resources include 2 CPU computing units, 50GB memory space, 100MB / second disk read / write rate, and establish resource groups with the above selected resources, thereby obtaining the target resource group corresponding to the target business process. In this way, the resource allocation amount of the target resource group can be determined according to the total resource occupation of the business process of the business type, so as to ensure that the target resource group has enough resources to run the target business process, and avoid excessive resources allocated to the target resource group to cause waste of running resources, thereby achieving full utilization of server resources.
[0105] After that, the target business process can be run separately through the established target resource grouping, so that the target business process can independently enjoy the fixed number of computing units, internal memory space, disk read and write speed and other resources in the target resource grouping, so as to avoid other types of business processes affecting the normal operation of the current target business process, or avoid the target business process from occupying the server's operating resources in excess and affecting the operation of other types of business processes, thereby ensuring the stability of each business process in the server during operation and ensuring the normal operation of each business.
[0106] In some implementations, in order to realize independent operation of the target business process through the target resource group, it is necessary to establish a mapping relationship between the target resource group and the target process identifier of the target business process, so that the target resource group only runs the target business process. Specifically, step (a.3) may include:
[0107] (a.3.1) Obtain the target process ID of the target business process, and construct a unique mapping relationship between the target process ID and the target resource group;
[0108] (a.3.2) The target business process identified by the target process with the established mapping relationship is run through the target resource group.
[0109] Specifically, after obtaining the target resource grouping, the target process identifier of the target business process that needs to be run in isolation can be determined first, so as to bind the target process identifier to the target resource grouping, so as to establish a unique mapping relationship between the target process identifier and the target resource grouping, that is, the target resource grouping is only associated with the target process identifier, and at the same time, the association between other process identifiers and the target resource grouping is intercepted. Finally, the target business process with the target process identifier that currently has a mapping relationship with the target resource grouping is run through the target resource grouping, so as to realize the isolation of the target business process through the target resource grouping.
[0110] In some implementations, when binding the target process identifier to the target resource group, the target process identifier may be specifically bound to one or more resources in the target resource group. For example, taking the resource binding of the computing unit of the central processing unit (CPU) as an example, the "constructing a unique mapping relationship between the target process identifier and the target resource group" in step (a.3.1) may include:
[0111] (a.3.1.1) Add the target process ID to the process task list corresponding to the target resource group;
[0112] (a.3.1.2) obtaining the unit identifier of the data operation unit assigned to the target resource group;
[0113] (a.3.1.3) Construct a unique mapping relationship between the unit identifier and the target process identifier in the task list to obtain the unit identifier of the data operation unit assigned to the target resource group.
[0114] The process task list can be understood as a process management list associated with the target resource group, and a process identifier can be added to the list. The process identifier in the task list indicates the business process that the target resource group needs to run and manage.
[0115] Among them, the data operation unit can be a computing unit of the operating system, such as a computing core of a central processing unit (CPU), which belongs to a hardware resource, and the computing core has a corresponding code. Taking a server as an example, it is assumed that the central processing unit (CPU) is composed of 16 computing cores. However, in order to realize resource management of the data operation unit, resource allocation can be performed for resource groups through the unit identification of each computing unit. The unit identification can be a number carried by the computing unit itself, such as a code or string or unique identifier at the time of leaving the factory, or a number can be pre-assigned to each computing unit, such as numbers 1, 2, 3...16, or other forms of numbers, which are not limited here; the computing resources in the resource group can be effectively managed through the unit identification.
[0116] Specifically, in order to construct a mapping relationship between the target resource group and the target process identifier, after obtaining the target process identifier of the target business process, the target process identifier can be added to the process task list corresponding to the target resource group, so as to add the target business process to the target resource isolation group at the process task management level. Furthermore, the target resource group is pre-allocated with one or more data computing units of the central processor, and the target business process identifier can be bound to the number of one or more data computing units allocated to the target resource group, so that there is a mapping relationship between the target business process that has completed the process task management and the computing unit allocated to the target resource group, so that the target business process can be subsequently run through the data computing unit in the target resource group, so as to realize the independent operation of the target business process on the computing resources.
[0117] In addition, the embodiments of the present application can also perform resource management on memory resources and disk read / write rate resources to ensure that the target business process only uses memory resources and disk read / write rate resources within a limited range during operation. For example, in combination with the foregoing, the memory space allocation amount and disk read / write rate allocated to the target resource group have been determined based on the resource allocation index. Therefore, a memory allocation amount threshold can be generated based on the memory space allocation amount, and a data transmission speed threshold can be generated based on the disk read / write rate. The target process identifier is associated with the memory allocation amount threshold and the transmission speed threshold, respectively, to construct a mapping relationship between the target process identifier and the memory space and disk read / write rate of the target resource space.
[0118] In some implementations, when constructing a mapping relationship between a target process identifier and a memory space in a target resource group, the target process identifier can also be bound to a memory space address; then before establishing an association with a memory resource, a target memory space address of a corresponding size can be selected according to the memory space allocation amount of the resource allocation indicator, and the target memory space address can be used as one of the target resources corresponding to the resource allocation indicator, so as to construct a target resource group. At this time, when binding the target process identifier to the memory resource, the process can include: determining the target memory space address allocated to the target resource group, establishing a mapping relationship between the target process identifier and the target memory space address, thereby achieving binding with the target process identifier on the memory resource.
[0119] Through the above method, a resource group can be configured separately for each business process, and the target business process can be independently run through the target resource grouping to independently manage the running resources of the target business process. Thereafter, when a business request related to the target business process is received, the resource occupancy in the target resource grouping is queried first, so as to subsequently determine whether to respond to the business request within the target resource grouping, thereby ensuring the stability of the operation of the target business process.
[0120] In an embodiment of the present application, in order to determine whether to respond to the business request to be responded to within the target resource group, the resource occupancy of the target resource group may be compared with its corresponding resource threshold, and the comparison results may be: greater than the resource threshold, equal to the resource threshold, and less than the resource threshold. Then, based on the above comparison results, it is determined whether to respond to the corresponding business request within the target resource group, and the target business process running in the target resource group is managed.
[0121] In some implementations, when the resource usage of the target resource group is equal to the resource amount threshold, it indicates that the target business process currently uses too many resources during operation. If the target business process continues to respond to business requests, it will cause the target business process to exceed the operating resources configured by the target resource group, affecting the operation of other business processes. At this time, the target business process needs to be managed. For example, the method may also include: when it is detected that the resource usage is equal to the resource amount threshold of the target resource group, stopping the execution of the business request and releasing the mapping relationship between the target resource group and the target process identifier; releasing the target resource group whose mapping relationship has been released.
[0122] Exemplarily, taking memory resources as an example, assuming that the available memory space of the target resource group is configured to be 50GB, the resource threshold of the memory of the target resource group is 50GB. When the memory space occupied by the target resource group when running the target business process reaches 50GB, for the newly received business request, the response of the target business process run by the target resource group to the business request will be intercepted. At the same time, since the memory resources occupied by the target business process have reached the corresponding resource threshold, in order to avoid the target business process from affecting other business processes and ensure that other business processes in the server can run normally, the target business process can be stopped through the process management mechanism. Specifically, the target process identifier can be removed from the process task list in the target resource group to release the mapping relationship between the target resource group and the target process identifier, so as to avoid the target resource group from continuing to run the target business process. After that, the various resources in the target resource group whose mapping relationship has been released are released for subsequent use.
[0123] In addition, when the resource usage of the target resource group is equal to the resource threshold, the execution of the business request can be suspended until it is detected that the resource usage of the target resource group is less than the resource threshold, and the business request is executed through the target business process running by the target resource group.
[0124] In some implementations, when the resource usage of the target resource group is greater than the resource threshold, it indicates that the target business process currently uses too many resources during operation. However, due to human intervention or other intervention, the target business process still runs through the target resource group and other resources outside the group. At this time, for the newly received business request, it can be determined whether to respond by asking for instructions. Specifically, the method may also include: when it is detected that the resource usage is greater than the resource threshold of the target resource group, sending a business execution request to the resource management page associated with the local device for the business request; when a business execution instruction is received from the resource management page, executing the business request based on the target business process running in the target resource group; when a stop execution instruction is received from the resource management page, stopping the execution of the business request.
[0125] Exemplarily, taking memory resources as an example, assuming that the available memory space of the target resource group is configured to be 50GB, the memory resource threshold of the target resource group is 50GB. Assuming that before the response to the last business request, the memory resources occupied by the target business process are 49.5GB, which is less than the memory resource threshold, and after the target business process responds to the last business request, the memory resources occupied are 51GB, which exceeds the memory resource threshold configured for the target resource group. At this time, for a newly received business request, a request can be made to the resource management page connected or associated with the local device (server), and a business execution request can be specifically sent to the resource management page. After the relevant personnel query the attributes of the business request for execution in the resource management page, it can be determined whether to continue to execute the business request through the target resource group, such as configuring a business execution instruction or stopping the execution instruction on the resource management page. When the server receives a business execution instruction fed back by the resource management page, it can continue to execute the pending business request through the target business running in the target resource group; when the server receives a stop execution instruction fed back by the resource management page, it can stop executing the pending business request to avoid the target business process from excessively occupying other resources outside the target resource group during operation.
[0126] 103. When it is detected that the resource usage is less than the resource amount threshold of the target resource group, the service request is executed based on the target service process running in the target resource group.
[0127] In an embodiment of the present application, when it is detected that the resource occupancy of the target resource group when running the target business process is less than its corresponding resource threshold, it means that there are idle running resources in the target resource group. Therefore, the target business process can continue to run based on the target resource group to execute the current business request to be responded to through the target business process to complete the response to the business request.
[0128] In some implementations, the process of responding to a business request belongs to a data processing process, which involves data interaction with a business database, such as data reading, business execution result storage, etc. Specifically, "executing a business request based on a target business process running in a target resource group" in step 103 may include:
[0129] (103.1) Determine the database port associated with the target resource group;
[0130] (103.2) Based on the target business process running in the target resource group, data processing is performed on the business request associated with the target process identifier to obtain a business execution result;
[0131] (103.3) The business execution results are stored through the database port.
[0132] The database port may be a data transmission interface of the target database, that is, a port for reading, writing or data interaction. There is an association relationship between the port and the target resource grouping to facilitate data reading, writing and storage.
[0133] Specifically, taking the MySQL process as the target business process, the corresponding database is the MySQL database. There is an association between the data transmission port of the MySQL database and the target resource grouping. When the MySQL process is run through the target resource grouping, data processing is performed on the target-identified related business requests by running the MySQL process. The data processing process includes but is not limited to data definition, data query, data maintenance or database operation control, etc., wherein the processing process can be executed by any thread contained in the MySQL process.
[0134] For example, taking a product order as a business request, the MySQL process processes the data of the product order, processes the payment calculation, product inventory, product ownership, product delivery docking and other information when the product order is completed, and obtains the business execution result; then, the business execution result is stored in the MySQL database through the database port. After that, the business execution result can also be returned to the business request end, such as the client, and displayed on the client page.
[0135] In an embodiment of the present application, the resource occupancy of the target resource group can be detected in real time. For example, after responding to a received business request, the current resource occupancy of the target business process in the target resource group, such as memory space or data transmission rate, can be detected, thereby managing the resource occupancy used to isolate and run the target business process.
[0136] In some implementations, taking memory resources as an example, by detecting the memory space occupied by the target business process after responding to a business request, or detecting the memory space occupied by the target business process when executing a business request, a detection result is obtained, and the resource occupation of the target business process is managed based on the detection result. Specifically, after step 103, the following may also be included:
[0137] (103.a.1) Detecting the memory usage of the target resource group when running the target business process;
[0138] (103.a.2) When the memory usage is greater than the memory allocation threshold of the target resource group, the mapping relationship between the target resource group and the target process identifier is released;
[0139] (103.a.3) Release the target resource group whose mapping relationship has been unmapped.
[0140] Exemplarily, assuming that the available memory space of the target resource group is configured to be 50GB, that is, the memory allocation threshold of the target resource group is 50GB, when the target business process responds to the business request, the memory space resource occupancy of the target resource group when running the target business process is detected. When the target business process running through the target resource group executes the business request, if the memory space occupied by it is greater than the memory allocation threshold, the mapping relationship between the target resource group and the target process identifier is released. Specifically, the business request can be stopped, and the target process identifier in the process task list associated with the target resource group is removed to release the mapping relationship between the target resource group and the target identifier. The target resource group whose mapping relationship has been released no longer runs the target business process and is in an idle state. Furthermore, the target resource group in the idle state is released for subsequent use by any process.
[0141] In some implementations, when a target business process running through a target resource group executes a business request, the read and write rate or read and write frequency of the disk associated with the target resource group can be detected, which can be understood as a data transmission rate, and a rate detection result is obtained. Then, the disk resources occupied by the target business process can be managed based on the rate detection result. Specifically, after step 103, the following may also be included:
[0142] (103.b.1) Detecting the data transmission rate of the data reading and writing device associated with the target resource group;
[0143] (103.b.2) When the data transmission rate is greater than the transmission speed threshold of the target resource grouping, the data transmission rate of the data read / write device associated with the target resource grouping is reduced.
[0144] The data reading and writing device may be a disk for storing data, specifically, reading or storing data in the disk by reading / writing data. The data transmission rate refers to the rate at which the disk reads or writes data, for example, it may refer to the bandwidth of the disk, the frequency of reading and writing per unit time (such as IOPS), and the amount of data transmitted per unit time (such as the amount of data transmitted per second).
[0145] Specifically, when a business request is responded to by a target business process running in a target resource group, the data transmission rate of the target business process in the target resource group when executing the business request can be detected, and the data transmission rate can be compared with the data transmission speed threshold that limits the target resource group; further, when the data transmission rate is greater than the transmission speed threshold preconfigured to the target resource group, it means that the target business process occupies more disk transmission resources when executing the business request, which exceeds the transmission rate allocated to the target resource group. At this time, in order to prevent the target business process from affecting the data transmission process of other processes in the server, the data reading and writing device associated with the target resource group can be controlled to reduce the data transmission rate of the target business process running in the target resource group.
[0146] For example, assuming that the disk read and write rate of the target resource grouping is configured to be 100MB / s, the transmission speed threshold is 100MB / s. When the service request is executed by the target business process running in the target resource grouping, its data transmission rate is detected. If it is detected that the data transmission rate of the target business when executing the service request is 120MB / s, the bit rate and read and write frequency of the target business process when executing the service request can be reduced to control the bandwidth when reading and writing magnetic disks, thereby reducing the data transmission rate of the data reading and writing devices associated with the target resource grouping.
[0147] As can be seen from the above, the embodiments of the present application can obtain a business request and determine the target business process to which it belongs based on the business type of the business request, where the target business process has a corresponding target process identifier; query the target resource grouping corresponding to the target process identifier, and determine the resource occupancy of the target resource grouping; wherein the target resource grouping is a resource grouping pre-established based on the resource allocation indicator corresponding to the business type of the target business process, and each resource grouping is associated with a corresponding resource quantity threshold; when it is detected that the resource occupancy is less than the resource quantity threshold of the target resource grouping, the business request is executed based on the target business process running in the target resource grouping. It can be concluded that when this solution receives any type of business request, it can first determine the target business process to which the business request belongs in the server, and then determine the target resource grouping independently allocated to the target business process to run, and determine the resource occupancy of the target resource grouping, and by comparing the resource occupancy with the resource threshold of the target resource grouping, determine whether the target resource grouping has sufficient resources to respond to the business request, and finally, when it is determined that the target resource grouping has sufficient resources, execute the business request through the target business process run by the target resource grouping; in this way, server resources are allocated separately according to the dimensions of the business process to avoid impacts between different business processes, ensure the stable operation of the business process, and achieve full utilization of resources while ensuring stability during business operations.
[0148] According to the method described in the above embodiment, the following is further described in detail with examples.
[0149] The embodiment of the present application takes resource management as an example to further describe the resource management method provided in the embodiment of the present application.
[0150] Figure 3 is another step flow chart of the resource management method provided in the embodiment of the present application, Figure 4 is a schematic diagram of a scenario of a resource management method provided in an embodiment of the present application, Figure 5 Flowchart of the resource management method for each business process provided in the application embodiment. For ease of understanding, the application embodiment is combined with Figure 3-5 Give a description.
[0151] In the embodiment of the present application, the resource management device will be described from the perspective of the resource management device, which can be integrated into a computer device such as a server. For example, when the processor on the computer device executes the program corresponding to the resource management method, the specific process of the resource management method is as follows:
[0152] 201. The server queries a resource allocation indicator according to a business type of a target business process.
[0153] Among them, the resource allocation indicator can be an allocation indicator when allocating running resources to the target business process, which is used to indicate the resource amount of the target resource group corresponding to the target business process, for example, indicating the allocated quantity of resources such as the CPU's computing unit, memory, read and write rate when configuring the target resource group.
[0154] It should be noted that the resource allocation index may be determined based on the resource usage of the target business process in the past, such as by determining the resource allocation index based on the average value, maximum value, etc. of multiple resource usages in the past.
[0155] Exemplarily, when determining the resource allocation index, the memory space, disk IO, CPU running unit and other resource occupancy of the target business process in the past can be obtained respectively, such as obtaining the memory space, disk IO and other resource occupancy of each week in the past three weeks, and obtaining three resource occupancy combinations, each of which includes the resource occupancy of memory space and disk IO. When determining the weekly resource occupancy, the maximum resource occupancy can be taken. Finally, the memory resource occupancy of the three resource occupancy combinations is averaged. Similarly, the resource occupancy of disk IO is also averaged, thereby obtaining the resource allocation index. The above is only an example and is not a specific limitation of the implementation method.
[0156] 202. The server determines the target resources corresponding to the resource allocation indicator, and constructs a target resource group according to the target resources.
[0157] In an embodiment of the present application, after obtaining the resource allocation indicator of the target business process, the target resource grouping can be configured from the server according to the resource allocation indicator. For example, the number of running resources corresponding to the resource allocation indicator is 2 CPU computing units, 50GB of memory space, 100MB / second disk read and write rate, etc., then the above resource allocation indicators are used to determine whether there are sufficient resources in the server. When there are sufficient resources, the target resources in the server are selected separately according to the above resource allocation indicators. The target resources include 2 CPU computing units, 50GB of memory space, and 100MB / second disk read and write rate, and the above selected resources are used to establish resource isolation groups, thereby obtaining the target resource grouping for running the target business process.
[0158] The target resource group is a resource group pre-established according to the resource allocation index corresponding to the business type of the target business process, and each resource group is associated with a corresponding resource amount threshold. Specifically, the target resource group can be used to independently run a target business process, and belongs to a resource isolation group, which has corresponding hardware resources, such as an operating unit with a specific number of CPUs, a limited amount of usable memory, and a specific disk read and write rate.
[0159] 203. The server independently runs the target business process through the target resource grouping.
[0160] In the embodiment of the present application, after obtaining the target resource grouping, the target process identifier of the target business process that needs to be isolated can be determined first, so as to bind the target process identifier to the target resource grouping, so as to establish a unique mapping relationship between the target process identifier and the target resource grouping, that is, the target resource grouping is only associated with the target process identifier, and at the same time, the association between other process identifiers and the target resource grouping is intercepted. Finally, the target business process with the target process identifier that currently has a mapping relationship with the target resource grouping is run through the target resource grouping, so as to realize the isolation of the target business process through the target resource grouping.
[0161] Among them, the resources configured to the target resource group may include central processing unit (CPU), memory, disk IO and other related resources. When constructing a unique mapping relationship between the target process identifier and the target resource group, it is necessary to add the target process identifier to the process task list associated with the target resource group. Then, the mapping relationship between the target process identifier and the CPU, memory and disk IO can be established respectively, as follows:
[0162] (A) Establishing a mapping relationship between a target process identifier and a CPU core. Specifically, one or more data operation units of a central processor are pre-allocated in the target resource group, and the target business process identifier can be bound to the number of one or more data operation units allocated to the target resource group, so that a mapping relationship exists between the target business process and the operation unit allocated to the target resource group.
[0163] Exemplarily, the data operation unit can be a computing unit of an operating system, such as multiple computing cores of a central processing unit (CPU), each computing core having a corresponding code. Taking a server as an example, assuming that the central processing unit (CPU) is composed of 16 computing cores, the unit identifier of each computing core is used to allocate resources for resource groups. The unit identifier is a number carried by the computing unit itself, such as a code or string or unique identifier at the time of leaving the factory. It can also be a number pre-assigned to each computing unit, such as numbers 1, 2, 3...16, or other forms of numbers, which are not limited here. However, in this example, assuming that the computing cores configured to the target resource group are 1 and 2, the target process identifier is bound to the numbers 1 and 2 of the computing core to achieve physically isolated operation of the target business process and avoid mutual influence between different business processes.
[0164] (B) Establish associations between the target process identifier and the memory resources and disk bandwidth resources allocated to the target resource group. Specifically, determine the memory space allocation amount and disk read / write rate allocated to the target resource group according to the resource allocation index, generate a memory allocation amount threshold based on the memory space allocation amount, and generate a data transmission speed threshold based on the disk read / write rate, and associate the target process identifier with the memory allocation amount threshold and the transmission speed threshold, respectively, to build a mapping relationship between the target process identifier and the memory space and disk read / write rate of the target resource space.
[0165] In this way, resource management can be performed on CPU cores, memory resources, and disk read and write rate resources to ensure that the target business process only uses resources within a limited number range to run the target business process during runtime.
[0166] 204. The server obtains the service request and determines the target service process to which it belongs according to the service type of the service request.
[0167] The service request may be an information interaction request initiated by an application, website, etc., which is used to request the corresponding data processing end to perform data operations to obtain the running status or operation status of the relevant business. For example, taking an instant messaging application as an example, when the instant messaging application adds a chat object friend, a service request to add a chat object friend may be sent to the data processing end; for another example, taking a commodity shopping application as an example, when a user completes a commodity order, the commodity shopping application or webpage will send a commodity order service request to the background; in addition, taking a resource transfer application as an example, when a user configures a resource transfer order on the page of the resource transfer application, the resource transfer application will send a resource transfer order service request to the background.
[0168] In the embodiment of the present application, the server side can receive a business request sent by a business client or a web page. The business request has a corresponding business type, which is used to represent the attribute or identity of the business request. Through the business type, the back end of the business client in the server responsible for business processing requests and data management can be queried, that is, the target business process to which the business request belongs on the server side can be determined. Since the server side has pre-allocated an independent target resource group for the target business process, the corresponding target resource group is subsequently queried based on the target process identifier of the target business process.
[0169] 205. The server queries the target resource group corresponding to the target process identifier, and determines the resource usage of the target resource group.
[0170] It should be noted that in order to achieve independent operation of the target business process, the embodiment of the present application adds the target process identifier corresponding to the target business process to the process task list of the target resource grouping when starting the target business process through the target resource grouping, so that the target resource grouping is associated with the target business process and isolated operation is achieved.
[0171] Therefore, when querying the target resource group used to run the target business process, the target resource group used to run the target business process can be queried by identifying the target. Further, the resource usage of the target resource group when currently running the target business process is determined, such as the computing load of the CPU core, the usage of the memory space, the read and write rate of the disk, etc., to determine the resource usage of the target resource group by the target business process before executing the current business request, so as to subsequently determine whether to continue to respond to the business request through the target business process running in the target resource group.
[0172] In addition, since the hardware resources in the server are limited, in order to ensure that the server resources can support the operation of each business process, when receiving a business request, the total resource usage on the server side can be determined at any time before responding to the business request, such as the total usage of various resources such as CPU, memory, disk, etc., so as to determine whether to further determine the resource occupancy of the target resource group on this basis. It can be understood that when the total usage of various resources on the server side reaches the resource supply threshold, it means that the total amount of resources occupied by various business processes running in the server exceeds the load that the server can bear. At this time, the server cannot respond to a business request of any business type, otherwise it will cause the server system to crash or restart, thereby forcing all business processes to go offline. Therefore, in this case, there is no need to further determine the resource usage in the target resource group; on the contrary, when the total usage of various resources on the server side is less than the resource supply threshold, the resource occupancy of the target resource group can be further determined.
[0173] 206. The server compares the resource usage with the resource amount threshold of the target resource group.
[0174] Specifically, after obtaining the resource occupancy of the target resource group when running the target business process, the resource occupancy can be compared with the resource threshold set for the target resource group, so as to determine whether to respond to the corresponding business request within the target resource group based on the comparison result, and manage the target business process running in the target resource group.
[0175] It should be noted that the comparison results may be respectively: greater than the resource amount threshold, equal to the resource amount threshold, and less than the resource amount threshold.
[0176] When the resource occupation amount of the target resource group is equal to the resource amount threshold, it means that the target business process currently occupies too many resources during operation. If the target business process continues to respond to business requests, it will cause the target business process to exceed the operating resources configured by the target resource group, affecting the operation of other business processes. Therefore, the target process identifier is removed from the process task list in the target resource group to release the mapping relationship between the target resource group and the target process identifier, so as to prevent the target resource group from continuing to run the target business process. Thereafter, the various resources in the target resource group whose mapping relationship has been released are released for subsequent use.
[0177] Among them, when the resource occupancy of the target resource group is greater than the resource threshold, it means that the target business process currently occupies too many resources during operation, but due to human intervention or other means, the target business process still runs through the target resource group and other resources outside the group. At this time, for the newly received business request, it can be determined whether to respond through the inquiry method.
[0178] When the resource occupancy of the target resource group is less than the resource threshold, it is determined that the service request can be responded to through the target resource group. For details, see step 207.
[0179] 207. When the server detects that the resource usage is less than the resource threshold of the target resource group, the server executes the service request based on the target service process running in the target resource group.
[0180] In an embodiment of the present application, when it is detected that the resource occupancy of the target resource group when running the target business process is less than its corresponding resource threshold, it means that there are idle running resources in the target resource group. Therefore, the target business process can continue to run based on the target resource group to execute the current business request to be responded to through the target business process to complete the response to the business request.
[0181] Specifically, the process of responding to a business request belongs to the data processing process, which involves data interaction with the business database, such as data reading, business execution result storage, etc. Furthermore, during the execution of the business request, the data generated by the execution process is interacted with the corresponding database through the target business process to facilitate data reading, writing and storage.
[0182] Exemplarily, if the MySQL process is used as the target business process, the corresponding database is the MySQL database. There is an association between the data transmission port of the MySQL database and the target resource group. When the MySQL process is run through the target resource group, the target is identified by running the MySQL process and the current business request to be responded to is processed. The data processing process is not limited to data definition, data query, data maintenance or database operation control, etc. For example, taking a commodity order as a business request, the commodity order is processed by the MySQL process, and the payment calculation, commodity inventory, commodity ownership, commodity distribution docking and other information of the commodity order at the time of the transaction are processed to obtain the business execution result; then, the business execution result is stored in the MySQL database through the database port. After that, the business execution result can also be returned to the business request end, such as the client, and the business execution result can be displayed on the client page.
[0183] In the embodiment of the present application, when executing a service request, the target service process can manage the target service according to the detection results by detecting the memory usage of the target service process and the data transmission rate of the disk.
[0184] For example, taking the amount of memory resources occupied by the target business process as an example, when the target business process running through the target resource grouping executes a business request, if the memory space it occupies is greater than the memory allocation threshold, the mapping relationship between the target resource grouping and the target process identifier is released. Specifically, the business request can be stopped, and the target process identifier in the process task list associated with the target resource grouping is removed to release the mapping relationship between the target resource grouping and the target identifier, thereby releasing the target resource grouping that is in an idle state.
[0185] For another example, taking the data transmission rate as an example, the data transmission rate can reflect the read and write rate of the disk, and can indicate the target business process's occupation of the disk bandwidth resources. When the service request is executed by the target business process running in the target resource group, its data transmission rate is detected. If it is detected that the data transmission rate of the target business when executing the service request is greater than the limited transmission speed threshold, the bit rate and read and write frequency of the target business process when executing the service request can be reduced to control the bandwidth when reading and writing the magnetic disk, thereby reducing the data transmission rate of the data reading and writing device associated with the target resource group.
[0186] In order to facilitate the understanding of the embodiments of the present application, the embodiments of the present application will be described with a specific application scenario example. Specifically, by executing the above steps 201-207, and combining Figure 4-Figure 5 , describe the application scenario instance.
[0187] Specifically, the scenario examples of the resource management method are as follows:
[0188] 1. Taking the server as an example, the overall overview of the resource management scenario is as follows: deploy multiple MySQL database instances in the online production environment on the same server, and detect and allocate resource usage for each business process based on CGroup resource isolation technology. Specifically, limit resources in CPU, memory, disk IO, network bandwidth, and other aspects according to the actual needs of the business process to isolate resources for different MySQL processes on the same server, and implement resource restrictions between different MySQL processes. In this way, the demand for full utilization of server resources can be met. At the same time, the problem of mutual influence between different MySQL databases can be solved to achieve resource isolation in the case of different data services.
[0189] 2. Resource management architecture of the server for each business process: pre-allocate the hardware resources on the server into resource isolation groups (resource groups) according to the needs, so as to plan the use of the hardware resources in the server in advance. Among them, the hardware resources of the server include but are not limited to CPU cores, memory, disks, etc.
[0190] Combination Figure 4As shown, the pre-allocation process of resource grouping can be: for example, taking the MySQL database port as 3306 as an example, according to the needs of the MySQL business process, it is necessary to configure in advance the hardware resources of 2-core CPU, 2G memory, and 1000 read / write times / second (IOPS) disk. At this time, the corresponding resource isolation group can be configured in advance on the server according to the above configuration information, such as allocating CPU cores numbered 2 and 3 to the resource isolation group, and the corresponding memory and disk hardware resources are allocated to the resource isolation group; then, after restarting the CGroup service, the process identifier (Pid) corresponding to the MySQL process to be isolated is dynamically added to the process task list of the resource isolation group. For another example, taking the MySQL database port as 3307 as an example, according to the needs of the MySQL business process, it is necessary to configure in advance the hardware resources of 4-core CPU, 2G memory, and 1000 read / write times / second (IOPS) disk. The corresponding resource isolation group can be configured in advance on the server according to the above configuration information, such as allocating CPU cores numbered 4, 5, 6, and 7 to the resource isolation group, and the corresponding memory and disk hardware resources are allocated to the resource isolation group.
[0191] To facilitate understanding, the management process of the target business process running in the corresponding resource isolation group will be introduced from the aspects of CPU, memory, disk IO, etc., as follows:
[0192] (1) CPU isolation: Bind the MySQL business process that needs to be isolated and run to the CPU core in the resource isolation group to achieve complete physical isolation.
[0193] For example, combined with Figure 4 As shown, the resource isolation group 3306 (group-mysql-3306) is configured with CPU cores numbered 4, 5, 6 and 7, and the identifier (Pid) of the MySQL business process corresponding to the resource isolation group 3306 is 7808, then the identifier 7808 of the MySQL business process is bound to the CPU cores numbered 4, 5, 6 and 7, so that the MySQL business process in the resource isolation group only uses the CPU cores numbered 4, 5, 6 and 7 to run.
[0194] For example, resource isolation group 3307 (group-mysql-3307) is configured with CPU cores numbered 2 and 3, and the identifier (Pid) of the MySQL business process corresponding to resource isolation group 3306 is 7812. The identifier 7812 of the MySQL business process is bound to the CPU cores numbered 2 and 3, so that the MySQL business process in the resource isolation group only uses the CPU cores numbered 2 and 3 to run.
[0195] In addition, in a distributed system consisting of multiple server nodes, when configuring CPU cores, CPU cores can be allocated to a resource isolation group on the same physical server node as much as possible to avoid performance jitter problems caused by cross-node.
[0196] (2) Memory isolation: Isolate the MySQL business processes that need to be isolated based on the size allocation of memory space. Specifically, configure a memory allocation threshold for the resource isolation group to limit the memory usage of the MySQL business process. When the resource isolation group runs the MySQL business process, if the occupied memory space exceeds the memory allocation threshold, the process identifier (Pid) of the isolated MySQL business process will be KILLed to avoid affecting other business processes.
[0197] For example, if the total memory resource of the server is 128 GB, the memory upper limit (memory allocation threshold) is set to 50 GB for each of the two instances. If the memory exceeds 50 GB, the corresponding MySQL process will be killed by the OOM mechanism.
[0198] (3) Disk IO isolation: Limit the read and write frequency / rate (IOPS) and disk bandwidth to control the bandwidth of the container reading and writing disks. If the limit threshold is exceeded, the speed is reduced to reduce disk IO performance.
[0199] Furthermore, after allocating resources such as CPU cores, memory, and disk IO to the resource isolation group in the above manner, the resource isolation group can be used to isolate the MySQL business process and implement resource isolation for each business process. Figure 5 As shown, the process of resource isolation is: first select the resource isolation specification, that is, select the resource isolation group of the MySQL business process that needs to be isolated according to the needs; then, determine whether the resource isolation conditions are met, such as whether the memory, disk and other limit thresholds are met. If not, end the isolation process; further, if the resource isolation conditions are met, initiate resource isolation, thereby completing the resource isolation of the MySQL business process.
[0200] Among them, when isolating the resources of the MySQL business process, there is no need to restart the currently running MySQL process. Instead, directly obtain the pid of the isolated MySQL business process and add the pid to the corresponding resource isolation group to achieve the isolation of the MySQL business process. After that, based on the memory limit program, the current memory usage can be detected, and it can be determined whether the usage exceeds the memory allocation threshold limited by the Cgroup resource isolation group. If it exceeds, the current business request will no longer be executed through the MySQL business process, avoiding the MySQL process being killed due to the limitation of the memory allocation threshold after the business request to be responded to joins the resource isolation group, resulting in the subsequent inaccessibility of the business.
[0201] Through the above application scenario examples, the following effects can be achieved: 1) Through CGroup resource isolation technology, multiple instances of MySQL database can be deployed online to improve the utilization of server resources. 2) Save server resource costs.
[0202] From the above, it can be seen that when receiving any type of business request, the embodiment of the present application can first determine the target business process to which the business request belongs in the server, and then determine the target resource grouping independently allocated to the target business process to run, and determine the resource occupancy of the target resource grouping, and by comparing the resource occupancy with the resource threshold of the target resource grouping, determine whether the target resource grouping has sufficient resources to respond to the business request, and finally, when it is determined that the target resource grouping has sufficient resources, execute the business request through the target business process run by the target resource grouping; in this way, server resources are allocated separately according to the dimensions of the business process to avoid impacts between different business processes, ensure the stable operation of the business process, and ensure the stability of business operations while making full use of resources.
[0203] In order to better implement the above method, the embodiment of the present application also provides a resource management device. Figure 6 As shown, the resource management device may include an acquisition unit 401 , a query unit 402 and an execution unit 403 .
[0204] The acquisition unit 401 is used to acquire a service request and determine a target service process to which the service request belongs according to the service type of the service request. The target service process has a corresponding target process identifier.
[0205] A query unit 402 is used to query the target resource group corresponding to the target process identifier and determine the resource usage of the target resource group;
[0206] The target resource group is a resource group pre-established according to the resource allocation indicator corresponding to the business type of the target business process, and each resource group is associated with a corresponding resource amount threshold;
[0207] The execution unit 403 is configured to execute the service request based on the target service process running in the target resource group when it is detected that the resource occupancy is less than the resource amount threshold of the target resource group.
[0208] In some embodiments, the resource management device also includes a creation unit, which is used to: query resource allocation indicators according to the business type of the target business process; determine the target resources corresponding to the resource allocation indicators, and construct target resource groups based on the target resources; and independently run the target business process through the target resource groups.
[0209] In some implementations, the creation unit is further configured to: obtain multiple resource occupancy amounts of a service type of a target service process within a target time period; and determine a resource allocation indicator according to an average of the multiple resource occupancy amounts.
[0210] In some implementations, the creation unit is further used to: obtain a target process identifier of a target business process, and construct a unique mapping relationship between the target process identifier and a target resource group; and run the target business process with the target process identifier having the constructed mapping relationship through the target resource group.
[0211] In some embodiments, the creation unit is also used to: add the target process identifier to the process task list corresponding to the target resource group; obtain the unit identifier of the data operation unit assigned to the target resource group; and construct a unique mapping relationship between the unit identifier and the target process identifier in the task list.
[0212] In some embodiments, the execution unit is also used to: determine the database port associated with the target resource grouping; based on the target business process running by the target resource grouping, perform data processing on the business request associated with the target process identifier to obtain a business execution result; and store the business execution result through the database port.
[0213] In some embodiments, the resource management device also includes a first release unit, which is used to: detect the memory usage of the target resource group when running the target business process; when the memory usage is greater than the memory allocation threshold of the target resource group, release the mapping relationship between the target resource group and the target process identifier; and release the target resource group whose mapping relationship has been released.
[0214] In some embodiments, the resource management device also includes an adjustment unit for: detecting the data transmission rate of the data reading and writing device associated with the target resource group; when the data transmission rate is greater than the transmission speed threshold of the target resource group, reducing the data transmission rate of the data reading and writing device associated with the target resource group.
[0215] In some embodiments, the resource management device also includes a second release unit, which is used to: when it is detected that the resource occupancy is equal to the resource amount threshold of the target resource group, stop executing the service request and release the mapping relationship between the target resource group and the target process identifier; release the target resource group whose mapping relationship has been released.
[0216] In some embodiments, the resource management device also includes a management unit, which is used to: when it is detected that the resource occupancy is greater than the resource amount threshold of the target resource group, send a business execution request to the resource management page associated with the local device for the business request; when a business execution instruction is fed back from the resource management page, execute the business request based on the target business process running in the target resource group; when a stop execution instruction is received from the resource management page, stop executing the business request.
[0217] In some implementations, the resource management device further includes a detection unit, configured to: detect the total amount of memory usage of the local device;
[0218] The query unit 403 is used to query the target resource group corresponding to the target process identifier when the total memory occupation is less than the memory supply threshold of the local device.
[0219] From the above, it can be seen that when receiving any type of business request, the embodiment of the present application can first determine the target business process to which the business request belongs in the server, and then determine the target resource grouping independently allocated to the target business process to run, and determine the resource occupancy of the target resource grouping, and by comparing the resource occupancy with the resource threshold of the target resource grouping, determine whether the target resource grouping has sufficient resources to respond to the business request, and finally, when it is determined that the target resource grouping has sufficient resources, execute the business request through the target business process run by the target resource grouping; in this way, server resources are allocated separately according to the dimensions of the business process to avoid impacts between different business processes, ensure the stable operation of the business process, and ensure the stability of business operations while making full use of resources.
[0220] The present application also provides a computer device, such as Figure 7 As shown, it shows a schematic diagram of the structure of the computer device involved in the embodiment of the present application, specifically:
[0221] The computer device may include one or more processing core processors 701, one or more computer readable storage media memories 702, a power supply 703, an input unit 704 and other components. Those skilled in the art will appreciate that Figure 7 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:
[0222] The processor 701 is the control center of the computer device, and uses various interfaces and lines to connect various parts of the entire computer device. By running or executing software programs and / or modules stored in the memory 702, and calling data stored in the memory 702, the processor 701 performs various functions of the computer device and processes data. Optionally, the processor 701 may include one or more processing cores; preferably, the processor 701 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 701.
[0223] The memory 702 can be used to store software programs and modules. The processor 701 executes various functional applications and resource management processes by running the software programs and modules stored in the memory 702. The memory 702 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 702 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 702 may also include a memory controller to provide the processor 701 with access to the memory 702.
[0224] The computer device also includes a power supply 703 for supplying power to various components. Preferably, the power supply 703 can be logically connected to the processor 701 through a power management system, so as to manage charging, discharging, power consumption and other functions through the power management system. The power supply 703 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators and other arbitrary components.
[0225] The computer device may further include an input unit 704, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0226] Although not shown, the computer device may also include a display unit, etc., which will not be described in detail here. Specifically, in the embodiment of the present application, the processor 701 in the computer device will load the executable file corresponding to the process of one or more application programs into the memory 702 according to the following instructions, and the processor 701 will run the application program stored in the memory 702, thereby realizing various functions, as follows:
[0227] A business request is obtained, and a target business process is determined according to the business type of the business request, where the target business process has a corresponding target process identifier; a target resource group corresponding to the target process identifier is queried, and the resource occupancy of the target resource group is determined; wherein the target resource group is a resource group pre-established according to a resource allocation indicator corresponding to the business type of the target business process, and each resource group is associated with a corresponding resource quantity threshold; when it is detected that the resource occupancy is less than the resource quantity threshold of the target resource group, the business request is executed based on the target business process running in the target resource group.
[0228] The specific implementation of the above operations can be found in the previous embodiments and will not be described in detail here.
[0229] It can be concluded that when this solution receives any type of business request, it can first determine the target business process to which the business request belongs in the server, and then determine the target resource grouping independently allocated to the target business process to run, and determine the resource occupancy of the target resource grouping, and by comparing the resource occupancy with the resource threshold of the target resource grouping, determine whether the target resource grouping has sufficient resources to respond to the business request, and finally, when it is determined that the target resource grouping has sufficient resources, execute the business request through the target business process run by the target resource grouping; in this way, server resources are allocated separately according to the dimensions of the business process to avoid impacts between different business processes, ensure the stable operation of the business process, and ensure the stability of business operations while making full use of resources.
[0230] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0231] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any resource management method provided in the embodiment of the present application. For example, the instructions can execute the following steps:
[0232] A business request is obtained, and a target business process is determined according to the business type of the business request, where the target business process has a corresponding target process identifier; a target resource group corresponding to the target process identifier is queried, and the resource occupancy of the target resource group is determined; wherein the target resource group is a resource group pre-established according to a resource allocation indicator corresponding to the business type of the target business process, and each resource group is associated with a corresponding resource quantity threshold; when it is detected that the resource occupancy is less than the resource quantity threshold of the target resource group, the business request is executed based on the target business process running in the target resource group.
[0233] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0234] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0235] Since the instructions stored in the computer-readable storage medium can execute the steps in any resource management method provided in the embodiments of the present application, the beneficial effects that can be achieved by any resource management method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0236] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various optional implementations provided in the above embodiments.
[0237] The above is a detailed introduction to a resource management method, device, equipment and readable storage medium provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A resource management method, characterized in that: include: Obtaining a service request, and determining a target service process to which the service request belongs according to a service type of the service request, wherein the target service process has a corresponding target process identifier; Querying the target resource group corresponding to the target process identifier, and determining the resource occupancy of the target resource group; The target resource group is a resource group pre-established according to a resource allocation indicator corresponding to a service type of the target service process, and each resource group is associated with a corresponding resource amount threshold; When it is detected that the resource occupancy is less than the resource amount threshold of the target resource group, the service request is executed based on the target service process running in the target resource group.
2. The method according to claim 1, characterized in that Before querying the target resource group corresponding to the target process identifier, the method further includes: Query resource allocation indicators based on the business type of the target business process; Determine the target resources corresponding to the resource allocation indicator, and construct a target resource group according to the target resources; The target business process is independently run through the target resource grouping.
3. The method according to claim 2, characterized in that The querying of resource allocation indicators according to the business type of the target business process includes: Obtain multiple resource usages of the business types of the target business process within the target time period; A resource allocation indicator is determined according to an average of the plurality of resource occupancy amounts.
4. The method according to claim 2, characterized in that The independently running the target business process by grouping the target resources includes: Obtaining a target process identifier of the target business process, and constructing a unique mapping relationship between the target process identifier and the target resource group; The target service process identified by the target process having the mapping relationship established is run through the target resource group.
5. The method according to claim 4, characterized in that The constructing a unique mapping relationship between the target process identifier and the target resource group includes: Adding the target process identifier to the process task list corresponding to the target resource group; Acquire a unit identifier of a data operation unit allocated to the target resource group; A unique mapping relationship between the unit identifier and the target process identifier in the task list is constructed.
6. The method according to claim 1, characterized in that The executing the service request based on the target service process running in the target resource group includes: Determine a database port associated with the target resource group; Based on the target business process running in the target resource group, data processing is performed on the business request associated with the target process identifier to obtain a business execution result; The business execution result is stored through the database port.
7. The method according to any one of claims 1 to 6, characterized in that: After executing the service request, the method further comprises: Detecting the memory usage of the target resource group when running the target service process; When the memory occupancy is greater than the memory allocation threshold of the target resource group, releasing the mapping relationship between the target resource group and the target process identifier; The target resource group whose mapping relationship has been released is released.
8. The method according to any one of claims 1 to 6, characterized in that: After executing the service request, the method further comprises: Detecting the data transmission rate of the data reading and writing device associated with the target resource group; When the data transmission rate is greater than the transmission speed threshold of the target resource group, the data transmission rate of the data reading and writing device associated with the target resource group is reduced.
9. The method according to claim 1, characterized in that: Also includes: When it is detected that the resource occupancy is equal to the resource amount threshold of the target resource group, the execution of the service request is stopped, and the mapping relationship between the target resource group and the target process identifier is released; The target resource group whose mapping relationship has been released is released.
10. The method according to claim 1, characterized in that Also includes: When it is detected that the resource occupancy is greater than the resource amount threshold of the target resource group, sending a service execution request to a resource management page associated with the local device for the service request; When receiving the service execution instruction fed back by the resource management page, executing the service request based on the target service process running in the target resource group; When receiving the stop execution instruction fed back by the resource management page, stop executing the service request.
11. The method according to claim 1, characterized in that: Before querying the target resource group corresponding to the target process identifier, the method further includes: Detect the total memory usage of the local device; Then the querying of the target resource group corresponding to the target process identifier includes: When the total memory usage is less than the memory supply threshold of the local device, query the target resource group corresponding to the target process identifier.
12. A resource management device, characterized in that: include: An acquisition unit, used for acquiring a service request and determining a target service process to which the service request belongs according to a service type, wherein the target service process has a corresponding target process identifier; A query unit, used to query the target resource group corresponding to the target process identifier, and determine the resource occupancy of the target resource group; The target resource group is a resource group pre-established according to a resource allocation indicator corresponding to a service type of the target service process, and each resource group is associated with a corresponding resource amount threshold; The execution unit is configured to execute the service request based on the target service process running in the target resource group when it is detected that the resource occupancy is less than the resource amount threshold of the target resource group.
13. A computer device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program, and the processor is used to run the computer program in the memory to implement the steps in the resource management method according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the resource management method according to any one of claims 1 to 11.
15. A computer program product, characterized in that The method comprises computer instructions, which, when executed, implement the steps of the resource management method according to any one of claims 1 to 11.
Citation Information
Cited By
Development file running method and device, equipment and storage medium
CN119668885A
