Distributed e-commerce order processing method based on GRAFT-EWMA consensus algorithm

By introducing the GRAFT-EWMA consensus algorithm in the distributed e-commerce order processing system, combining the strategies of grouping nodes and external supervision nodes, the problem of difficult performance and security in the existing technology is solved, and lower consensus delays and Higher throughput.

CN119402238AActive Publication Date: 2025-02-07YANGZHOU UNIV
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411484050.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-23
Publication Date
2025-02-07
Estimated Expiration
2044-10-23

AI Technical Summary

Technical Problem

The existing consensus algorithms are difficult to take into account performance and security when facing Byzantine failure and high concurrent order processing scenarios, resulting in instability in system performance and increased response latency.

Method used

A distributed e-commerce order processing method based on GRAFT-EWMA consensus algorithm is proposed. By grouping nodes, dynamically adjusting node weights, introducing external supervision nodes and multi-level supervision strategies, the consensus process and data consistency are optimized.

Benefits of technology

Significantly reduce consensus latency, improve throughput, and enhance system robustness and anti-Byzantine fault tolerance, ensuring efficient consensus processes and data consistency in high concurrency environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119402238A_ABST
    Figure CN119402238A_ABST
Patent Text Reader

Abstract

The invention discloses a distributed e-commerce order processing method based on a GRAFT-EWMA consensus algorithm, and the method comprises the steps: defining a data consistency demand of an e-commerce order processing system in a high-concurrency environment, and defining a performance index of the system in combination with a business scene; dividing the nodes participating in the consensus into a plurality of groups, determining the number of the nodes in each group, and counting the initial weight of each node; the performance and stability of the nodes are monitored; the weights of the nodes are adjusted in real time, and normalization processing is carried out on the different weights; nodes participating in the consensus are grouped, and a main node and a leader node are assigned to optimize a consensus process; external supervision nodes are introduced, and a multi-level supervision strategy is adopted to monitor all participating nodes in real time; performance of the e-commerce order processing system is evaluated regularly to ensure that an efficient consensus process and data consistency are maintained in a dynamically changing environment. According to the invention, the security and efficiency in a large-scale distributed e-commerce system are improved, and the method is especially suitable for a high-power generation merchant environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of distributed systems, and in particular to a distributed e-commerce order processing method based on the GRAFT-EWMA consensus algorithm. Background Art

[0002] With the rapid development of distributed e-commerce, ensuring that multiple nodes can process orders efficiently and reliably under decentralized control has become an important challenge. In this context, consensus algorithms, as an important mechanism to achieve system consistency, have received increasing attention. The current mainstream consensus algorithms include Raft and PBFT (Practical Byzantine Fault Tolerance). The Raft algorithm is widely used in small-scale e-commerce order processing systems due to its high efficiency and simplicity, especially in terms of low latency and high throughput. However, Raft lacks fault tolerance in the face of Byzantine faults and cannot effectively resist attacks from malicious nodes, thus affecting the overall security of the system. In contrast, the PBFT algorithm can tolerate the existence of Byzantine nodes to ensure the security of the system, but it has high communication overhead and latency, especially when the number of nodes increases, the system performance will drop sharply. In the e-commerce environment, this performance degradation may lead to delays in order processing and affect user experience. In order to balance performance and security in distributed e-commerce order processing systems, hybrid consensus algorithms have gradually attracted attention. By combining the advantages of Raft and PBFT, these algorithms can improve the performance of the system while ensuring a certain level of Byzantine fault tolerance. However, existing hybrid consensus algorithms show limitations when faced with dynamic network conditions and have difficulty flexibly adapting to network fluctuations, resulting in unstable performance, especially in high-concurrency order processing scenarios.

