Service management method and device, electronic equipment and storage medium
By adjusting the execution logic and timing of the control plane service in the HCI architecture, reducing its CPU consumption, and allocating it to different CPU groups from the data plane service, the performance jitter problem caused by resource sharing in the traditional HCI architecture is solved, achieving stable I/O performance and improved resource utilization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SANGFOR TECH INC
- Filing Date
- 2025-12-15
- Publication Date
- 2026-05-19
AI Technical Summary
In traditional HCI architecture, the control plane and data plane services share the same set of physical CPU resources, which causes the CPU utilization of the control plane to soar, affecting the I/O performance of the data plane services, resulting in jitter and performance bottlenecks, and limiting the application potential of the system in high-concurrency, low-latency scenarios.
By adjusting the execution logic and timing of the control plane service, its CPU consumption is reduced, and the control plane and data plane services are allocated to different CPU groups to achieve resource isolation, dynamically adjust CPU allocation to meet load requirements, and avoid resource contention.
It achieves extreme stability of I/O performance for data plane services, avoids performance jitter, and improves overall resource utilization and system stability.
Smart Images

Figure CN122064464A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of electronic technology, specifically relating to a service management method, apparatus, electronic device, and storage medium. Background Technology
[0002] Hyper-Converged Infrastructure (HCI) virtualizes computing, storage, and network resources through software-defined technologies, forming a unified resource pool. In a virtual storage architecture, core services are typically divided into two main modules: the control plane (management and control logic) and the data plane (processing business traffic). The control plane is responsible for management functions such as health checks, capacity monitoring, and task scheduling, while the data plane focuses on core business operations such as data reading and writing, and I / O (Input / Output) processing. In traditional HCI architectures, the control plane and data plane services share the same set of physical CPU (Central Processing Unit) resources. This design was initially favored for simplifying deployment, but its limitations have become increasingly apparent as business complexity increases. For example, a surge in CPU utilization on the control plane can cause I / O performance fluctuations in the data plane services. Summary of the Invention
[0003] In view of the above problems, this application proposes a service management method, apparatus, electronic device, and storage medium to improve the above problems.
[0004] In a first aspect, embodiments of this application provide a service management method, the method comprising: reducing the CPU consumption of the control plane service within a preset time period by adjusting the execution logic and / or execution time of each sub-service of the control plane service within a preset time period, thereby obtaining a target control plane service; obtaining the current CPU load; and if the CPU load is not higher than a preset CPU load, controlling the target control plane service to run on a first CPU group and controlling the data plane service to run on a second CPU group, wherein the CPUs included in the first CPU group are dedicated CPUs for running the target control plane service, and the CPUs included in the second CPU group are dedicated CPUs for running the data plane service.
[0005] Furthermore, the method also includes: if the CPU load is higher than the preset CPU load, allocating any one or more target CPUs from the second CPU group; and controlling the target management plane service to run on the first CPU group and the one or more target CPUs. This method avoids situations where services cannot respond in a timely manner when the CPU is busy; simultaneously, the number of CPU cores for the management plane service is sufficient to meet the necessary overhead, and the number of CPU cores for the data plane service is sufficient to meet the storage performance requirements, thus avoiding I / O performance fluctuations in the data plane service due to CPU preemption.
[0006] Furthermore, the step of allocating one or more target CPUs from the second CPU group if the CPU load is higher than the preset CPU load includes: if the CPU load is higher than the preset CPU load, obtaining the number of nodes currently executing tasks, where the nodes are servers or hosts; and allocating one or more target CPUs from the second CPU group based on the number of nodes. Through this method, by monitoring CPU load in real time and dynamically adjusting resource allocation, performance bottlenecks caused by resource contention can be effectively avoided, ensuring that high-priority tasks receive sufficient computing power. When the system detects that the load exceeds a threshold, it automatically allocates idle CPUs from the reserved resource pool, a mechanism that significantly improves overall resource utilization. Furthermore, the precise resource allocation based on the number of nodes allows the system to accurately expand its capacity according to actual workload requirements, ensuring the execution efficiency of computationally intensive tasks while avoiding over-allocation of resources.
[0007] Furthermore, reducing the CPU consumption of the control plane service within a preset time period to obtain the target control plane service includes: increasing the runtime segments of the control plane service running within the preset time period to reduce its CPU consumption and obtain the target control plane service. This method avoids CPU resource contention caused by multiple services running simultaneously, thereby effectively reducing instantaneous CPU utilization.
[0008] Furthermore, the control plane service includes multiple sub-services. For the control plane service running within a preset time period, a runtime segment is added to the control plane service. This includes: setting different execution time nodes for each sub-service within the first time period, distributing the execution time nodes of the multiple sub-services across the preset time period and the runtime segment, thereby reducing the execution concurrency of the sub-services within the preset time period. Through this method, by distributing the execution time nodes of the control plane service across different time periods, CPU resource contention caused by multiple services running simultaneously can be avoided, thus effectively reducing instantaneous CPU utilization.
[0009] Furthermore, the method also includes: splitting the internal execution logic of the control plane service from large scripts into smaller scripts to reduce the CPU consumption of the control plane service and obtain the target control plane service. This method avoids excessive concentration of single-time computational resource demands, smoothing out the CPU load and effectively reducing peak load. It also reduces the risk of data plane services being affected or system instability caused by resource contention within the control plane service itself.
[0010] Furthermore, the control surface service includes scheduled tasks and service keep-alive tasks.
[0011] Secondly, embodiments of this application provide a service management device, the device comprising: a reduction unit, configured to reduce the CPU consumption of the control plane service within a preset time period by adjusting the execution logic and / or execution time of each sub-service of the control plane service within a preset time period, thereby obtaining a target control plane service; an acquisition unit, configured to acquire the current CPU load; and a control unit, configured to, if the CPU load is not higher than a preset CPU load, control the target control plane service to run on a first CPU group and control the data plane service to run on a second CPU group, wherein the CPUs included in the first CPU group are dedicated CPUs for running the target control plane service, and the CPUs included in the second CPU group are dedicated CPUs for running the data plane service.
[0012] Thirdly, embodiments of this application provide an electronic device, including one or more processors and a memory; one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to perform the methods described above.
[0013] Fourthly, embodiments of this application provide a computer-readable storage medium storing program code, wherein the above-described method is executed when the program code is run.
[0014] This application provides a service management method, apparatus, electronic device, and storage medium. By adjusting the execution logic and / or execution time of each sub-service of the control plane service within a preset time period, the CPU consumption of the control plane service within the preset time period is reduced to obtain a target control plane service. Then, the current CPU load is obtained. If the CPU load is not higher than a preset CPU load, the target control plane service is controlled to run on a first CPU group, and the data plane service is controlled to run on a second CPU group. The CPUs included in the first CPU group are dedicated CPUs for running the target control plane service, and the CPUs included in the second CPU group are dedicated CPUs for running the data plane service. Through this method, strict isolation is achieved, ensuring that data plane services (especially services sensitive to I / O performance) are never disturbed by sudden tasks of the control plane service, thereby guaranteeing the extreme stability of storage I / O performance and avoiding performance fluctuations. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This illustration shows a schematic diagram of CPU partitioning during service runtime before optimization in an embodiment of this application. Figure 2 A flowchart of a service management method according to an embodiment of this application is shown; Figure 3 This illustration shows a schematic diagram of writing the hard disk capacity information of each node into a MongoDB database in one embodiment of this application; Figure 4 This illustration shows a schematic diagram of CPU partitioning during service operation after optimization in one embodiment of this application; Figure 5 A flowchart of a service management method according to another embodiment of this application is shown; Figure 6 A flowchart of a service management method according to another embodiment of this application is shown; Figure 7 This illustration shows a schematic diagram of the task execution timeline before optimization in yet another embodiment of this application; Figure 8 A schematic diagram of the optimized task execution timeline is shown in yet another embodiment of this application; Figure 9 This paper shows a structural block diagram of a service management device according to an embodiment of this application; Figure 10A structural block diagram of an electronic device for performing a service management method according to an embodiment of this application is shown; Figure 11 A storage unit for storing or carrying program code implementing the service management method according to an embodiment of this application is shown. Detailed Implementation
[0017] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0018] Hyperconverged infrastructure (HCI) virtualizes compute, storage, and network resources using software-defined technologies, forming a unified resource pool. In a virtual storage architecture, core services are typically divided into two main modules: the control plane (management and control logic) and the data plane (processing business traffic). The control plane is responsible for management functions such as health checks, capacity monitoring, and task scheduling, while the data plane focuses on core business operations such as data read / write and I / O processing. In traditional HCI architectures, the control plane and data plane services share the same set of physical CPU resources. This design was initially favored for simplifying deployment, but its limitations have become increasingly apparent as business complexity increases.
[0019] The core flaws of existing technical solutions are: 1. High CPU usage on the control plane causes performance bottlenecks. The control plane service needs to frequently execute scheduled tasks (such as hard disk capacity updates and node health checks). These tasks run periodically or burstily, causing intermittent spikes in CPU usage. For example, health check scripts may consume a large amount of computing resources due to full disk scans or log analysis, and the control plane service lacks a resource priority management mechanism, making it unable to suppress the resource consumption of non-critical tasks. This high-load mode not only affects the response speed of the control plane itself but may also trigger system-level alarms, further deteriorating overall stability.
[0020] 2. Lack of service isolation leads to CPU preemption and data plane I / O jitter. When management and data plane services share CPU resources, management plane tasks (such as keep-alive services or configuration updates) can interfere with the execution of data plane threads through time-slice preemption mechanisms. Data plane services are latency-sensitive; if CPU resources are frequently preempted by the management plane, their I / O processing threads will be forced to wait, resulting in decreased throughput and fluctuating response times. For example, in storage-intensive scenarios, CPU contention on the data plane may prevent it from processing read and write requests in a timely manner, causing disk queue backlog and performance jitter, ultimately affecting business continuity. For instance, as shown... Figure 1As shown, the storage control plane service runs on 8 CPU cores, which overlaps with the CPU cores on which the data plane service runs. This can lead to the control plane service preempting the CPU cores of the data plane service.
[0021] In summary, the current HCI virtual storage architecture, with its shared CPU design for both the control and data planes, suffers from significant shortcomings in resource isolation and dynamic scheduling. High CPU usage and service coupling on the control plane not only reduce system reliability but also amplify data plane performance risks through resource contention. These deficiencies limit HCI's application potential in high-concurrency, low-latency scenarios, necessitating architectural optimization to achieve resource isolation and elastic allocation.
[0022] Therefore, the inventors have proposed the service management method, apparatus, electronic device, and storage medium of this application. The method involves reducing the CPU consumption of the control plane service within a preset time period to obtain the target control plane service. Then, the current CPU load is obtained. If the CPU load is not higher than a preset CPU load, the target control plane service is controlled to run on a first CPU group, and the data plane service is controlled to run on a second CPU group. The CPUs in the first CPU group are dedicated to running the target control plane service, and the CPUs in the second CPU group are dedicated to running the data plane service. Through this method, strict isolation is achieved, ensuring that data plane services (especially those sensitive to I / O performance) are never disturbed by sudden tasks from the control plane service, thereby guaranteeing the extreme stability of storage I / O performance and avoiding performance fluctuations.
[0023] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0024] Please see Figure 2 This application provides a service management method, the method comprising: Step S110: By adjusting the execution logic and / or execution time of each sub-service of the control plane service within a preset time period, the CPU consumption of the control plane service within the preset time period is reduced, and the target control plane service is obtained.
[0025] In this embodiment, the preset time period is a pre-set time period during which CPU consumption needs to be reduced. This time period can be a period with high concurrency of the control plane service, and is not specifically limited here.
[0026] In this embodiment, the sub-service can be a scheduled task or a service keep-alive task. The CPU consumption of the control plane service within a preset time period can be reduced through various methods.
[0027] One approach is to reduce the CPU consumption of the control plane service within a preset time period by optimizing scheduled tasks.
[0028] Optimizing scheduled tasks can refer to optimizing specific scheduled tasks. These specific scheduled tasks can be those that have no impact on business operations.
[0029] In the embodiments of this application, optimizing a specified timed task may include reducing the concurrency of the specified timed task and / or optimizing the internal logic of the timed task.
[0030] As another approach, CPU consumption of the control plane service within a preset time period can be reduced by optimizing the service keep-alive task. The service keep-alive task primarily maintains the connection state and availability between system components and is a special form of periodic task. In TCP (Transmission Control Protocol) connections, the keep-alive timer periodically sends data packets to check if the other end is alive; in distributed systems, components maintain each other's state by periodically sending heartbeat messages. This mechanism can also be used to clean up idle connections; for example, a chat server uses a keep-alive mechanism to kick out idle TCP connections, thereby allocating limited system resources to more active users.
[0031] Similarly, in the embodiments of this application, optimizing the service keep-alive task may include reducing the concurrency of the service keep-alive task and / or optimizing the internal logic of the service keep-alive task.
[0032] Optionally, CPU consumption of the control plane service can be reduced within a preset time period by decreasing communication between cluster nodes.
[0033] In this embodiment of the application, communication between cluster nodes can be reduced by writing shared information to the MongoDB database on each node, thereby reducing the need for RPC (Remote Procedure Call) or SSH (Secure Shell) to execute commands or code logic on each node.
[0034] In a distributed cluster, if node A needs to obtain certain information from node B or trigger an operation on node B, the traditional approach is to directly connect to node B via RPC (Remote Procedure Call) or SSH to execute commands or code logic. This method results in a large amount of direct communication between nodes, increasing network overhead and system complexity.
[0035] The method described in this application unifies the sharing of information (such as configuration, status, task queues, etc.) into a shared MongoDB database. This way, all nodes obtain or update information by reading and writing to this database, without needing to communicate directly with other nodes. For example, when node A has information to share, node A only needs to write the information to the MongoDB database; when node B needs to retrieve this information, node B can directly read it from the MongoDB database without querying node A. This approach reduces direct dependency between nodes, reducing coupling by requiring only the database. When a new node is added, it only needs to connect to the database to obtain shared information, without modifying the configuration of other nodes, improving scalability. Furthermore, it avoids complex inter-node communication protocols and error handling, simplifying the logic. For example, such as Figure 3 As shown, the disk capacity information of nodes 1, 2, and 3 can be written to the MongoDB database. When a node needs to read the disk capacity information of other nodes, it can directly read the disk capacity information of other nodes from the MongoDB database without accessing other nodes; when a node has disk capacity information to share, that node can write its disk capacity information to the MongoDB database.
[0036] Through the aforementioned optimization methods, the average number of CPU cores for the control plane service is less than 0.5 CPU cores, and the peak number is less than 3 CPI cores, reducing the number of CPU cores from the original 8 CPU cores to 3 CPU cores. This reduces CPU resource utilization by more than 50%, providing the necessary conditions for CPU isolation.
[0037] As one approach, when the peak CPU usage within a preset time period is detected to be higher than a preset value, the CPU consumption of the control plane service within the preset time period is reduced.
[0038] Peak CPU usage refers to the proportion of time the CPU is occupied, reflecting its workload. For example, a 5% peak means the CPU is only active for 5% of the detection period. The preset value is the maximum peak CPU usage that indicates sufficient CPU resources. For instance, a preset value of 5% is typically used. If the peak CPU usage is below 5%, it indicates sufficient CPU resources; conversely, if it is above 5%, it indicates insufficient (or strained) CPU resources. CPU consumption is a crucial indicator of a computer processor's workload, reflecting the proportion of time the CPU spends executing tasks and processes. The target management plane service is the management plane service after reducing CPU consumption.
[0039] In the embodiments of this application, a peak CPU usage exceeding a preset value can be characterized in a variety of ways.
[0040] As one approach, when certain scheduled tasks have no direct impact on business logic (such as log cleanup and data statistics), and their concurrent execution causes significant CPU spikes, it indicates that the peak CPU usage exceeds a preset value. Scheduled tasks refer to programs or operations that run automatically at preset times or according to a specified time period, primarily used for performing repetitive or periodic tasks. Typical application scenarios include tasks with fixed times such as data aggregation at 24:00 every night and sending SMS messages at set times, as well as periodic operations such as respawning monsters every minute in games. This mechanism frees up thread resources through asynchronous processing, eliminating the need for threads to wait continuously.
[0041] As another approach, when multiple scheduled tasks are detected to cause CPU jitter due to concentrated execution (such as hourly triggering), it indicates that the peak CPU usage is higher than the preset value.
[0042] Optionally, when CPU latency jitter is detected in the host machine or container due to issues such as memory shortage or interruption blocking, it indicates that the peak CPU usage is higher than a preset value.
[0043] Optionally, when it is detected that the scheduled task involves data structures such as hash tables, and the load factor is too high, resulting in frequent conflicts (such as a surge in insertion / query time), the peak CPU usage is indicated to be higher than the preset value.
[0044] Optionally, when inefficient code (such as complex loops, redundant calculations, etc.) is detected in the scheduled task itself, the peak CPU usage is higher than a preset value.
[0045] Step S120: Obtain the current CPU load.
[0046] In this embodiment, CPU load refers to the number of processes waiting for CPU processing, used to reflect system pressure. For example, a load of 2.0 means that on average, two processes are queued.
[0047] As a method, in response to a load fetch command, the current CPU load is obtained.
[0048] The load acquisition instruction can be a command triggered by a specified operation. This specified operation can be a pre-set operation that can trigger the load acquisition instruction, such as a click or swipe operation on the load acquisition control, without specific limitations. Alternatively, the load acquisition instruction can be a command sent by other electronic devices, without specific limitations.
[0049] When a load grabbing command is detected, the current CPU load is retrieved in response to the load grabbing command.
[0050] Step S130: If the CPU load is not higher than the preset CPU load, control the target control plane service to run on the first CPU group and control the data plane service to run on the second CPU group, wherein the CPUs included in the first CPU group are dedicated CPUs for running the target control plane service and the CPUs included in the second CPU group are dedicated CPUs for running the data plane service.
[0051] In this embodiment, the preset CPU load is a pre-set CPU load that represents a low CPU load. A CPU load not higher than the preset CPU load can include a CPU load equal to the preset CPU load or a CPU load lower than the preset CPU load.
[0052] The first CPU group and the second CPU group are CPU groups created using CGROUP technology for control plane services and data plane services, for example, such as... Figure 4 As shown, the CPU cores included in the first CPU group and the CPU cores included in the second CPU group are different CPU cores, and there is no overlap. Using CGROUP technology, management groups are created for the control plane services, and storage groups are created for the data plane services. The management groups and storage groups are allocated different CPU cores for isolation.
[0053] Specifically, first, the `cgcreate` command is used to create two groups in the CPU subsystem: `management` and `storage`. This operation will generate the corresponding control group directories under ` / sys / fs / cgroup / cpu / `.
[0054] Then, the cpuset subsystem binds specific CPU cores to the groups. Specifically, the file ` / sys / fs / cgroup / cpuset / management / cpuset.cpus` is edited, specifying the target cores (e.g., 0,1 indicates using CPUs 0 and 1); similarly, other cores (e.g., 2,3) are allocated to the storage group. This operation ensures that the two service groups run on independent CPU cores, achieving physical isolation. Next, use cgexec or cgclassify to bind the service process to the corresponding group.
[0055] In this embodiment, the preset CPU load can be a fixed value or a dynamically adjustable value. When the preset CPU load is dynamically adjustable, a threshold adaptive algorithm based on historical load patterns can be established to analyze the cyclical patterns of CPU utilization over 24 hours. During peak business hours, the threshold is automatically increased (e.g., from 30% to 50%) to allow more services to share CPU resources; during idle hours, the threshold is decreased to strengthen isolation. Optionally, a machine learning prediction model can also be used to dynamically adjust the preset CPU load.
[0056] Once the current CPU load is obtained, it can be compared with the preset CPU load. If the current CPU load is lower than or equal to the preset CPU load, the service scheduler can migrate the target control plane service and data plane service to dedicated CPU groups for execution. Specifically, using the soft affinity feature of CGROUP, if the current CPU load is lower than or equal to the preset CPU load, the control plane service will only run within the soft-affinity CPU group, isolated from the data plane service. That is, the service scheduler will migrate the target control plane service to the first CPU group for execution, and the data plane service to the second CPU group for execution.
[0057] This application provides a service management method that reduces the CPU consumption of the control plane service within a preset time period by adjusting the execution logic and / or execution time of each sub-service of the control plane service. This results in a target control plane service. The current CPU load is then obtained. If the CPU load is not higher than a preset CPU load, the target control plane service is controlled to run on a first CPU group, and the data plane service is controlled to run on a second CPU group. The first CPU group contains dedicated CPUs for running the target control plane service, and the second CPU group contains dedicated CPUs for running the data plane service. This method achieves strict isolation, ensuring that data plane services (especially those sensitive to I / O performance) are never disturbed by sudden tasks from the control plane service, thus guaranteeing extremely stable storage I / O performance and avoiding performance fluctuations.
[0058] Please see Figure 5 This application provides a service management method, the method comprising: Step S210: By adjusting the execution logic and / or execution time of each sub-service of the control plane service within a preset time period, the CPU consumption of the control plane service within the preset time period is reduced, and the target control plane service is obtained.
[0059] Step S220: Obtain the current CPU load.
[0060] Step S230: If the CPU load is higher than the preset CPU load, select any one or more target CPUs from the second CPU group.
[0061] In this embodiment of the application, the target CPU is the CPU in an idle state among the CPUs included in the second CPU group.
[0062] One or more target CPUs can be allocated from the second CPU group in the following way. Specifically, the system first monitors the load of each CPU core in real time through the kernel's load balancing mechanism (such as the load_balance function). When the overall CPU load exceeds a preset threshold (configured through parameters such as / proc / sys / kernel / sched_migration_cost), a resource reallocation process is triggered.
[0063] Then, in the second CPU group where the data plane service resides, the scheduler checks the current task queue status of each core. If a core's runqueue is empty (i.e., there are no tasks to be executed), it is marked as "idle". For example, if the second CPU group contains cores 2 and 3, and core 3 has no tasks, then core 3 is selected.
[0064] Then, using the CGROUP's cpuset subsystem, the selected idle cores are removed from the second CPU group and reassigned to the first CPU group where the management plane service resides. Specific operations may include: 1. Modifying the cpuset.cpus file; 2. Updating process bindings: using cgexec or cgclassify to migrate the management plane service process to the newly added core.
[0065] Furthermore, the kernel's CFS scheduler will prioritize scheduling management plane service tasks to the newly added cores based on the new CPU allocation, avoiding resource contention with data plane services. Through the `cpu.shares` and `cpu.cfs_quota_us` parameters of the CGroup, it ensures that management plane services obtain a preset CPU quota on the newly added cores, maintaining resource isolation.
[0066] If the load falls below the threshold, the core can be returned to the second CPU group via a reverse operation, restoring the initial isolation state. As one approach, if the CPU load is higher than the preset CPU load, one or more target CPUs are allocated from the second CPU group, including: if the CPU load is higher than the preset CPU load, obtaining the number of nodes currently executing tasks, where the nodes are servers or hosts; and based on the number of nodes, allocating one or more target CPUs from the second CPU group.
[0067] In an embodiment of the present application, if the current CPU load is higher than the preset CPU load, the number of nodes executing the current task can be obtained, and then the number of idle CPUs divided from the second CPU group can be determined according to the obtained number of nodes.
[0068] Generally speaking, the more the number of nodes, the more the number of target CPUs divided from the second CPU group. Specifically, multiple node number ranges can be divided, and different node number ranges correspond to different numbers of target CPUs. For example, multiple node number ranges can include a small-scale node number (e.g., N≤5), a medium-scale node number (e.g., 5<N≤20), and a large-scale node number (e.g., N>20); a small-scale node number corresponds to one target CPU; a medium-scale node number corresponds to N * scaling factor target CPUs; a large-scale node number corresponds to at least 2 idle CPUs or a fixed number of target CPUs.
[0069] Through the above settings, the number of target CPUs that can be divided from the second CPU group can be dynamically adjusted according to the node number range to which the number of nodes executing the current task obtained in real time belongs.
[0070] Step S240: Control the target control plane service to run on the first CPU group and the any one or any multiple target CPUs.
[0071] In an embodiment of the present application, after any one or any multiple target CPUs are divided from the second CPU group by the above method, the service scheduler can migrate the target control plane service to run on the first CPU group and any one or any multiple target CPUs.
[0072] Optionally, the target control plane service and the data plane service can also be migrated to run on the target CPU. At this time, the target CPU can be divided into two parts according to the number of target control plane services and the number of data plane services in proportion to respectively run the target control plane service and the data plane service.
[0073] Through the foregoing method, if the current CPU load is higher than the preset CPU load, the target control plane service can jump out of the isolated group to avoid the situation that the service cannot respond in time when the CPU is busy; at the same time, the number of CPU cores of the control plane service can meet the necessary overhead, and the number of CPU cores of the data plane service can meet the performance requirements of storage, avoiding the I / O performance jitter of the data plane service caused by CPU preemption.
[0074] This application provides a service management method that reduces the CPU consumption of the control plane service within a preset time period by adjusting the execution logic and / or execution time of each sub-service of the control plane service. This yields a target control plane service. The current CPU load is then obtained. If the CPU load is higher than a preset CPU load, one or more target CPUs are allocated from a second CPU group, and the target control plane service is controlled to run on the first CPU group and one or more target CPUs. This method achieves physical isolation by allocating control plane services (such as configuration management and monitoring) and data plane services (such as business traffic processing) to different CPU groups. This avoids interference from high loads on data plane services to control plane services, ensuring the stable operation of critical management functions. By monitoring CPU load in real time, the system can flexibly allocate idle resources from the second CPU group (dedicated to the data plane) to the first CPU group (dedicated to the control plane), thereby optimizing overall resource utilization. This dynamic allocation avoids the waste or insufficiency caused by static resource allocation.
[0075] Please see Figure 6 This application provides a service management method, the method comprising: Step S310: For the control plane service running within a preset time period, increase the runtime of the control plane service to reduce the CPU consumption of the control plane service within the preset time period, and obtain the target control plane service.
[0076] In this embodiment of the application, adding the runnable time period of the control plane service can be understood as adding the runnable time period of the control plane service on the basis of the preset time period, that is, it can be understood as turning the runnable time period of the control plane service into "preset time period + runnable time period".
[0077] As one approach, the control plane service includes multiple sub-services. For the control plane service running within a preset time period, increasing the runtime segments of the control plane service includes: setting different execution time nodes for each sub-service within the preset time period, distributing the execution time nodes of the multiple sub-services across the preset time period and the runtime segments, thereby reducing the execution concurrency of the sub-services within the preset time period.
[0078] In this embodiment, a sub-service can be understood as a process or thread; an execution time node can be understood as the execution time of each sub-service; and execution concurrency can be used to characterize the number of sub-services executed concurrently at the same time point. By setting different timestamps for each sub-service, the execution time of the scheduled task can be evenly distributed across various time periods, avoiding concurrent execution of tasks at the same time point and reducing CPU peak load.
[0079] One approach is to use a time window sharding mechanism to allocate multiple sub-services to different time periods for execution.
[0080] Specifically, control plane services can be categorized based on service priority and resource requirements, and a unique time offset can be assigned to each control plane service to ensure that execution time points are evenly distributed.
[0081] In one approach, execution time nodes are typically generated automatically by the scheduler (such as Cron on Linux or CronJob on Kubernetes) based on a preset scheduling policy. For example, if tasks need to be distributed across different time periods, the system will dynamically calculate the next execution time node based on the current time, task interval, historical execution time, and other factors.
[0082] In soft affinity scheduling, the system may combine CPU load balancing strategies to allocate different time windows for tasks, thereby avoiding resource contention between cores.
[0083] Furthermore, there is the indirectness of manual configuration: users can indirectly influence the generation of execution time nodes through configuration parameters (such as task intervals and start times), but the specific calculation of time points is still completed by the system. For example, a user sets a task to execute every 2 hours, but the system needs to dynamically calculate the first execution time based on the current time (e.g., if the current time is 10:00, the first execution time is 12:00). If tasks need to be distributed evenly, the system may automatically adjust the timestamps, distributing similar tasks across different time periods (e.g., task A executes at 10:00 and 12:00, and task B executes at 10:30 and 12:30).
[0084] Furthermore, when assigning different execution time nodes to multiple sub-services, different execution time nodes can be set for each sub-service based on its service priority. The higher the priority of a sub-service, the earlier its execution time node can be set, and vice versa. Of course, the execution time nodes for multiple sub-services can also be dynamically adjusted based on real-time monitored CPU utilization.
[0085] In this embodiment, the control plane service may include scheduled tasks and service keep-alive tasks. Setting different execution time nodes for each sub-service may include setting different execution time nodes for each scheduled task and different execution time nodes for each service keep-alive task.
[0086] Setting different execution time nodes for each scheduled task can include: classifying scheduled tasks according to their priority and resource requirements, assigning a unique time offset to each scheduled task, and ensuring that execution time nodes are evenly distributed.
[0087] Setting different execution time nodes for each service keep-alive task can include: classifying service keep-alive tasks according to their priority and resource requirements, assigning a unique time offset to each service keep-alive task, and ensuring that execution time nodes are evenly distributed.
[0088] For example, the optimization process described above can be as follows: Figure 7 and Figure 8 As shown, the task execution timeline before optimization can be as follows: Figure 7 As shown, multiple tasks are executed at time point t1. The optimized task execution timeline can be as follows: Figure 8 As shown, multiple tasks are distributed across different points in time for execution. As one approach, the internal execution logic of the control plane service is split from a large script into smaller scripts to reduce the CPU consumption of the control plane service and obtain the target control plane service.
[0089] In this embodiment, the CPU consumption of the control plane service can be reduced within a preset time period by optimizing the internal execution logic of the control plane service. The internal execution logic can be understood as the specific rules and processing flow followed by the service when executing tasks.
[0090] Breaking down the internal execution logic of the control plane service from large scripts into smaller scripts can involve the following steps: First, identify high CPU-consuming modules within the large script, using performance monitoring tools to pinpoint specific bottleneck functions or code segments. Then, divide the complex business logic according to functional responsibilities, identifying independently executable sub-task units. Based on the relevance and execution order of the business logic, decompose the large script into multiple functionally simple smaller scripts. Each smaller script should possess the following characteristics: focused on a single business function, with clear input / output interfaces, and capable of independent execution or as-needed combination.
[0091] After breaking down a large script into smaller scripts, a message queue or event-driven architecture can be used to coordinate the execution of the smaller scripts: register the smaller scripts as independent service units, communicate between services through message middleware, and achieve asynchronous processing of tasks and result callbacks.
[0092] Furthermore, a unified scheduler can be designed to manage the execution order and resource allocation of small scripts: determine the execution sequence based on task priority and dependencies, monitor the CPU usage of each small script, and dynamically adjust the execution frequency and concurrency.
[0093] Optionally, CPU consumption can be further reduced by: setting reasonable execution intervals and timeouts for small scripts; implementing load balancing to avoid multiple high-consumption scripts running simultaneously; and adding caching mechanisms to reduce redundant calculations.
[0094] Similarly, in the embodiments of this application, splitting the internal execution logic of the control plane service from a large script into smaller scripts may include: splitting the internal execution logic of the scheduled task from a large script into smaller scripts; and splitting the internal execution logic of the service keep-alive task from a large script into smaller scripts.
[0095] In the embodiments of this application, reducing the concurrency of the control plane service and optimizing the internal execution logic of the control plane service can be used alone to reduce the CPU consumption of the control plane service within a preset time period, or they can be used in combination to reduce the CPU consumption of the control plane service within a preset time period. No specific limitation is made here.
[0096] This decomposition approach not only reduces the peak CPU consumption of individual services but also improves system maintainability and scalability. By breaking down complex business logic into smaller units, the system can more finely control resource allocation, thereby optimizing overall performance.
[0097] Step S320: Based on the data plane service and the target control plane service, divide all CPUs into the first CPU group and the second CPU group.
[0098] Step S330: Obtain the current CPU load.
[0099] Step S340: If the CPU load is not higher than the preset CPU load, control the target control plane service to run on the first CPU group and control the data plane service to run on the second CPU group, wherein the CPUs included in the first CPU group are dedicated CPUs for running the target control plane service and the CPUs included in the second CPU group are dedicated CPUs for running the data plane service.
[0100] Step S350: If the CPU load is higher than the preset CPU load, select any one or more target CPUs from the second CPU group.
[0101] Step S360: Control the target management plane service to run on the first CPU group and any one or more target CPUs.
[0102] This application provides a service management method that, by distributing the execution time of control plane services across different time periods, avoids CPU resource contention caused by multiple services running simultaneously, thereby effectively reducing instantaneous CPU utilization. Distributing execution time can prevent service response delays or crashes due to CPU overload, ensuring the stable operation of core business processes.
[0103] Please see Figure 9This application provides a service management device 400, which includes: The reduction unit 410 is used to reduce the CPU consumption of the control plane service within a preset time period by adjusting the execution logic and / or execution time of each sub-service of the control plane service within a preset time period, thereby obtaining the target control plane service.
[0104] In one approach, the reduction unit 410 is specifically used to divide all CPUs into a first CPU group and a second CPU group based on the data plane service and the target control plane service.
[0105] As another approach, the reduction unit 410 is specifically used to increase the runtime of the control plane service running within a preset time period, so as to reduce the CPU consumption of the control plane service within the preset time period and obtain the target control plane service.
[0106] Furthermore, the reduction unit 410 is specifically used to set different execution time nodes for each sub-service within the preset time period, and distribute the execution time nodes of the multiple sub-services to the preset time period and the runnable period, so as to reduce the execution concurrency of the sub-services within the preset time period.
[0107] Optionally, the reduction unit 410 is specifically used to split the internal execution logic of the control plane service from a large script into a small script in order to reduce the CPU consumption of the control plane service and obtain the target control plane service.
[0108] Acquisition unit 420 is used to acquire the current CPU load.
[0109] The control unit 430 is configured to, if the CPU load is not higher than a preset CPU load, control the target control plane service to run on the first CPU group and control the data plane service to run on the second CPU group, wherein the CPUs included in the first CPU group are dedicated CPUs for running the target control plane service and the CPUs included in the second CPU group are dedicated CPUs for running the data plane service.
[0110] In one manner, the control unit 430 is specifically configured to, if the CPU load is higher than the preset CPU load, divide out any one or more target CPUs from the second CPU group; and control the target management plane service to run on the first CPU group and the one or more target CPUs.
[0111] Furthermore, the control unit 430 is specifically used to obtain the number of nodes currently executing tasks if the CPU load is higher than the preset CPU load, wherein the nodes are servers or hosts; and based on the number of nodes, to divide out any one or more target CPUs from the second CPU group.
[0112] It should be noted that the device embodiments in this application correspond to the aforementioned method embodiments. The specific principles in the device embodiments can be found in the content of the aforementioned method embodiments, and will not be repeated here.
[0113] The following will combine Figure 10 This application describes an electronic device.
[0114] Please see Figure 10 Based on the aforementioned service management method and apparatus, this application embodiment also provides another electronic device 800 capable of executing the aforementioned service management method. The electronic device 800 includes one or more (only one shown in the figure) processors 802, a memory 804, and a network module 806 coupled together. The memory 804 stores programs capable of executing the contents of the aforementioned embodiments, and the processor 802 can execute the programs stored in the memory 804.
[0115] The processor 802 may include one or more processing cores. The processor 802 connects to various parts within the electronic device 800 using various interfaces and lines, and performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 804, and by calling data stored in the memory 804. Optionally, the processor 802 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 802 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 802 and may be implemented separately using a communication chip.
[0116] The memory 804 may include random access memory (RAM) or read-only memory (ROM). The memory 804 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 804 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the various method embodiments described below. The data storage area may also store data created by the electronic device 800 during use (such as phonebook data, audio and video data, chat log data, etc.).
[0117] The network module 806 is used to receive and transmit electromagnetic waves, realizing the mutual conversion between electromagnetic waves and electrical signals, thereby communicating with communication networks or other devices, such as electronic devices. The network module 806 may include various existing circuit elements for performing these functions, such as antennas, radio frequency transceivers, digital signal processors, encryption / decryption chips, SIM cards, memory, etc. The network module 806 can communicate with various networks such as the Internet, corporate intranets, and wireless networks, or communicate with other devices through wireless networks. The aforementioned wireless networks may include cellular telephone networks, wireless local area networks, or metropolitan area networks. For example, the network module 806 can interact with base stations.
[0118] Please refer to Figure 11 This diagram illustrates a structural block diagram of a computer-readable storage medium provided in an embodiment of this application. The computer-readable storage medium 900 stores program code that can be called by a processor to execute the methods described in the above method embodiments.
[0119] The computer-readable storage medium 900 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 900 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 900 has storage space for program code 910 that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code 910 may, for example, be compressed in a suitable form.
[0120] This application provides a service management method, apparatus, electronic device, and storage medium. By adjusting the execution logic and / or execution time of each sub-service of the control plane service within a preset time period, the CPU consumption of the control plane service within the preset time period is reduced to obtain a target control plane service. Then, the current CPU load is obtained. If the CPU load is not higher than a preset CPU load, the target control plane service is controlled to run on a first CPU group, and the data plane service is controlled to run on a second CPU group. The CPUs in the first CPU group are dedicated CPUs for running the target control plane service, and the CPUs in the second CPU group are dedicated CPUs for running the data plane service. Through this method, strict isolation is achieved, ensuring that data plane services (especially those sensitive to I / O performance) are never disturbed by sudden tasks from the control plane service, thereby guaranteeing the extreme stability of storage I / O performance and avoiding performance fluctuations.
[0121] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of the present invention.
Claims
1. A service management method, characterized in that, The method includes: By adjusting the execution logic and / or execution time of each sub-service of the control plane service within a preset time period, the CPU consumption of the control plane service within the preset time period is reduced, and the target control plane service is obtained. Get the current CPU load; If the CPU load is not higher than the preset CPU load, the target control plane service is controlled to run on the first CPU group, and the data plane service is controlled to run on the second CPU group. The CPUs included in the first CPU group are dedicated CPUs for running the target control plane service, and the CPUs included in the second CPU group are dedicated CPUs for running the data plane service.
2. The method according to claim 1, characterized in that, The method further includes: If the CPU load is higher than the preset CPU load, any one or more target CPUs are selected from the second CPU group; Control the target management plane service to run on the first CPU group and the target CPU.
3. The method according to claim 2, characterized in that, If the CPU load is higher than the preset CPU load, the step of selecting any one or more target CPUs from the second CPU group includes: If the CPU load is higher than the preset CPU load, obtain the number of nodes currently executing tasks, where the nodes are servers or hosts; Based on the number of nodes, any one or more target CPUs can be selected from the second CPU group.
4. The method according to claim 1, characterized in that, The process of reducing the CPU consumption of the control plane service within a preset time period to obtain the target control plane service includes: For the control plane service running within a preset time period, the runtime period of the control plane service is increased to reduce the CPU consumption of the control plane service within the preset time period, thereby obtaining the target control plane service.
5. The method according to claim 4, characterized in that, The control plane service includes multiple sub-services. Adding runtime periods for the control plane service that operates within a preset time period includes: Different execution time nodes are set for each sub-service within the preset time period, and the execution time nodes of the multiple sub-services are distributed across the preset time period and the runnable period to reduce the execution concurrency of the sub-services within the preset time period.
6. The method according to claim 5, characterized in that, The method further includes: The internal execution logic of each sub-service is split from a large script into smaller scripts to reduce the CPU consumption of the control plane service within the preset time period, thereby obtaining the target control plane service.
7. A service management device, characterized in that, The device includes: The reduction unit is used to reduce the CPU consumption of the control plane service within a preset time period by adjusting the execution logic and / or execution time of each sub-service of the control plane service within the preset time period, so as to obtain the target control plane service. The acquisition unit is used to acquire the current CPU load; The control unit is configured to, if the CPU load is not higher than a preset CPU load, control the target control plane service to run on the first CPU group and control the data plane service to run on the second CPU group, wherein the CPUs included in the first CPU group are dedicated CPUs for running the target control plane service and the CPUs included in the second CPU group are dedicated CPUs for running the data plane service.
8. The apparatus according to claim 7, characterized in that, The reduction unit is also used to increase the runtime of the control plane service for the control plane service running within a preset time period, so as to reduce the CPU consumption of the control plane service within the preset time period and obtain the target control plane service.
9. An electronic device, characterized in that, It includes one or more processors; one or more programs are stored in the memory and configured to be executed by the one or more processors according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program code, wherein the program code, when executed by a processor, performs the method according to any one of claims 1-7.