Data processing system and method, device, storage medium, and program product
By deploying service instances of service groups in a distributed system and executing the master switching process, the resource waste caused by Raft workgroup expansion is solved, resource utilization and service availability are improved, and load balancing is achieved.
Patent Information
- Application Number
- PCT/CN2026/084413
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2025-05-06
- Filing Date
- 2026-03-19
- Publication Date
- 2026-11-12
AI Technical Summary
In a distributed architecture, the expansion of Raft workgroups leads to resource waste, especially with the leader node incurring significant resource overhead and non-leader nodes experiencing high resource idle rates, thus impacting resource utilization and system availability.
By distributing multiple service groups across multiple physical machines, with each service group's multiple service instances deployed on different physical machines, and at least two service instances of the same service group deployed on the same physical machine, load balancing is achieved by monitoring and executing the master switch process through a management node to balance the resource consumption of the master instance.
It improves the resource utilization of physical machines, reduces resource waste, ensures high availability and reliability of services, and achieves load balancing among physical machines.
Smart Images

Figure CN2026084413_12112026_PF_FP_ABST
Abstract
Description
Data processing systems and methods, equipment, storage media and program products
[0001] This disclosure claims priority to Chinese Patent Application No. 202510578872.4, filed on May 6, 2025, entitled “Data Processing System and Method, Apparatus, Storage Medium and Program Product”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This disclosure relates to the field of cloud computing technology, and in particular to a data processing system and method, device, storage medium and program product. Background Technology
[0003] In an increasing number of cloud storage scenarios, distributed architectures are being adopted to organize and manage metadata in order to achieve high availability of metadata. This distributed architecture includes multiple nodes responsible for providing metadata services. The metadata of multiple nodes remains consistent, so that if one node fails, the system can switch to other nodes without affecting the availability of the entire system.
[0004] In practical applications, the Raft (Replication and Fault Tolerant, distributed consensus algorithm) protocol can maintain the consistency of metadata deployment across multiple nodes. Specifically, an elected leader node provides metadata services to users, and if the leader node fails, the other nodes will re-elect a new leader node. These multiple nodes form a Raft workgroup. As the demand for metadata access increases, multiple Raft workgroups can be horizontally scaled to meet the performance requirements of metadata services.
[0005] Providing metadata services through Raft working groups can guarantee high availability, but it also leads to resource waste, which becomes increasingly serious as Raft working groups continue to expand. Summary of the Invention
[0006] This disclosure provides a data processing system and method, device, storage medium, and program product to ensure high service availability in a distributed system while improving the resource utilization of physical machines in the system.
[0007] This disclosure provides a data processing system, including: a management node, and multiple service groups distributed across multiple physical machines. Each service group includes multiple service instances. The multiple service instances within the same service group are deployed on different physical machines, and at least two service instances from the same service group are deployed on the same physical machine. The multiple service instances within the same service group execute a master election process to elect a master instance. The master instance responds to service requests from clients and synchronizes the service requests with other service instances in its service group to maintain data consistency with other service instances. The management node, upon detecting at least two master instances on the same physical machine, triggers a master switching process to switch the at least two master instances to at least two physical machines.
[0008] This disclosure provides a data processing system, including: a management node, and multiple service groups distributed across multiple physical machines. Each service group includes multiple service processes. The service processes within the same service group are deployed on different physical machines, and at least two service processes from different service groups are deployed on the same physical machine. Service processes belonging to different service groups on the same physical machine are isolated from each other. The multiple service processes within the same service group execute a leader election process to elect a leader process. The leader process responds to service requests from clients and synchronizes the service requests to other service processes within its service group in a log format to maintain data consistency with other service processes. The management node, upon detecting at least two leader processes on the same physical machine, triggers a leader switching process to switch the at least two leader processes to at least two physical machines.
[0009] This disclosure provides a data processing system, including: a management node, and multiple service groups distributed across multiple physical machines. Each service group includes multiple service threads. The service threads within the same service group are deployed on different physical machines, and at least two service threads from different service groups are deployed on the same physical machine. Service threads belonging to different service groups on the same physical machine are deployed in the same shared process. The multiple service threads within the same service group execute a master thread election process to elect a master thread. The master thread responds to service requests from clients and synchronizes the service requests to other service threads within its service group in a log format to maintain data consistency with other service threads. The management node, upon detecting at least two master threads on the same physical machine, triggers a master thread switching process to switch the at least two master threads to at least two physical machines.
[0010] This disclosure provides a data processing method in which multiple service groups are deployed on multiple physical machines, each service group including multiple service instances; wherein multiple service instances in the same service group are deployed on different physical machines, and at least two service instances from the same service group are deployed on the same physical machine; the method includes: monitoring the number of primary instances on the same physical machine; the primary instance is elected by multiple service instances in the same service group through a primary election process, the primary instance is used to respond to service requests from clients and synchronize the service requests with other service instances in its service group to maintain data consistency with other service instances; and, when at least two primary instances are detected on the same physical machine, triggering a primary switching process to switch the at least two primary instances to at least two physical machines.
[0011] This disclosure also provides an electronic device, including a memory and a processor. The memory is used to store a computer program, and the processor is coupled to the memory to execute the computer program for implementing the steps in the various methods provided in this disclosure.
[0012] This disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a processor, enables the processor to perform the steps in the methods described above.
[0013] This disclosure also provides a computer program product, which includes a computer program / instructions that, when executed by a processor, enable the processor to perform the steps described in the method embodiments above.
[0014] In this embodiment of the disclosure, a data processing system is provided, which deploys multiple service instances of the same service group on different physical machines, and deploys service instances of different service groups on the same physical machine, so that the number of service instances on different physical machines tends to be average, thereby making full use of the resources of existing machines and improving resource utilization; and, when the presence of master instances of different service groups on the same physical machine is detected, a master switching process is executed to switch the master instances of different service groups to different physical machines, thereby balancing the resource consumption levels of the master instances of each service group and other service instances, and achieving load balancing among physical machines.
[0015] Furthermore, in an optional embodiment of this disclosure, service instances are implemented as service processes. Service processes of different service groups deployed on the same physical machine are resource-isolated and do not affect each other, thereby improving the reliability and security of the service.
[0016] Furthermore, in an optional embodiment of this disclosure, the service instance is implemented as a service thread, and service threads belonging to different service groups on the same physical machine are deployed in the same shared process. Since service threads of different service groups share the same process space, the resource overhead of process creation is reduced. Attached Figure Description
[0017] The accompanying drawings, which are included to provide a further understanding of this disclosure and form part of this disclosure, illustrate exemplary embodiments of the present disclosure and are used to explain the disclosure, but do not constitute an undue limitation of the disclosure. In the drawings:
[0018] Figure 1 is a schematic diagram of the federal architecture provided in an exemplary embodiment of this disclosure;
[0019] Figure 2 is a schematic diagram of the structure of a data processing system provided in an exemplary embodiment of this disclosure;
[0020] Figure 3 is a schematic diagram of the structure of another data processing system provided in yet another exemplary embodiment of this disclosure;
[0021] Figure 4 is a flowchart illustrating a data processing method provided in an exemplary embodiment of this disclosure;
[0022] Figure 5 is a schematic diagram of the structure of an electronic device provided in another exemplary embodiment of this disclosure. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of this disclosure clearer, the technical solutions of this disclosure will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without creative effort are within the scope of protection of this disclosure.
[0024] It should be noted that, in the cases involving user information in the embodiments of this disclosure, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the embodiments of this disclosure are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse. In addition, the various models involved in this disclosure (including but not limited to language models or large models) comply with relevant laws and standards.
[0025] To meet the ever-increasing performance demands of metadata services, the inventors of this case propose a federation architecture as shown in Figure 1. This federation architecture achieves near-linear growth in metadata service performance through horizontal scaling of multiple Raft workgroups. The federation architecture comprises one or more Raft workgroups, which can be simply referred to as workgroups. Figure 1 provides a schematic diagram of the federation architecture, showing only two workgroups, such as workgroup R1 and workgroup R2, but not limited to these. Each workgroup includes a leader node and non-leader nodes.
[0026] As shown in Figure 1, workgroup R1 includes a leader node L11 and non-leader nodes L12-L15; workgroup R2 includes a leader node L23, non-leader nodes L21, L22, L24, and L25. Within a workgroup, the leader node provides metadata services, while the other non-leader nodes are redundant nodes provided to ensure high availability of the metadata services, allowing for the re-election of a new leader node should the leader node fail.
[0027] A federated architecture, by horizontally scaling workgroups, can meet the performance requirements of metadata services that grow almost linearly. However, within a workgroup, metadata services can achieve their theoretically optimal performance by consuming only a certain proportion of physical resources. Furthermore, since the leader node is the node that actually provides the metadata service, the physical resource consumption of the leader node and non-leader nodes is not balanced. Relatively speaking, the resource consumption of the leader node is larger, while the resource consumption of non-leader nodes is smaller, resulting in a higher idle rate of physical resources on the physical machines on which they reside.
[0028] For example, as shown in Figure 1, the resource utilization rate of the physical machine where the leader node L11 of workgroup R1 is located can reach 30%, while the resource utilization rate of the physical machines where the non-leader nodes L12, L13, L14, and L15 of workgroup R1 are located can reach 10%. This demonstrates that while providing metadata services in the form of workgroups can guarantee high availability, it also leads to resource waste, especially as the workgroup expands, the problem of resource waste becomes increasingly serious.
[0029] Therefore, this disclosure provides a data processing system comprising multiple physical machines and multiple service groups, each service group comprising multiple service instances for providing corresponding services. In this system, multiple service instances within the same service group are deployed on different physical machines, and at least two service instances from service groups are deployed on the same physical machine. These at least two service groups can be at least a subset of the multiple service groups.
[0030] In this embodiment, a master instance election process is performed among multiple service instances of the same service group to elect a master instance, which then provides services for that service group to clients. For example, a client can send a service request to the master instance. The master instance responds to the service request by providing the corresponding service to the client and synchronizes the status information of the service request or the service provided based on the service request with other service instances. This allows other service instances to synchronize their status and maintain data consistency with the master instance. In the event of an anomaly at the master instance, a new master instance node can be re-elected, thereby ensuring high availability of the service.
[0031] In this embodiment, a new management node is added, which can monitor the number of primary instances on different physical machines. When at least two primary instances are detected on the same physical machine, a primary switching process is triggered to switch the at least two primary instances to different physical machines, thereby achieving load balancing between physical machines.
[0032] In this embodiment of the disclosure, multiple service instances of the same service group are deployed on different physical machines, and service instances of different service groups are deployed on the same physical machine, so that the number of service instances on different physical machines tends to be average, thereby making full use of the resources of existing machines and improving resource utilization; and, when the presence of master instances of different service groups on the same physical machine is detected, a master switching process is executed to switch the master instances of different service groups to different physical machines, thereby balancing the resource consumption levels of the master instances of each service group and other service instances, and achieving load balancing among physical machines.
[0033] Optionally, the aforementioned data processing system can be implemented as a metadata storage system, which includes multiple data partitions. In this embodiment, based on partitioning technology, metadata is divided into multiple data partitions, and service instances in different service groups are responsible for providing metadata services for different data partitions. Different data partitions store different metadata, and the amount of metadata stored in each partition is relatively small. Furthermore, different service groups are configured for different data partitions, allowing different service groups to work in parallel, which improves metadata access efficiency. Regardless of the data partition, the primary instance in the service group responsible for that data partition provides metadata services to the client. For example, the client can send a service request to the primary instance in the service group responsible for that data partition, and the primary instance responds to the service request by providing the metadata service for that data partition to the client. Further, the primary instance can also synchronize the service request or the metadata information provided after the service request to other service instances, allowing other service instances to synchronize their states and maintain data consistency with the primary instance.
[0034] It should be noted that the number of service instances included in different service groups can be the same or different, and there is no limitation on this. Furthermore, there is no limitation on the quantitative relationship between service groups and physical machines. Optionally, the number of service groups can be less than or equal to the number of physical machines, thereby enabling the primary instances in different service groups to be deployed on different physical machines. This keeps the number of primary instances on different physical machines within a reasonable range, averages the resource consumption levels of different physical machines, and improves the overall system resource utilization.
[0035] When the number of service groups equals the number of physical machines, the primary instance of each service group can be deployed on different physical machines, ensuring that one primary instance runs on each physical machine. This provides sufficient resources for the primary instance of each service group, maintaining its stable and efficient operation. Optionally, service instances from all service groups can be deployed on the same physical machine to achieve load balancing among the physical machines.
[0036] In this embodiment, due to various reasons, such as the service being deployed for the first time or during service operation, or due to physical machine failure or service instance failure, at least two master instances belonging to different service groups may appear on the same physical machine, resulting in a large load pressure on the same physical machine. In order to achieve load balancing between physical machines, a master instance switching process can be executed. The master instance switching process is described below.
[0037] In one optional embodiment, if the control node detects at least two master instances belonging to different service groups on the same physical machine, it determines the service group from which the master instance needs to be switched, i.e., the target service group. Then, it determines candidate target master instances from other service instances in the target service group, triggering a re-election of the current master instance and other service instances in that service group to elect the target master instance as the new master instance.
[0038] Optionally, to facilitate the execution of the master switch process by the management node, the management node needs to pre-obtain relevant information about service instances in each service group, such as the service instance identifier and the identifier of the service group to which the service instance belongs. Based on this, after starting up, a service instance can send a registration request to the management node to register with the management node. This registration request includes the service instance's identifier information and the identifier information of the service group to which the service instance belongs. Accordingly, the management node records the service instance's identifier information and the identifier information of the service group to which the service instance belongs, so as to facilitate unified management of service instances in service groups and improve management efficiency. For example, based on the recorded service instance identifier information and the identifier information of the service group to which the service instance belongs, the management node can monitor whether there are at least two master instances belonging to different service groups on the same physical machine. If at least two master instances belonging to different service groups are detected on the same physical machine, the management node will execute the master switch process to distribute the master instances across different physical machines. Optionally, during the registration process, in addition to recording the identifier of the service instance and the identifier of the service group to which the service instance belongs, the type of the service instance (primary instance or non-primary instance), the information of the physical machine where the service instance is located, and the resource information of the service instance can also be recorded.
[0039] In this embodiment, the implementation form of the service instance is not limited. Optionally, the implementation form of the service instance includes: a service process and a service thread. The deployment method on the physical machine will differ depending on the implementation form of the service instance. The following describes the deployment method of the service instance on the physical machine for different implementation forms.
[0040] In one implementation, service instances are implemented as service processes, and service processes belonging to different service groups on the same physical machine are resource-isolated. Based on this, the physical machine can receive first configuration information and create service processes according to the first configuration information. The first configuration information includes an indication of the number of groups to be created and resource description information corresponding to that number of groups, where the resource description information describes the physical resources required to create the service groups. Furthermore, when creating service processes according to the first configuration information, the process includes: creating service groups matching the number of groups, and creating service processes for each of the created service groups; and allocating mutually isolated physical resources to the service processes of the created service groups, based on the first configuration information.
[0041] In another implementation, service instances are implemented as service threads, and service threads belonging to different service groups on the same physical machine are deployed in the same shared process. Based on this, the physical machine can receive second configuration information and create service threads according to the second configuration information. The second configuration information includes an indication of the number of threads to be created and shared resource description information, which describes the physical resources required to create the shared process. Furthermore, creating service threads according to the second configuration information includes: creating a shared process based on the number of threads and creating service threads matching the number of threads for that shared process; and allocating physical resources to the shared process according to the second configuration information.
[0042] Alternatively, in this embodiment of the disclosure, the control node can also be used to upgrade service instances of a service group. The method of canary upgrade will vary depending on the implementation of the service instance.
[0043] If a service instance is implemented as a service process, then the upgrade is performed on service processes in multiple service groups at the service group level. For example, if a physical machine is used as the upgrade target, and the service group is used as the upgrade granularity, then the service processes belonging to different service groups on the same physical machine can be upgraded in a canary manner; or, if a service group is used as the upgrade target, and the service group is used as the upgrade granularity, then the service processes in different service groups can be upgraded in a canary manner, while the service processes in the same service group deployed on different physical machines can be upgraded synchronously.
[0044] If the service instance is implemented as a service thread, then the upgrade is performed synchronously on service threads belonging to different service groups on the same physical machine, with the shared process as the upgrade granularity. Optionally, service threads deployed on different physical machines within the same service group can also be upgraded synchronously.
[0045] In this embodiment, the degree of resource isolation between service instances varies depending on their implementation. In one implementation, a service instance is implemented as a service process. Different service processes belonging to different service groups are deployed on the same physical machine, and their resources are isolated from each other, preventing interference. In another implementation, a service instance is implemented as a service thread. Service threads belonging to different service groups are deployed on the same physical machine, and these threads are deployed within the same shared process, where they compete for resources.
[0046] The following sections describe in detail the technical solutions provided by each embodiment of this disclosure for different implementation forms of service instances.
[0047] In this embodiment, a data processing system is provided, comprising: a management node, multiple physical machines, and multiple service groups. Multiple service groups are distributed across the multiple physical machines, and each service group includes multiple service processes. The number of service processes in different service groups can be the same or different, and this is not limited. Multiple service processes within the same service group are deployed on different physical machines, and at least two service processes from different service groups are deployed on the same physical machine. The service processes of at least two service groups are resource-isolated. The management node is used to monitor and manage the service processes of each service group on the multiple physical machines.
[0048] Figure 2 shows a schematic diagram of one structure of the data processing system described in this embodiment. The data processing system 200 shown in Figure 2 includes physical machines h1-h5, service groups D1-D5, and a control node G1, but is not limited to this. Taking service group D1 as an example, the main process D11 of service group D1 is deployed on physical machine h1. The main process refers to the process currently providing the service. Other service instances of service group D1, such as service processes D12-D15, are deployed on physical machines h2-h5 respectively. For other service groups such as service groups D2-D5, please refer to the relevant description of service group D1.
[0049] It should be noted that the number of service instances included in different service groups can be the same or different, and there is no limitation on this. Furthermore, there is no limitation on the quantitative relationship between service groups and physical machines. For example, as shown in Figure 2, the system may include 5 service groups and 5 physical machines, but it is not limited to this. Preferably, the number of service groups is less than or equal to the number of physical machines, so as to enable the distribution of primary instances in different service groups across different physical machines, achieving load balancing among the physical machines.
[0050] In this embodiment, multiple service processes within the same service group execute a leader election process to elect a master service process, which can be simply referred to as the master process. The master process is used to respond to service requests from clients and synchronize service requests with other service processes in its service group to maintain data consistency with other service processes. Here, other service processes refer to service processes within the same service group other than the current master process.
[0051] The specific implementation of the master instance election process is not limited; two embodiments are given below, but are not limited to these. In one optional embodiment, a new master instance is elected within the same service group using a distributed consensus algorithm. In another optional embodiment, the system can specify that a target master instance be selected from other service instances within the same service group, where other service instances refer to service instances in the service group other than the current master instance; then, the system controls the election of the current master instance and other service instances within the service group to elect the target master instance as the new master instance.
[0052] In some optional embodiments, a distributed consensus algorithm can be used among multiple service processes to maintain data consistency. Specifically, the elected master process is responsible for responding to client service requests and replicating the logs corresponding to those requests to other service processes within the same service group. When a predetermined number of service processes in the same service group have replicated the logs for the client's service request, they submit those logs to update the master process's state. Correspondingly, other service processes receive the logs corresponding to client service requests from the master process; and, upon receiving a log submission request from the master process, submit the logs corresponding to the client's service request to maintain data consistency with the master process.
[0053] In this embodiment, service processes from at least two service groups are deployed on the same physical machine. Here, "at least two service groups" refers to at least a subset of service groups among multiple service groups.
[0054] In this embodiment, when the control node G1 detects at least two master processes on the same physical machine, it triggers a master process switching procedure to switch the at least two master processes to at least two physical machines.
[0055] In this embodiment, multiple service processes of the same service group are deployed on different physical machines, and service processes of different service groups are deployed on the same physical machine. This makes the number of service instances on different physical machines more even, thereby fully utilizing the resources of existing machines and improving resource utilization. Furthermore, when different service group master processes are detected on the same physical machine, a master process switching procedure is executed to switch the master processes of different service groups to different physical machines, balancing the resource consumption levels of the master processes and other service processes of each service group, and achieving load balancing among physical machines. In addition, the service processes of different service groups deployed on the same physical machine are resource-isolated and do not affect each other, improving service reliability and security.
[0056] Optionally, the number of service groups is less than or equal to the number of physical machines, so that the main processes in different service groups can be deployed on different physical machines, so that the number of main processes on different physical machines is kept within a reasonable range, the resource consumption level of different physical machines tends to be averaged, and the resource utilization of the entire system is improved.
[0057] When the number of service groups equals the number of physical machines, the main process of each service group can be deployed on different physical machines, ensuring that one main process runs on each physical machine. This provides sufficient resources for the main process of each service group, maintaining its stable and efficient operation. Optionally, all service processes from all service groups can be deployed on the same physical machine to achieve load balancing among the physical machines.
[0058] As shown in Figure 2, the main process D22 of service group D2 is deployed on physical machine h2. Other service processes of service group D2, such as service processes D21, D23, D24, and D25, are deployed on physical machines h1, h3, h4, and h5, respectively. Similarly, other service processes of service group D3, such as service processes D31, D32, D34, and D35, are deployed on physical machines h1, h2, h4, and h5, respectively. Likewise, other service processes of service group D4, such as service processes D41, D42, D43, and D45, are deployed on physical machines h1, h2, h3, and h5, respectively. Other service processes of service group D5, such as service process D51, service process D52, service process D53 and service process D54, are deployed on physical machines h1, h2, h3 and h4 respectively.
[0059] Compared to the physical machines shown in Figure 1, in the system shown in Figure 2, taking a leader node's resource utilization rate of 30% and a non-leader node's resource utilization rate of 10% as an example, the resource utilization rate of each physical machine is 70%. In Figure 1, even if the resource utilization rate of the physical machine containing the leader node is 30%, the resource utilization rate of the physical machines containing the non-leader nodes is only 10%. Through the above comparison, it can be concluded that, based on this system architecture, this embodiment can fully reuse the resources of existing machines and improve service reliability and availability without increasing the number of physical machines. It should be understood that in this example, the increase in resource utilization rate, such as from 10% or 30% to 70%, is only an illustrative example under a specific application scenario and does not limit the technical effect of the solution.
[0060] In one optional embodiment, when the control node detects at least two master processes on the same physical machine, it determines the target service group from at least two service groups to which the master processes belong, where the target service group refers to the service group executing the master switching process. From other service processes within the target service group, a target process is selected. This target process refers to the new master process specified by the control node, thereby triggering the current master process and other service processes in the target service group to reselect the target process as the master process. This balances the number of master processes on different physical machines, achieving load balancing among physical machines.
[0061] Further optionally, when the control node determines the target service group from at least two service groups to which the master process needs to be switched, it includes: determining the target service group from at least two service groups based on the identification information, priority, number of service processes contained in the at least two service groups to which the master processes belong, and / or information on master process switching that has occurred within a specified time period.
[0062] In this embodiment, the target service group is determined based on different information dimensions of the service group. The information dimensions of the service group include at least one of the following: service group identification information, priority, number of service processes contained within the group, and / or information on the switching of the main process that has occurred within a specified time period. The various information dimensions are described below.
[0063] In this embodiment, the identification information of a service group is its unique identifier among multiple service groups. The specific implementation of the service group identification information is not limited. Two implementation methods are given below, but are not limited to these.
[0064] In one alternative implementation, the identification information of different service groups can form a size relationship. Therefore, when determining the target service group, it can be determined based on the size relationship between the identification information of the service groups. For example, the target service group can be preferentially selected based on whether the identification information is larger or smaller; this is not limited.
[0065] In another optional implementation, the identification information of different service groups is arranged in a chronological order, which includes, but is not limited to, the order of deployment time, the order of version updates, etc. Therefore, when determining the target service group, it can be determined based on the chronological order of the service group's identification information. For example, either the service group with an earlier or later order can be selected as the target service group; this is not limited.
[0066] In this embodiment, different priorities are pre-configured for different service groups. Then, a lower-priority service group can be selected as the target service group from at least two service groups. The priority reflects the importance of each service group and is used to quantify the impact of the service group on the data processing system's service delivery to clients. Prioritizing lower-priority service groups has a smaller impact on system stability; therefore, using lower-priority service groups as the target service group for the master switch process reduces the impact of the master switch process on system stability.
[0067] In this embodiment, the target service group can be determined according to the number of service processes it contains. For example, a service group with fewer service processes can be selected as the target service group to execute the master process switching process. Since the number of service processes is relatively small, the process of re-electing a new master process can be relatively fast. Alternatively, a service group with more service processes can be selected as the target service group to execute the master process switching process. Since the number of service processes is relatively large, more possibilities are provided for the selection of a new master process, and a service process with better performance can be selected as the new master process.
[0068] In this embodiment, the information regarding the master process switching that has occurred within a specified time period includes the number of master process switching events and the master process switching time. The number of master process switching events refers to the number of times the master process has switched within the specified time period; the master process switching time refers to the time of the most recent master process switching within the specified time period. For example, based on the number of master process switching events, service groups with fewer switching events can be selected as the target service groups for the master process switching process. Alternatively, based on the master process switching time, service groups with earlier switching times can be selected as the target service groups for the master process switching process, thus reducing the probability of service performance degradation caused by master process switching.
[0069] In one optional embodiment, when selecting a target service group, various information can also be considered, including the service group's identification information, priority, the number of service processes it contains, and / or information on the switching of the master process that has occurred within a specified time period. For example, a target service group can be selected simultaneously based on both the service group's identification information and the number of service processes it contains. Specifically, first, compare whether the number of service processes contained in two service groups is the same; if the number of service processes contained in two service groups is the same, the larger or smaller service group can be selected as the target service group based on the size of its identification information. As another example, a target service group can be selected simultaneously based on the service group's identification information, the number of service processes it contains, and information on the switching of the master process that has occurred within a specified time period. Specifically, first, compare whether the number of service processes contained in two service groups is the same; if the number of service processes contained in two service groups is the same, compare whether the number of switching of the master process that has occurred within the specified time period is the same; if the number of switching of the master process that has occurred within the specified time period is the same, the larger or smaller service group can be selected as the target service group based on the size of its identification information.
[0070] Optionally, when the control node selects a target process from other service processes in the target service group, it includes: selecting the target process from other service processes in the target service group based on the status information of other service processes in the target service group, the load information of the physical machine where it resides, and / or the status information of the physical machine where it resides.
[0071] In this embodiment, the service process status information is used to describe the running status of the service process, including but not limited to the resource usage and I / O efficiency of the service process. The load information of the physical machine where the service process resides reflects the current load pressure on the physical machine, including but not limited to: the resource usage of the physical machine and the number of service processes deployed on the physical machine. The physical machine status information includes: hardware status, software status, and historical failure rate, etc.
[0072] In this embodiment, "other service processes" refers to service processes in the target service group other than the current main process. The physical machines hosting these other service processes may be one or more, depending on both the number of service processes in the target service group and the number of physical machines in the data processing system. If multiple other service processes are deployed on the same physical machine, then the load and status information of these physical machines are identical.
[0073] Furthermore, based on the status information of each service process in the other service processes, the load information of the physical machine where it resides, and / or the status information of the physical machine, a target process is selected from the other service processes in the target service group. For example, if there is a service process among the other service processes with good resource utilization and high I / O efficiency, that service process can be selected as the target service process, which is beneficial to improving service efficiency. As another example, if the load information of the physical machine where the other service process resides reflects that the physical machine has low load pressure, other service processes on that physical machine can be selected as the target service process, which is beneficial to ensuring service quality and improving service efficiency. Yet another example, if the status information of the other service process reflects that the physical machine is in good health and has a low historical failure rate, other service processes on that physical machine can be selected as the target service process, which can reduce the probability of the target service process failing and ensure service quality. These methods of selecting target processes are merely examples and do not constitute a limitation on this embodiment. For example, a quality score for other service processes can be obtained by weighted summation based on the status information of other service processes, the load information of the physical machine, and the status information of the physical machine. The target service process can then be selected from among the other service processes based on the quality score, thus selecting a service process with a higher overall service quality.
[0074] Based on the embodiments disclosed herein, the implementation of deploying service instances in different service groups on a physical machine is not limited. In an optional embodiment, the physical machine may receive first configuration information, which includes an indication of the number of groups to create at least two service groups and at least two resource descriptions corresponding to that number of groups. Each resource description describes the physical resources required to create a service group. Then, at least two service groups are created according to the number of groups, and service processes are created for each of the at least two service groups. Furthermore, based on the at least two resource descriptions, mutually isolated physical resources are allocated to the service processes in the at least two service groups. Thus, the deployment of service instances in different service groups can be completed on the physical machine. The first configuration information may be configured and sent to the physical machine by the user through a configuration command, configured and sent to the physical machine by the user through a configuration interface, or pre-generated by the user and sent to the physical machine, from which the physical machine parses the configuration information.
[0075] In an optional embodiment, the process of creating at least two service groups based on the number of groups, creating service processes for each of the at least two service groups, and allocating mutually isolated physical resources to the service processes in the at least two service groups based on at least two resource description information includes: creating at least two service groups by calling the group manager provided by the operating system based on the number of groups; creating a service process for any service group; and allocating corresponding physical resources to the created service processes based on the resource description information corresponding to the service group in the at least two resource description information, wherein the physical resources allocated to different service processes are mutually isolated. The group manager is a component in the operating system that manages resource groups. Calling the group manager in the operating system can achieve resource isolation between service groups, and the operation is simple and easy to implement. It should also be noted that this operation can be performed autonomously by the physical machine, but is not limited to this; it can also be performed by a control node controlling the physical machine, with the physical machine cooperating under the control of the control node.
[0076] Further optionally, in this embodiment, it supports canary upgrades of service processes at the service group level. Optionally, in response to the first service upgrade command, the management node performs canary upgrades of service processes in multiple service groups at the service group level. Upgrading at the service group level means upgrading the service group as the upgrade unit.
[0077] Optionally, the control node can perform canary upgrades on service processes in multiple service groups, using service groups as the upgrade granularity. This includes: using physical machines as upgrade targets and service groups as the upgrade granularity to perform canary upgrades on service processes belonging to different service groups on the same physical machine; or using service groups as upgrade targets and service groups as the upgrade granularity to perform canary upgrades on service processes in different service groups, and synchronously upgrade service processes deployed on different physical machines in the same service group.
[0078] If the physical machine is the target of the upgrade, the physical resources of service processes in different service groups on the same physical machine are isolated from each other. In other words, service processes in different service groups do not affect each other. Therefore, a canary upgrade can be performed on service processes belonging to different service groups on the same physical machine at the service group level. This improves upgrade efficiency and avoids the resource waste and risks associated with a full upgrade. The different service groups can be at least some of the service groups on the physical machine.
[0079] If service groups are used as the upgrade targets, the physical resources of service processes in different service groups are isolated from each other. This allows for canary upgrades of service groups in different service groups, and service processes deployed on different physical machines in the same service group can be upgraded synchronously. This helps improve upgrade efficiency and avoids the waste of resources and risks caused by full upgrades.
[0080] This disclosure also provides a data processing system, comprising: a management node, multiple physical machines, and multiple service groups. Multiple service groups are distributed across the multiple physical machines, and each service group includes multiple service threads. The number of service threads in different service groups can be the same or different, and this is not limited. Multiple service threads within the same service group are deployed on different physical machines, and at least two service threads from different service groups are deployed on the same physical machine. Service threads belonging to different service groups on the same physical machine are deployed in the same shared process. The management node is used to monitor and manage the service threads of each service group on the multiple physical machines.
[0081] Figure 3 shows a schematic diagram of one structure of the data processing system described in this embodiment. The data processing system 300 shown in Figure 3 includes physical machines h1-h5, service groups E1-E5, and a control node G1, but is not limited to this. Taking service group E1 as an example, the main thread E11 of service group E1 is deployed on physical machine h1, where the main thread refers to the thread currently providing services; other service threads of service group E1, such as service threads E12-E15, are deployed on physical machines h2-h5 respectively. Service threads of different service groups are also deployed on physical machine h1, such as service threads E21, E31, E41, and E51, and these service threads of different service groups are deployed in the same shared process, such as shared process D6. For other service groups such as service groups E2-E5, please refer to the relevant description of service group E1.
[0082] In this embodiment, multiple service threads within the same service group execute a leader election process to elect a master service thread, which can be simply referred to as the master thread. The master thread is used to respond to service requests from clients and synchronize service requests with other service threads in its service group to maintain data consistency with other service threads. Here, other service threads refer to service threads within the same service group other than the current master thread.
[0083] In some optional embodiments, a distributed consensus algorithm can be used among multiple service threads to maintain data consistency. Specifically, the elected master thread is responsible for responding to client service requests and copying the logs corresponding to those requests to other service threads within the same service group. When a predetermined number of service threads in the same service group have copied the logs corresponding to the client's service request, they submit those logs to update the master thread's state. Correspondingly, other service threads receive the logs corresponding to client service requests from the master thread; and, upon receiving a log submission request from the master thread, submit the logs corresponding to the client's service request to maintain data consistency with the master thread.
[0084] In this embodiment, service threads from at least two service groups are deployed on the same physical machine. Here, "at least two service groups" refers to at least a subset of service groups among multiple service groups.
[0085] In this embodiment, when the control node detects at least two main threads on the same physical machine, it triggers a master thread switching process to switch the at least two main threads to at least two physical machines.
[0086] In this embodiment, multiple service threads of the same service group are deployed on different physical machines, and service threads of different service groups are deployed on the same physical machine. This makes the number of service instances on different physical machines more even, thereby fully utilizing the resources of existing machines and improving resource utilization. Furthermore, when the presence of main threads of different service groups on the same physical machine is detected, a master thread switching process is executed to switch the main threads of different service groups to different physical machines, balancing the resource consumption levels of the main threads and other service threads of each service group, and achieving load balancing among physical machines. In addition, service threads belonging to different service groups on the same physical machine are deployed in the same shared process, and service threads of different service groups share the same process space, reducing the resource overhead of process creation.
[0087] Optionally, the number of service groups is less than or equal to the number of physical machines, so that the main processes in different service groups can be deployed on different physical machines, so that the number of main processes on different physical machines is kept within a reasonable range, the resource consumption level of different physical machines tends to be averaged, and the resource utilization of the entire system is improved.
[0088] When the number of service groups equals the number of physical machines, the main thread of each service group can be deployed on different physical machines, ensuring that one main thread runs on each physical machine. This provides sufficient resources for the main thread of each service group, maintaining its stable and efficient operation. Optionally, all service threads from all service groups can be deployed on the same physical machine to achieve load balancing among the physical machines.
[0089] As shown in Figure 3, the main threads of service groups E2-E5, such as main thread E22, main thread E23, main thread E24, and main thread E25, are deployed on physical machines h2, h3, h4, and h5, respectively. Additionally, the other service threads of each service group from E2 to E5, such as (service thread E22-E25), (service thread E32-E35), (service thread E42-E45), and (service thread E52-E55), are deployed on physical machines h2-h5, respectively.
[0090] Specifically, each physical machine from h2 to h5 has service threads in different service groups deployed on it. For example, physical machine h2 has service threads E12, E32, E42, and E52 deployed on it. These service threads in different service groups are deployed in the shared process D7. Physical machine h3 has service threads E13, E23, E43, and E53 deployed on it. These service threads are deployed in the shared process D8. Physical machine h4 has service threads E14, E24, E34, and E54 deployed on it. These service threads are deployed in the shared process D9. Physical machine h5 has service threads E15, E25, E35, and E45 deployed on it. These service threads are deployed in the shared process D10.
[0091] In one optional embodiment, when the control node detects at least two main threads on the same physical machine, it determines the target service group from at least two service groups to which the main threads belong, where the target service group refers to the service group executing the main thread switching process. From the other service threads in the target service group, a target thread is selected, which is the new main thread specified by the control node. This triggers the current main thread and other service threads in the target service group to reselect the target thread as the main thread.
[0092] Further optionally, when the control node determines the target service group from the at least two service groups to which the main threads belong, the process includes: determining the target service group from the at least two service groups to which the main threads belong, based on the identification information, priority, number of service threads contained in the at least two service groups, and / or information on main thread switching that has occurred within a specified time period.
[0093] In this embodiment, the target service group is determined based on different information dimensions of the service group. The information dimensions of the service group include at least one of the following: the service group's identification information, priority, the number of service threads it contains, and / or information on main thread switching that has occurred within a specified time period. For a detailed description of the information dimensions of the service group, please refer to the content in the above embodiments. It will not be repeated here.
[0094] In this embodiment, the target service group is determined according to the number of service threads it contains. For example, a service group with fewer service threads can be selected as the target service group to execute the main thread switching process. Since the number of service threads is relatively small, the process of re-electing a new main thread can be relatively fast. Alternatively, a service group with more service threads can be selected as the target service group to execute the main thread switching process. Since the number of service threads is relatively large, more possibilities are provided for the selection of a new main thread, and a service thread with better performance can be selected as the new main thread.
[0095] In this embodiment, the information regarding the main thread switching that has occurred within a specified time period includes the number of main thread switching events and the switching time. The number of main thread switching events refers to the number of times the main thread has switched within the specified time period; the switching time refers to the time of the most recent main thread switching within the specified time period. For example, based on the number of main thread switching events, service groups with fewer events can be selected as the target service groups for the main thread switching process. Alternatively, based on the switching time, service groups with earlier switching times can be selected as the target service groups for the main thread switching process, thus reducing the probability of service performance degradation caused by main thread switching.
[0096] In one optional embodiment, when selecting a target service group, various information can also be considered, including the service group's identification information, priority, number of service threads it contains, and / or information on main thread switching that has occurred within a specified time period. For example, a target service group can be selected simultaneously based on both the service group's identification information and the number of service threads it contains. Specifically, first, compare whether the number of service threads contained in two service groups is the same; if the two service groups contain the same number of service threads, the larger or smaller service group can be selected as the target service group based on the size of its identification information. As another example, a target service group can be selected simultaneously based on the service group's identification information, the number of service threads it contains, and information on main thread switching that has occurred within a specified time period. Specifically, first, compare whether the number of service threads contained in two service groups is the same; if the two service groups contain the same number of service threads, compare whether the number of main thread switching events that have occurred within the specified time period is the same; if the number of main thread switching events that have occurred within the specified time period is the same, the larger or smaller service group can be selected as the target service group based on the size of its identification information.
[0097] Further optionally, when the control node selects a target thread from other service threads in the target service group, it includes: selecting the target thread from other service threads in the target service group based on the status information of other service threads in the target service group, the load information of the physical machine where it resides, and / or the status information of the physical machine where it resides.
[0098] In this embodiment, the service thread's status information describes the service thread's running state, including but not limited to resource usage and I / O efficiency. The load information of the physical machine where the service thread resides reflects the current load pressure on the physical machine, including but not limited to resource usage and the number of service threads deployed on the physical machine. The physical machine's status information includes hardware status, software status, and historical failure rate.
[0099] In this embodiment, "other service threads" refers to service threads in the target service group other than the current main thread. These other service threads may reside on one or more physical machines, depending on both the number of service threads in the target service group and the number of physical machines in the data processing system. If multiple other service threads in the target service group are deployed on the same physical machine, then the load and status information of these other service threads on the physical machines are identical.
[0100] Furthermore, based on the status information of each service thread in the other service threads, the load information of the physical machine they reside on, and / or the status information of the physical machine itself, a target thread is selected from the other service threads in the target service group. For example, if there is a service thread with good resource utilization and high I / O efficiency among the other service threads, it can be selected as the target service thread, which helps improve service efficiency. Similarly, if the load information of the physical machine where the other service threads reside reflects low load pressure, other service threads on that physical machine can be selected as target service threads, which helps ensure service quality and improve service efficiency. Furthermore, if the status information of the other service threads reflects good health and a low historical failure rate of the physical machine, other service threads on that physical machine can be selected as target service threads, reducing the probability of target service process failure and ensuring service quality. For another example, a quality score can be obtained by weighted summation of the status information of the other service threads, the load information of the physical machine they reside on, and the status information of the physical machine itself. The target service thread can then be selected from the other service threads based on this quality score, allowing for the selection of service threads with higher overall service quality.
[0101] In an optional embodiment, for any physical machine, second configuration information is received. This second configuration information includes a number of threads indicating the creation of at least two service threads and shared resource description information, which describes the physical resources required to create the shared process. Then, the physical machine creates the shared process and at least two service threads for that shared process based on the number of threads, and allocates physical resources to the shared process according to the shared resource description information. The physical resources on the physical machine can be divided into memory resources and non-memory resources. Optionally, memory resources may include the physical machine's main memory and secondary storage. Main memory is used to store running programs and data, while secondary storage is the physical machine's external storage device, which can be used to store programs and data that are not currently in use. The programs can be implemented as service processes or shared processes in this embodiment. Correspondingly, non-memory resources refer to the physical resources of the physical machine other than memory resources, including but not limited to processor resources and network resources.
[0102] Optionally, when allocating physical resources to the shared process based on the shared resource description information, the process includes: binding a preset processor resource to any service thread in the shared process, allocating an independent memory partition for the service thread from the memory resources of the shared process, and allocating a corresponding service port for the service thread. Based on the service port, the service thread can communicate with service threads on other physical machines to maintain the data consistency of the service group to which it belongs.
[0103] In this embodiment, the memory resources of the shared process include memory partitions for each of at least two service threads, and at least two service threads share non-memory resources, such as the processor resources and service ports of the shared process. Since the service threads within the shared process share non-memory resources, upgrades are performed at the shared process level when upgrading service threads. Using the shared process as the upgrade granularity means that the shared process is used as the upgrade unit, and the goal of the upgrade is to upgrade the service threads within the shared process. If other service threads belonging to the same service group exist on other physical machines, synchronous upgrades or asynchronous upgrades can be performed; this is not limited. The upgrade process of the shared process is described in detail below.
[0104] In one optional embodiment, service threads belonging to different service groups on the same physical machine are synchronously upgraded at the shared process level. Since service threads of different service groups within a shared process share resources other than memory, upgrading the service threads of any service group can upgrade the entire shared process, that is, synchronously upgrading the service threads of that service group and other service groups, ultimately achieving the goal of upgrading the service process of that service group.
[0105] Optionally, when the control node, in response to the second service upgrade command, synchronously upgrades service threads belonging to different service groups on the same physical machine with shared processes as the upgrade granularity, the process includes: synchronously upgrading service threads belonging to different service groups on the same physical machine with shared processes as the upgrade granularity, and synchronously upgrading service threads within the same service group deployed on different physical machines. Specifically, in the case of synchronously upgrading service threads within the same service group deployed on different physical machines, the synchronous upgrade process for service threads on different physical machines is similar to the process described above for synchronously upgrading service threads belonging to different service groups on the same physical machine, and can be referred to the above embodiments.
[0106] In this embodiment of the disclosure, a data processing method is also provided. This method is implemented based on the following system architecture, which includes: multiple service groups distributed across multiple physical machines, each service group comprising multiple service instances; wherein multiple service instances within the same service group are deployed on different physical machines, and at least two service instances from the same service group are deployed on the same physical machine. As shown in Figure 4, the method includes:
[0107] S401: Monitor the number of primary instances on the same physical machine; the primary instance is elected by multiple service instances in the same service group through a primary election process. The primary instance is used to respond to the client's service request and synchronize the service request with other service instances in its service group to maintain data consistency with other service instances.
[0108] S402: If at least two primary instances are detected on the same physical machine, trigger the primary switching process to switch the at least two primary instances to at least two physical machines.
[0109] In one optional embodiment, when at least two primary instances are detected on the same physical machine, triggering a primary switching process to switch the at least two primary instances to at least two physical machines includes: when at least two primary instances are detected on the same physical machine, determining the target service group to which the primary instance needs to be switched from the at least two service groups to which the at least two primary instances belong, selecting a target instance from other service instances in the target service group, and triggering the current primary instance and other service instances in the target service group to reselect the target instance as the primary instance.
[0110] In one optional embodiment, when determining the target service group from at least two service groups to which at least two primary instances belong, the method includes: determining the target service group from at least two service groups to which the primary instances belong, based on the identification information, priority, number of service instances contained in the at least two service groups, and / or information on primary instance switching that has occurred within a specified time period.
[0111] In an optional embodiment, selecting a target instance from other service instances in the target service group includes: selecting a target instance from other service instances in the target service group based on the status information of other service instances in the target service group, the load information of the physical machine where the instance is located, and / or the status information of the physical machine where the instance is located.
[0112] In an optional embodiment, the service instance is implemented as a service process, and the service processes belonging to different service groups on the same physical machine are resource-isolated. The method further includes: receiving first configuration information, the first configuration information including a number of groups indicating the creation of at least two service groups and at least two resource description information corresponding to the number of groups; creating at least two service groups according to the number of groups and creating service processes for at least two service groups respectively; and allocating mutually isolated physical resources to the service processes in the at least two service groups according to the at least two resource description information.
[0113] In an optional embodiment, the service instance is implemented as a service thread, and service threads belonging to different service groups on the same physical machine are deployed in the same shared process. The method further includes: receiving second configuration information, the second configuration information including the number of threads indicating the creation of at least two service threads and shared resource description information; creating a shared process according to the number of threads and creating at least two service threads for the shared process; and allocating physical resources to the shared process according to the shared resource description information, the physical resources including memory resources and non-memory resources, the memory resources including the memory partitions of each of the at least two service threads, and the at least two service threads sharing non-memory resources.
[0114] In an optional embodiment, the method further includes: in response to a first service upgrade instruction, performing a canary upgrade of service processes in multiple service groups, with service groups as the upgrade granularity.
[0115] In one optional embodiment, the service processes in multiple service groups are upgraded in a canary manner, with service groups as the upgrade granularity. This includes: using physical machines as the upgrade target and service groups as the upgrade granularity, performing canary upgrades on service processes belonging to different service groups on the same physical machine; or, using service groups as the upgrade target and service groups as the upgrade granularity, performing canary upgrades on service processes in different service groups, and synchronously upgrading service processes deployed on different physical machines in the same service group.
[0116] In an optional embodiment, the method further includes: in response to a second service upgrade instruction, synchronously upgrading service threads belonging to different service groups on the same physical machine, with the shared process as the upgrade granularity.
[0117] In an optional embodiment, when synchronizing the service threads belonging to different service groups on the same physical machine with shared processes as the upgrade granularity in response to the second service upgrade instruction, the process includes: synchronizing the service threads belonging to different service groups on the same physical machine with shared processes as the upgrade granularity in response to the second service upgrade instruction, and synchronizing the service threads deployed on different physical machines within the same service group.
[0118] The detailed implementation methods and beneficial effects of each step in this embodiment have been described in detail in the foregoing embodiments, and will not be elaborated here.
[0119] It should be noted that the execution subject of each step of the method provided in the above embodiments can be the same device, or the method can be executed by different devices. For example, the execution subject of steps 401 to 402 can be device A; or the execution subject of step 401 can be device A, and the execution subject of step 402 can be device B; and so on.
[0120] Furthermore, in some of the processes described in the above embodiments and accompanying drawings, multiple operations appear in a specific order. However, it should be clearly understood that these operations may not be executed in the order they appear herein, or they may be executed in parallel. The operation numbers, such as 401, 402, etc., are merely used to distinguish different operations and do not represent any execution order. Additionally, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel. It should be noted that the descriptions such as "first" and "second" in this document are used to distinguish different messages, devices, modules, etc., and do not represent a sequential order, nor do they limit "first" and "second" to different types.
[0121] Figure 5 is a schematic diagram of the structure of an electronic device provided in another exemplary embodiment of this disclosure. As shown in Figure 5, the electronic device includes a memory 54 and a processor 55.
[0122] Memory 54 is used to store computer programs and can be configured to store various other data to support operation on the electronic device. Examples of this data include instructions for any application or method operating on the computing platform, data structures, contact data, phone book data, messages, pictures, videos, etc.
[0123] The processor 55, coupled to the memory 54, is used to execute a computer program in the memory 54 for: monitoring the number of primary instances on the same physical machine; the primary instance is elected by a primary election process among multiple service instances in the same service group, and the primary instance is used to respond to service requests from clients and synchronize service requests with other service instances in its service group to maintain data consistency with other service instances; and, if at least two primary instances are detected on the same physical machine, triggering a primary switching process to switch the at least two primary instances to at least two physical machines.
[0124] In an optional embodiment, when the processor 55 detects at least two primary instances on the same physical machine and triggers a primary switching process to switch the at least two primary instances to at least two physical machines, it specifically performs the following: when at least two primary instances are detected on the same physical machine, it determines the target service group to which the primary instance needs to be switched from the at least two service groups to which the at least two primary instances belong, selects the target instance from other service instances in the target service group, and triggers the current primary instance and other service instances in the target service group to reselect the target instance as the primary instance.
[0125] In an optional embodiment, when the processor 55 determines the target service group from at least two service groups to which at least two primary instances belong, it is specifically configured to: determine the target service group from at least two service groups to which the primary instances belong, based on the identification information, priority, number of service instances contained in the at least two service groups, and / or information on primary instance switching that has occurred within a specified time period.
[0126] In an optional embodiment, when the processor 55 selects a target instance from other service instances in the target service group, it is specifically configured to: select from other service instances in the target service group based on the status information of other service instances in the target service group, the load information of the physical machine where the instance is located, and / or the status information of the physical machine where the instance is located.
[0127] In an optional embodiment, the service instance is implemented as a service process, and the service processes belonging to different service groups on the same physical machine are resource-isolated. The processor 55 is further configured to: receive first configuration information, the first configuration information including a number of groups indicating the creation of at least two service groups and at least two resource description information corresponding to the number of groups; create at least two service groups according to the number of groups and create service processes for at least two service groups respectively; and allocate mutually isolated physical resources to the service processes in at least two service groups according to the at least two resource description information.
[0128] In an optional embodiment, the service instance is implemented as a service thread, and service threads belonging to different service groups on the same physical machine are deployed in the same shared process. The processor 55 is further configured to: receive second configuration information, the second configuration information including the number of threads indicating the creation of at least two service threads and shared resource description information; create a shared process according to the number of threads and create at least two service threads for the shared process; and allocate physical resources to the shared process according to the shared resource description information, the physical resources including memory resources and non-memory resources, the memory resources including the memory partitions of each of the at least two service threads, and the at least two service threads sharing non-memory resources.
[0129] In an optional embodiment, the processor 55 is further configured to: in response to a first service upgrade instruction, perform a canary upgrade of service processes in multiple service groups, with service groups as the upgrade granularity.
[0130] In an optional embodiment, when the processor 55 performs a canary upgrade of service processes in multiple service groups with service groups as the upgrade granularity, it is specifically used to: take the physical machine as the upgrade object, and perform a canary upgrade of service processes belonging to different service groups on the same physical machine with service groups as the upgrade granularity; or, take the service group as the upgrade object, and perform a canary upgrade of service processes in different service groups with service groups as the upgrade granularity, and perform synchronous upgrade of service processes deployed on different physical machines in the same service group.
[0131] In an optional embodiment, the processor 55 is further configured to: in response to a second service upgrade instruction, synchronously upgrade service threads belonging to different service groups on the same physical machine, with the shared process as the upgrade granularity.
[0132] In an optional embodiment, when the processor 55 performs synchronous upgrades on service threads belonging to different service groups on the same physical machine with shared processes as the upgrade granularity in response to the second service upgrade instruction, it is specifically used to: perform synchronous upgrades on service threads belonging to different service groups on the same physical machine with shared processes as the upgrade granularity in response to the second service upgrade instruction, and perform synchronous upgrades on service threads deployed on different physical machines in the same service group.
[0133] Furthermore, as shown in Figure 5, the electronic device also includes other components such as a communication component 56, a display 57, a power supply component 58, and an audio component 59. Figure 5 only schematically shows some components and does not imply that the electronic device only includes the components shown in Figure 5. Additionally, the components within the dashed boxes in Figure 5 are optional, not mandatory, and their specific inclusion depends on the product form of the electronic device. The electronic device of this embodiment can be implemented as a terminal device such as a desktop computer, laptop computer, smartphone, or IoT device, or as a server-side device such as a conventional server, cloud server, or server array. If the electronic device of this embodiment is implemented as a terminal device such as a desktop computer, laptop computer, or smartphone, it may include the components within the dashed boxes in Figure 5; if the electronic device of this embodiment is implemented as a server-side device such as a conventional server, cloud server, or server array, it may not include the components within the dashed boxes in Figure 5.
[0134] The aforementioned memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0135] The aforementioned communication component is configured to facilitate wired or wireless communication between the device containing the communication component and other devices. The device containing the communication component can access wireless networks based on communication standards, such as 2G, 3G, 4G / LTE, 5G, or combinations thereof. In one exemplary embodiment, the communication component receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel.
[0136] The aforementioned display includes a screen, which may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a Touch Panel, the screen can be implemented as a touchscreen to receive input signals from the user. The Touch Panel includes one or more touch sensors to sense touches, swipes, and gestures on the Touch Panel. The touch sensors can sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation.
[0137] The aforementioned power supply components provide power to various components within the device in which they reside. These power supply components may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device in which they reside.
[0138] The aforementioned audio component can be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC) configured to receive external audio signals when the device containing the audio component is in an operating mode, such as call mode, recording mode, or voice recognition mode. The received audio signals can be further stored in memory or transmitted via a communication component. In some embodiments, the audio component also includes a speaker for outputting audio signals.
[0139] Accordingly, this disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to implement the steps in the above-described method embodiments. The computer-readable storage medium includes volatile or non-volatile or a combination thereof, and may be removable or non-removable. Examples of computer-readable storage media include, but are not limited to, phase-change random access memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random-access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), flash memory or other memory technologies, CD-ROM, Digital Video Disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium.
[0140] Accordingly, this disclosure also provides a computer program product, which includes a computer program or instructions that, when executed by a processor, cause the processor to implement the steps in the above-described method embodiments. It should be understood that each step or combination of steps in the above-described method flow can be implemented by the computer program or instructions. Furthermore, these computer programs or instructions can be applied to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device, enabling the processor of the general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to function as an apparatus for implementing the corresponding functions in the above-described method embodiments.
[0141] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0142] The above are merely embodiments of this disclosure and are not intended to limit the scope of this disclosure. Various modifications and variations can be made to this disclosure by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the scope of the claims of this disclosure.
Claims
1. A data processing system, comprising: The system includes a control node and multiple service groups distributed across multiple physical machines. Each service group includes multiple service instances. The service instances within the same service group are deployed on different physical machines, and at least two service instances from the same service group are deployed on the same physical machine. In this process, multiple service instances in the same service group perform a master election process to elect a master instance. The master instance is used to respond to the client's service request and synchronize the service request to other service instances in its service group to maintain data consistency with other service instances. The control node is used to trigger a master switch process when at least two master instances are detected on the same physical machine, so as to switch the at least two master instances to at least two physical machines.
2. The system according to claim 1, wherein the control node is specifically used for: If at least two primary instances are detected on the same physical machine, the target service group to which the primary instance needs to be switched is determined from the at least two service groups to which the at least two primary instances belong. The target instance is selected from the other service instances in the target service group, and the current primary instance and other service instances in the target service group are triggered to reselect the target instance as the primary instance.
3. In the system according to claim 1, the service instance is implemented as a service process, and service processes belonging to different service groups on the same physical machine are isolated from each other.
4. The system according to claim 3, wherein the physical machine is configured to receive first configuration information, the first configuration information including a number of groups indicating the creation of at least two service groups and at least two resource description information corresponding to the number of groups; to create at least two service groups according to the number of groups and to create service processes for the at least two service groups respectively; and to allocate mutually isolated physical resources for the service processes in the at least two service groups according to the at least two resource description information.
5. In the system according to claim 1, the service instance is implemented as a service thread, and service threads belonging to different service groups on the same physical machine are deployed in the same shared process.
6. The system according to claim 5, wherein the physical machine is configured to receive second configuration information, the second configuration information including a number of threads indicating the creation of at least two service threads and shared resource description information; to create a shared process according to the number of threads and to create at least two service threads for the shared process; and to allocate physical resources for the shared process according to the shared resource description information, the physical resources including memory resources and non-memory resources, the memory resources including memory partitions for each of the at least two service threads, and the at least two service threads sharing the non-memory resources.
7. The system according to any one of claims 1-6, wherein the service instance is further configured to: send a registration request to the management node after startup to register with the management node, the registration request including the identification information of the service instance and the identification information of the service group to which the service instance belongs; The control node is also used to: record the identification information of the service instance and the identification information of the service group to which the service instance belongs, based on the registration request.
8. The system according to any one of claims 1-7, wherein the number of service groups is less than or equal to the number of physical machines, and the primary instances in the at least two service groups are distributed on different physical machines.
9. The system according to any one of claims 1-8, wherein the data processing system is a metadata storage system, the metadata storage system comprising multiple data partitions, and service instances in different service groups are responsible for providing metadata services for different data partitions.
10. A data processing method, wherein multiple service groups are deployed distributed across multiple physical machines, and each service group includes multiple service instances; wherein, Multiple service instances within the same service group are deployed on different physical machines, with at least two service instances from the same service group deployed on the same physical machine; the method includes: Monitor the number of primary instances on the same physical machine; the primary instance is elected by multiple service instances in the same service group through a primary election process, and the primary instance is used to respond to the service requests of the client and synchronize the service requests with other service instances in its service group to maintain data consistency with other service instances; and, if at least two primary instances are detected on the same physical machine, trigger a primary switching process to switch the at least two primary instances to at least two physical machines.
11. The method according to claim 10, wherein when at least two primary instances are detected on the same physical machine, a primary switching process is triggered to switch the at least two primary instances to at least two physical machines, comprising: If at least two primary instances are detected on the same physical machine, the target service group to which the primary instance needs to be switched is determined from the at least two service groups to which the at least two primary instances belong. The target instance is selected from the other service instances in the target service group, and the current primary instance and other service instances in the target service group are triggered to reselect the target instance as the primary instance.
12. The method of claim 11, wherein determining the target service group from at least two service groups to which the at least two primary instances belong, comprising: Based on the identification information, priority, number of service instances contained in, and / or information on primary instance switching that has occurred within a specified time period of the at least two service groups to which the at least two primary instances belong, determine the target service group from the at least two service groups that needs to switch primary instances.
13. The method of claim 12, wherein selecting a target instance from other service instances in the target service group comprises: The target instance is selected from the other service instances in the target service group based on the status information of other service instances in the target service group, the load information of the physical machine where it is located, and / or the status information of the physical machine where it is located.
14. The method according to any one of claims 10-13, wherein the service instance is implemented as a service process, and service processes belonging to different service groups on the same physical machine are resource-isolated, the method further comprising: Receive first configuration information, the first configuration information including a number of groups indicating the creation of at least two service groups and at least two resource description information corresponding to the number of groups; Create at least two service groups based on the number of groups, and create service processes for each of the at least two service groups; Based on the at least two resource descriptions, mutually isolated physical resources are allocated to the service processes in the at least two service groups.
15. The method of claim 14, further comprising: In response to the first service upgrade instruction, the service processes in the multiple service groups are upgraded in a gray-scale manner, with the service group as the upgrade granularity.
16. The method according to claim 15, wherein the service processes in the plurality of service groups are subjected to canary upgrades at the service group level, comprising: The physical machine is used as the upgrade target, and the service group is used as the upgrade granularity. The service processes belonging to different service groups on the same physical machine are upgraded in a gray-scale manner. or The service group is used as the upgrade target and the service group is used as the upgrade granularity. The service processes in different service groups are upgraded in a gray-scale manner, and the service processes in the same service group deployed on different physical machines are upgraded synchronously.
17. The method according to any one of claims 10-13, wherein the service instance is implemented as a service thread, and service threads belonging to different service groups on the same physical machine are deployed in the same shared process, the method further comprising: Receive second configuration information, which includes the number of threads indicating the creation of at least two service threads and shared resource description information; A shared process is created based on the number of threads, and at least two service threads are created for the shared process. Physical resources are allocated to the shared process based on the shared resource description information. The physical resources include memory resources and non-memory resources. The memory resources include the memory partitions of the at least two service threads, and the at least two service threads share the non-memory resources.
18. The method of claim 17, further comprising: In response to the second service upgrade command, service threads belonging to different service groups on the same physical machine are synchronously upgraded, with the shared process as the upgrade granularity.
19. An electronic device comprising: A memory and a processor, the memory for storing a computer program, the processor coupled to the memory for executing the computer program to implement the steps of the method according to any one of claims 10-17.
20. A computer-readable storage medium storing a computer program / instructions, which, when executed by a processor, cause the processor to perform the steps of the method according to any one of claims 10-17.
21. A computer program product, comprising: A computer program / instruction that, when executed by a processor, causes the processor to perform the steps of the method according to any one of claims 10-17.