[0003] As the number of nodes and order requests increase, the consensus delay of traditional algorithms (such as Raft and PBFT) increases significantly, affecting the response speed and processing efficiency of the system. In addition, many algorithms also face challenges in maintaining stability and consistency in the face of malicious nodes or network failures. In order to solve these problems, this technical solution proposes a distributed e-commerce order processing system based on the GRAFT-EWMA algorithm. This solution evaluates the performance of the algorithm in terms of consensus delay, throughput and anti-Byzantine fault tolerance in e-commerce order processing by testing the performance under different network conditions, number of nodes and load intensity. Preliminary results show that in a network of 60 nodes, the consensus delay of this method is about 200ms, which is 60% lower than Raft, and the throughput is increased by 30%, which shows the effectiveness of the algorithm in improving the efficiency of distributed e-commerce order processing systems, and can provide faster consensus speed and higher throughput when the number of nodes and order requests increase. Summary of the invention

[0004] Purpose of the invention: The present invention provides a distributed e-commerce order processing method based on the GRAFT-EWMA consensus algorithm, aiming to improve the consistency management efficiency of the distributed e-commerce order processing system, reduce transaction processing delays, and enhance the robustness and anti-Byzantine fault tolerance of the system.

[0005] Technical solution: The distributed e-commerce order processing method based on the GRAFT-EWMA consensus algorithm described in the present invention specifically includes the following steps:

[0006] (1) Clarify the data consistency requirements of e-commerce order processing in a high-concurrency environment and define the performance indicators of the e-commerce order processing system based on business scenarios;

[0007] (2) Divide the nodes participating in the consensus into several groups, determine the number of nodes in each group, and calculate the initial weight of each node for weight analysis and adjustment;

[0008] (3) Monitor the performance and stability of nodes, evaluate the reliability of nodes through set measurement values, and provide data support for subsequent node weight adjustments;

[0009] (4) Adjust the node weights in real time based on the node’s stability and performance, and normalize different weights to ensure fairness;

[0010] (5) Group the nodes participating in the consensus and assign master nodes and leader nodes to each group to optimize the consensus process;

[0011] (6) Introduce external supervision nodes and adopt multi-level supervision strategies to monitor all participating nodes in real time to ensure the transparency and security of the consensus process;

[0012] (7) Regularly evaluate the performance of the e-commerce order processing system and implement necessary optimization measures to ensure efficient consensus process and data consistency in a dynamically changing environment.

[0013] Furthermore, the performance indicators of the distributed e-commerce order processing system in step (1) include response time, throughput, and fault tolerance.

[0014] Furthermore, in step (2), the nodes participating in the consensus are divided into several groups, and the number of nodes in each group is determined as follows:

[0015] The number of groups required for PBFT consensus should be no less than four to provide sufficient redundant nodes to tolerate potential errors in the system; the number of Raft consensus nodes in each group should be no less than three to meet the requirements of the majority principle in the consensus process and ensure the normal operation of the system.

[0016] Furthermore, the implementation process of counting the initial weight of each node in step (2) is as follows:

[0017] Initialize the weight W0 for each node and periodically collect the performance data X of each node t ; The performance of the node is smoothed by using the exponentially weighted moving average EWMA to calculate the weight of the node; the calculation process of EWMA is as follows:

[0018] W t =αX t +(1-α)W t-1

[0019] Among them, W t is the weight of the node, X t is the observed value at time t, α is the smoothing coefficient, W t-1 is the weight value at the previous moment; at each time interval, the system collects the latest performance data of each node, calculates the node's weight, and updates the node's importance in the network;

[0020] Preprocess the initial node weight data, including removing invalid node data and adjusting the weight ratio of node groups to ensure that each group has a reasonable load distribution during the consensus process, optimize the overall performance of the system and improve consensus efficiency.

[0021] Furthermore, the implementation process of step (3) is as follows:

[0022] Update weights to ensure that changes in nodes are responded to in a timely manner and maintain the stability and consistency of the system in a dynamic environment:

[0023] W t =W t-1 +α(X t -W t-1 );

[0024] The variance of node performance is calculated periodically using the following formula:

[0025]

[0026] in, is the variance of node performance, λ is the smoothing factor, and μ is the average value of node performance data;

[0027] After calculating the node variance, the upper control limit UCL and the lower control limit LCL of the control chart are calculated by the following formula to determine the threshold:

[0028]

[0029]

[0030] Among them, L is the control limit parameter, and its value is 3. The actual measurement value is compared with the set threshold. If the measurement value of a node exceeds the threshold, the system will identify the node as a node with large performance fluctuations. Then, the workload of the node with large performance fluctuations will be adjusted to reduce its impact on the overall performance of the system, and it will be reallocated to other groups to reduce the impact on a single group.

[0031] Furthermore, the implementation process of step (4) is as follows:

[0032] If there is more than one node measurement value, use the following formula to calculate the EWMA value W for each performance measurement value t,j :

[0033] W t,j =α·X t,j +(1-α)·W t-1,j

[0034] Among them, j represents the measured value of the jth performance at time t; combining different types of performance indicators, the EWMA values ​​of each performance are normalized using the following formula:

[0035]

[0036] Each performance measure is assigned a weight γ by the following formula j , so that nodes with smaller variance and more stable performance receive higher weights:

[0037]

[0038] Use the following formula to combine the normalized EWMA values ​​to get the comprehensive weight W of each node: t :

[0039]

[0040] Furthermore, the implementation process of step (5) is as follows:

[0041] The weight values ​​of each node are sorted from best to worst, and then grouped using the following formula to ensure balanced performance of nodes in each group:

[0042] G i =((i-1)mod k)+1

[0043] Among them, G iis the i-th group; each group is a Raft group, and the group uses the one with the best weight value as the leader, and each leader constitutes a member of PBFT; after obtaining the comprehensive weight of all nodes, the system sorts the weights, and then sets the node with the best weight as the master node in PBFT, and then puts the excellent nodes into different groups in turn, and so on, so that in each Raft group, the leader node is the best node locally.

[0044] Furthermore, the implementation process of step (6) is as follows:

[0045] At the PBFT master accounting node level, ensure that the number of master accounting nodes satisfies n≥3f+1, where f is the number of Byzantine nodes; the master accounting nodes regularly record and verify system logs to ensure the correctness of the logs; when the system is initialized, all PBFT master accounting nodes are elected according to the algorithm rules to ensure that they will not become Byzantine nodes;

[0046] When the possibility of a Byzantine node is detected, the PBFT master accounting node sends regular log reports to the external supervision node; the external supervision node confirms the validity of the events recorded in the system based on the log reports of the PBFT master accounting node and marks any suspicious nodes;

[0047] The external supervision node regularly collects log data from the PBFT main accounting node as the basis for verification; through the regular external supervision mechanism, the external supervision node dynamically tracks and evaluates whether the Raft Leader node has Byzantine behavior;

[0048] After each election, the Raft leader node cross-verifies the election results with the external supervisory node. If the external supervisory node finds that the new leader node is inconsistent or the Byzantine node's log is abnormal, a new round of Raft leader election is triggered immediately, and the Byzantine node is marked as an invalid node.

[0049] The entire mechanism ensures that the final selected Leader node can pass the verification of the external supervisory node through cyclic election and supervision, ensuring that its logs and behaviors meet the system consensus requirements, and reducing the impact of Byzantine nodes on the overall performance and security of the system;

[0050] During each round of supervision, the activity log of the external supervision node is compared with the log of the PBFT main accounting node to ensure the correctness and consistency of the monitoring node operation and maintain the overall security and stability of the system.

[0051] Furthermore, the implementation process of step (7) is as follows:

[0052] Collect and record the key performance indicators of the system in real time, including consensus latency, node stability, and throughput; identify abnormal patterns or trends through data analysis based on the collected data, and issue alerts in time for intervention; formulate corresponding optimization plans based on the results of performance evaluation.

[0053] Beneficial effects: Compared with the prior art, the present invention has the following beneficial effects:

[0054] The grouping mechanism proposed in the present invention effectively improves the robustness of the system in the face of failures and attacks, ensuring that normal operation can be maintained in the event of node failure or abnormal conditions; the established supervisory node module can effectively monitor the behavior of key nodes, prevent Byzantine nodes from occupying the Leader role for a long time, and ensure the correctness of data in the consensus process; combining the advantages of Raft and PBFT, while ensuring security and stability, it significantly reduces consensus delays and increases throughput; by dynamically adjusting node weights and introducing a grouping mechanism, this method can effectively respond to consistency challenges in a high-concurrency environment, ensuring the security and reliability of data in a distributed e-commerce order processing system;

[0055] The simulation experiment results show that the present invention significantly improves the consistency maintenance efficiency of order processing when processing large-scale node networks, and has strong fault tolerance and throughput performance; this method not only achieves fast consistency in an environment without Byzantine failures, but also can effectively filter malicious nodes and maintain system data consistency when facing Byzantine node attacks, thus ensuring the security and stability of distributed e-commerce order processing systems in complex network environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 It is a schematic diagram of the GRAFT-EWMA consensus algorithm framework proposed in the present invention;

[0057] Figure 2 It is a flow chart of the GRAFT-EWMA consensus algorithm proposed in the present invention;

[0058] Figure 3 It is a flow chart of introducing an external supervisory node proposed by the present invention;

[0059] Figure 4 It is a comparison chart of consensus delay and consensus request of the present invention. DETAILED DESCRIPTION

[0060] The present invention will be further described in detail below in conjunction with the accompanying drawings.

[0061] like Figure 1 , Figure 2The present invention proposes a distributed e-commerce order processing method based on the GRAFT-EWMA (Grouped Raft Anti-ByzantineConsensus Algorithm Based on Exponential Weighted Moving Average) consensus algorithm, comprising the following steps:

[0062] Step 1: Clarify the data consistency requirements of the e-commerce order processing system in a high-concurrency environment, and define the system's performance indicators based on business scenarios.

[0063] Clarify the main consistency requirements of the distributed e-commerce order processing system in a high-concurrency environment. For example, in order transactions or real-time inventory management scenarios, strong consistency needs to be achieved to ensure that all nodes can access the latest order and inventory data at the same time. The e-commerce order processing system is used to manage user order information, including user ID, order ID, product details, order status, payment information, and logistics information. The system achieves high-concurrency processing capabilities through a distributed architecture to ensure data consistency and reliability during order processing to meet the e-commerce platform's requirements for real-time and accuracy.

[0064] Based on the business scenarios, define the system's performance indicators, including response time, throughput, fault tolerance, etc., and communicate with e-commerce system administrators and end users to understand their expectations for consistency management.

[0065] Based on the results of the demand analysis, select the appropriate technology stack, including the distributed e-commerce system, programming language and related framework that supports the GRAFT-EWMA algorithm to ensure that it can efficiently handle communication between nodes and data consistency management. Identify key data sets, including product inventory, customer information and order data. During the system initialization phase, each node will be configured to process the corresponding data set and establish basic network connections.

[0066] Step 2: Divide the nodes participating in the consensus into several groups, determine the number of nodes in each group, and calculate the initial weight of each node for subsequent weight analysis and adjustment.

[0067] To ensure the stability and security of the system, the number of groups and the number of nodes in each group must meet specific requirements. The number of groups required for PBFT consensus should be no less than 4 (k ≥ 4) to provide sufficient redundant nodes to tolerate potential errors in the system. At the same time, the number of Raft consensus nodes in each group should be no less than 3 (m ≥ 3) to meet the requirements of the majority principle in the consensus process, thereby ensuring the normal operation of the system. First, initialize the weight W0 of each node and periodically collect the performance data X of each node. tThe performance of the node is smoothed using an exponentially weighted moving average (EWMA) to calculate the node weight. The calculation process of EWMA is as follows:

[0068] W t =αX t +(1-α)W t-1

[0069] Among them, W t is the weight of the node, X t is the observed value at time t, and α is the smoothing coefficient (ranging from 0 to 1). t-1 is the weight value at the previous moment. At each time interval, the system collects the latest performance data of each node (such as response time, processing speed, etc.), and uses this formula to calculate the weight of the node and update the importance of the node in the network. The calculation process of EWMA is to continuously perform weighted averaging on new observations, and by exponentially decaying historical data, the average value can be made more sensitive to the latest data, while maintaining a certain memory of historical data.

[0070] Preprocess the initial node weight data, including removing invalid node data and adjusting the weight ratio of node groups to ensure that each group has a reasonable load distribution during the consensus process, thereby optimizing the overall performance of the system and improving consensus efficiency.

[0071] The distributed e-commerce order processing system collects the processing capacity of each node (the number of orders that can be processed per second), network latency (the average response time with other nodes) and failure rate (the number of disconnections in the past week) to calculate node weights, ensuring that high-performance nodes receive higher priority in the consensus process.

[0072] Step 3: Monitor the performance and stability of the nodes, evaluate the reliability of the nodes through the set measurement values, and provide data support for subsequent node weight adjustments.

[0073] In the process of calculating node weights, when the system detects a significant change in node performance (such as a sudden increase or decrease in performance), the following formula is used to adjust the weight so that the node weight can quickly reflect the latest performance status and enable the system to quickly adapt to the new node status. Specifically, the formula will update the weight to ensure that the changes in the node are responded to in a timely manner, thereby maintaining the stability and consistency of the system in a dynamic environment.

[0074] W t =W t-1 +α(X t -W t-1 )

[0075] The system periodically calculates the variance of node performance using the following formula:

[0076]

[0077] in, is the variance of node performance, λ is the smoothing factor, and μ is the average value of node performance data. By calculating the variance, the system can evaluate the fluctuation of node performance, thereby identifying abnormal nodes and handling them in a timely manner to ensure the overall stability of the system and optimize consensus efficiency.

[0078] After calculating the node variance, the upper control limit (UCL) and the lower control limit (LCL) of the control chart are calculated by the following formula to determine their thresholds:

[0079]

[0080]

[0081] Among them, L is the control limit parameter, which is usually set to 3. UCL and LCL are used to monitor the stability of node performance and ensure that it operates within the preset range, so as to promptly detect and handle nodes with abnormal performance to maintain the normal operation of the system and improve consensus efficiency.

[0082] The actual measured value is compared with the set threshold. If the measured value of a node exceeds the threshold, the system will identify the node as a node with large performance fluctuations, and then adjust the workload of the node with large performance fluctuations to reduce its impact on the overall system performance, and redistribute it to other groups to reduce the impact on a single group.

[0083] For example, when the system processes an order, it determines the stability of the node. When processing an order, the system monitors the status of each node in real time. If the processing delay of a node exceeds a preset threshold (for example, 200 milliseconds) or fails multiple times (such as failing to respond three times in a row), the node is marked as unstable, and the method automatically adjusts its weight to reduce its influence in the consensus.

[0084] Step 4: Adjust the node weights in real time based on the node's stability and performance, and normalize different weights to ensure fairness.

[0085] If there is more than one measurement value, use the following formula to calculate the EWMA value W for each performance measurement value t,j :

[0086] W t,j =α·X t,j +(1-α)·W t-1,j

[0087] Among them, j represents the measured value of the jth performance at time t. By performing separate weighted average processing on different performance indicators, the system can more comprehensively reflect the comprehensive performance of the node, thereby improving the sensitivity and adaptability to node state changes.

[0088] Combining different types of performance indicators, the EWMA values ​​of each performance are normalized using the following formula:

[0089]

[0090] Each performance measure is assigned a weight γ by the following formula j , which can make nodes with smaller variance and more stable performance obtain higher weights:

[0091]

[0092] Use the following formula to combine the normalized EWMA values ​​to get the comprehensive weight W of each node: t :

[0093]

[0094] By normalizing the weights of the same node in different time periods, the comprehensive weight of each node is obtained, ensuring that the contribution of each node is fairly considered during the consensus process.

[0095] Step 5: Group the nodes participating in the consensus and assign master nodes and leader nodes to each group to optimize the consensus process; ensure that order requests can be processed in a timely manner and that the generated order records are consistent among all nodes.

[0096] The weight values ​​of each node are sorted from best to worst, and then grouped using the following formula to ensure balanced performance of nodes in each group and improve the overall performance of the system:

[0097] G i =((i-1)mod k)+1

[0098] Among them, G iis the i-th group. Each group is a Raft group. The leader with the best weight value is used in each group, and each leader constitutes a member of PBFT. Since the quality of the leaders is relatively good, the overall response speed and throughput are also relatively good. In the whole process, the GRAFT-EWMA algorithm makes the advantages of Raft and PBFT better play. After obtaining the comprehensive weights of all nodes, the system sorts the weights, then sets the node with the best weight as the master node in PBFT, and then puts the excellent nodes into different groups in turn, and so on, so that in each Raft group, the leader node is the best node locally, and the comprehensive quality is roughly the same in each Raft group. At the same time, the algorithm can monitor and adjust the performance of the nodes, identify and isolate abnormal nodes. In this algorithm, PBFT can better play its anti-attack ability in the case of Byzantine failures. When the system load is low, some nodes in the Raft group can be temporarily shut down to save resources and reduce energy consumption, thereby enhancing the overall efficiency and stability of the system.

[0099] Step 6, such as Figure 3 As shown in the figure, an external supervisory node is introduced, and a multi-level supervisory strategy is adopted to monitor all participating nodes in real time to ensure the transparency and security of the consensus process.

[0100] At the PBFT master accounting node level, ensure that the number of master accounting nodes satisfies n≥3f+1 (where f is the number of Byzantine nodes). The master accounting node will regularly record and verify the system log to ensure the correctness of the log. When the system is initialized, all PBFT master accounting nodes are elected according to the algorithm rules to ensure that they will not become Byzantine nodes.

[0101] When the possibility of a Byzantine node is detected, the PBFT master accounting node sends regular log reports to the external supervision node. The external supervision node confirms the validity of the events recorded in the system based on the log reports of the PBFT master accounting node and marks any suspicious nodes.

[0102] The external supervisory node regularly collects log data from the PBFT master accounting node as the basis for verification. Through the regular external supervision mechanism, the external supervisory node can dynamically track and evaluate whether the Raft Leader node has Byzantine behavior.

[0103] After each election, the Raft leader node needs to cross-verify the election results with the external supervisory node. If the external supervisory node finds that the new leader node is inconsistent or the Byzantine node's log is abnormal, a new round of Raft leader election will be triggered immediately, and the Byzantine node will be marked as an invalid node.

[0104] Through cyclic elections and supervision, the system ensures that the finally selected Leader node can pass the verification of the external supervisory node, ensures that its logs and behaviors meet the system consensus requirements, and reduces the impact of Byzantine nodes on the overall performance and security of the system.

[0105] During each round of supervision, the activity log of the external supervision node is compared with the log of the PBFT main accounting node to ensure the correctness and consistency of the monitoring node operation and maintain the overall security and stability of the system.

[0106] Step 7: Regularly evaluate the performance of the e-commerce order processing system and implement necessary optimization measures to ensure efficient consensus process and data consistency in a dynamically changing environment.

[0107] Real-time collection and recording of key performance indicators of the system, including consensus latency, node stability, throughput, etc.

[0108] Based on the collected data, through data analysis, abnormal patterns or trends are identified, such as a significant increase in node response time or fluctuations in data consistency, and timely alarms are issued for intervention;

[0109] According to the results of the performance evaluation, formulate corresponding optimization plans. For example, if the consensus delay is found to be too high, you can consider adjusting the node weight distribution.

[0110] Through the above steps, the system can maintain optimal performance in a dynamically changing e-commerce environment, respond to user needs in a timely manner, and enhance the overall order processing capabilities and user experience. In a high-concurrency e-commerce order processing environment, the system successfully processed more than 30,000 orders. After performance testing, the consensus delay of the system was about 200 milliseconds when it had 60 nodes, which was 60% lower than the traditional Raft algorithm. In the end, all order data achieved consistency in the distributed e-commerce order processing system, effectively avoiding order conflicts caused by node failures or malicious behavior, thereby ensuring the operational efficiency of the e-commerce platform and improving user experience.

[0111] The 11th Gen Inrel(R)Core(TM) i5-11400@2.60Hz service host with 6 cores and 12 threads was used. The GRAFT-EWMA algorithm, Raft algorithm, and VSSB-Raft consensus algorithm were implemented in C++ by configuring the gcc compiler, and the node class, message passing mechanism, and consensus algorithm simulation were implemented. By introducing the consensus request count and the number of consensus request nodes as variables, the consensus delay of the Raft, VSSB-Raft consensus algorithm, and the GRAFT-EWMA consensus algorithm was evaluated. Figure 4As shown in Figure 2, the consensus delays under different numbers of nodes are compared, as well as the consensus delays under different numbers of node requests. Specifically, the GRAFT-EWMA algorithm can provide faster consensus speeds and lower delays when the number of nodes and consensus requests increase.

[0112] There are many methods and approaches to implement the technical solution of the present invention, and the above are only preferred embodiments of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be regarded as the protection scope of the present invention. All components not specified in this embodiment can be implemented by existing technologies.

Claims

1. A distributed e-commerce order processing method based on the GRAFT-EWMA consensus algorithm, characterized in that: The following steps are involved: (1) Clarify the data consistency requirements of e-commerce order processing in a high-concurrency environment and define the performance indicators of the e-commerce order processing system based on business scenarios; (2) Divide the nodes participating in the consensus into several groups, determine the number of nodes in each group, and calculate the initial weight of each node for weight analysis and adjustment; (3) Monitor the performance and stability of nodes, evaluate the reliability of nodes through set measurement values, and provide data support for subsequent node weight adjustments; (4) Adjust the node weights in real time based on the node’s stability and performance, and normalize different weights to ensure fairness; (5) Group the nodes participating in the consensus and assign master nodes and leader nodes to each group to optimize the consensus process; (6) Introduce external supervision nodes and adopt multi-level supervision strategies to monitor all participating nodes in real time to ensure the transparency and security of the consensus process; (7) Regularly evaluate the performance of the e-commerce order processing system and implement necessary optimization measures to ensure efficient consensus process and data consistency in a dynamically changing environment.

2. The distributed e-commerce order processing method based on the GRAFT-EWMA consensus algorithm according to claim 1 is characterized in that: The performance indicators of the distributed e-commerce order processing system in step (1) include response time, throughput, and fault tolerance.

3. The distributed e-commerce order processing method based on the GRAFT-EWMA consensus algorithm according to claim 1 is characterized in that: Step (2) divides the nodes participating in the consensus into several groups, and determines the number of nodes in each group as follows: The number of groups required for PBFT consensus should be no less than four to provide sufficient redundant nodes to tolerate potential errors in the system; the number of Raft consensus nodes in each group should be no less than three to meet the requirements of the majority principle in the consensus process and ensure the normal operation of the system.

4. The distributed e-commerce order processing method based on the GRAFT-EWMA consensus algorithm according to claim 1 is characterized in that: The implementation process of counting the initial weight of each node in step (2) is as follows: Initialize the weight W0 for each node and periodically collect the performance data X of each node t ; The performance of the node is smoothed by using the exponentially weighted moving average EWMA to calculate the weight of the node; the calculation process of EWMA is as follows: IN t =αX t +(1-α)W t-1 Among them, W t is the weight of the node, X t is the observed value at time t, α is the smoothing coefficient, W t-1 is the weight value at the previous moment; at each time interval, the system collects the latest performance data of each node, calculates the node's weight, and updates the node's importance in the network; Preprocess the initial node weight data, including removing invalid node data and adjusting the weight ratio of node groups to ensure that each group has a reasonable load distribution during the consensus process, optimize the overall performance of the system and improve consensus efficiency.

5. The distributed e-commerce order processing method based on the GRAFT-EWMA consensus algorithm according to claim 1 is characterized in that: The implementation process of step (3) is as follows: Update weights to ensure that changes in nodes are responded to in a timely manner and maintain the stability and consistency of the system in a dynamic environment: W t =W t-1 +α(X t -W t-1 ); The variance of node performance is calculated periodically using the following formula: in, is the variance of node performance, λ is the smoothing factor, and μ is the average value of node performance data; After calculating the node variance, the upper control limit UCL and the lower control limit LCL of the control chart are calculated by the following formula to determine the threshold: Among them, L is the control limit parameter; the actual measurement value is compared with the set threshold. If the measurement value of a node exceeds the threshold, the system will identify the node as a node with large performance fluctuations. The node with large performance fluctuations will then adjust the workload to reduce its impact on the overall system performance, and reallocate it to other groups to reduce the impact on a single group.

6. The distributed e-commerce order processing method based on the GRAFT-EWMA consensus algorithm according to claim 1 is characterized in that: The implementation process of step (4) is as follows: If there is more than one node measurement value, use the following formula to calculate the EWMA value W for each performance measurement value t,j : W t,j =α·X t,j +(1-a)·W t-1,j Among them, j represents the measured value of the jth performance at time t; combining different types of performance indicators, the EWMA values ​​of each performance are normalized using the following formula: Each performance measure is assigned a weight γ by the following formula j , so that nodes with smaller variance and more stable performance receive higher weights: Use the following formula to combine the normalized EWMA values ​​to get the comprehensive weight W of each node: t :

7. The distributed e-commerce order processing method based on the GRAFT-EWMA consensus algorithm according to claim 1 is characterized in that: The implementation process of step (5) is as follows: The weight values ​​of each node are sorted from best to worst, and then grouped using the following formula to ensure balanced performance of nodes in each group: G i =((i-1)mod k)+1 Among them, G i is the i-th group; each group is a Raft group, and the group uses the one with the best weight value as the leader, and each leader constitutes a member of PBFT; after obtaining the comprehensive weight of all nodes, the system sorts the weights, and then sets the node with the best weight as the master node in PBFT, and then puts the excellent nodes into different groups in turn, and so on, so that in each Raft group, the leader node is the best node locally.

8. The distributed e-commerce order processing method based on the GRAFT-EWMA consensus algorithm according to claim 1 is characterized in that: The implementation process of step (6) is as follows: At the PBFT master accounting node level, ensure that the number of master accounting nodes satisfies n≥3f+1, where f is the number of Byzantine nodes; the master accounting nodes regularly record and verify system logs to ensure the correctness of the logs; when the system is initialized, all PBFT master accounting nodes are elected according to the algorithm rules to ensure that they will not become Byzantine nodes; When the possibility of a Byzantine node is detected, the PBFT master accounting node sends regular log reports to the external supervision node; The external supervisory node confirms the validity of the events recorded in the system based on the log report of the PBFT master accounting node and marks any suspicious nodes; The external supervision node regularly collects log data from the PBFT main accounting node as the basis for verification; through the regular external supervision mechanism, the external supervision node dynamically tracks and evaluates whether the Raft Leader node has Byzantine behavior; After each election, the Raft leader node cross-verifies the election results with the external supervisory node. If the external supervisory node finds that the new leader node is inconsistent or the Byzantine node's log is abnormal, a new round of Raft leader election is triggered immediately, and the Byzantine node is marked as an invalid node. The entire mechanism ensures that the final selected Leader node can pass the verification of the external supervisory node through cyclic election and supervision, ensuring that its logs and behaviors meet the system consensus requirements, and reducing the impact of Byzantine nodes on the overall performance and security of the system; During each round of supervision, the activity log of the external supervision node is compared with the log of the PBFT main accounting node to ensure the correctness and consistency of the monitoring node operation and maintain the overall security and stability of the system.

9. The distributed e-commerce order processing method based on the GRAFT-EWMA consensus algorithm according to claim 1 is characterized in that: The implementation process of step (7) is as follows: Collect and record key performance indicators of the system in real time, including consensus latency, node stability, and throughput; identify abnormal patterns or trends through data analysis based on the collected data, and issue alerts in time for intervention; According to the results of performance evaluation, formulate corresponding optimization plan.

10. The distributed e-commerce order processing method based on the GRAFT-EWMA consensus algorithm according to claim 5 is characterized in that: The control limit parameter L is set to 3.

Citation Information

Patent Citations

  • Method and system for distributing order execution in MOM system

    CN113610450A

  • Raft-PBFT-based block chain consensus method

    CN114422513A

  • Energy block chain node consensus method based on improved Raft consensus mechanism

    CN116233132A

  • TRPBFT consensus method and system supporting node dynamic change

    CN117118985A

  • Improved consensus method based on raft and related device

    WO2024113334A1