A secure data transmission method based on multi-thread control
By identifying sensitivity in the data packet header and dynamically adjusting the encryption algorithm and thread resource allocation, the flexibility and adaptability issues of secure data transmission under multi-threaded control are solved. This achieves a balance between security and performance in high-concurrency scenarios and is suitable for data synchronization systems on cloud computing platforms.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-08
- Publication Date
- 2026-03-24
AI Technical Summary
Existing secure data transmission methods under multi-threaded control struggle to meet the diverse needs of different data types and network environments, resulting in insufficient security or excessive performance overhead. Furthermore, they lack flexibility and adaptability, making it difficult to achieve a balance between security and performance in high-concurrency scenarios.
By extracting sensitivity identifiers from data packet headers and using a lookup algorithm to match a sensitivity grading table, data is divided into high, medium, and low categories. Priority queue allocation ratios are determined based on sensitivity. The encryption algorithm and thread resource allocation are dynamically adjusted by combining the token bucket algorithm and the sliding window algorithm. A load balancing strategy is adopted to increase CPU time slice allocation for highly sensitive data. Encryption and transmission operations are performed through multi-threaded parallel processing to ensure mutex lock synchronization.
It enables dynamic adjustment of encryption strength and resource allocation based on data sensitivity and network conditions in complex network environments, improving the security and efficiency of data transmission, and is suitable for complex network environments that process data with different sensitivities.
Smart Images

Figure CN121309207B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of network information security technology, specifically to a secure data transmission method based on multi-threaded control. Background Technology
[0002] Secure data transmission under multi-threaded control is a key issue in modern network communication. Its importance lies in ensuring the confidentiality and integrity of data in complex and ever-changing environments, while simultaneously meeting the demand for high-efficiency transmission. With the widespread application of cloud computing, the Internet of Things, and distributed systems, the security of data transmission is directly related to user privacy and system reliability.
[0003] However, existing methods often employ a uniform encryption strategy to achieve secure transmission, making it difficult to address the diverse needs of different data types and network environments. This results in either insufficient security or excessive performance overhead, making it difficult to adapt to dynamically changing real-world scenarios. The current solutions are limited by a lack of flexibility and adaptability. Most systems use fixed encryption algorithms and key lengths, failing to dynamically adjust based on data importance or changes in the network environment. This single strategy may lead to insufficient protection for highly sensitive data, while causing unnecessary waste of computational resources when processing ordinary data. Furthermore, existing methods rarely consider resource allocation among threads in a multi-threaded environment, making it difficult to achieve a balance between security and performance in high-concurrency scenarios. The core challenge lies first in how to dynamically select the appropriate encryption strength based on data sensitivity. Highly sensitive data requires stronger encryption protection, while ordinary data is more suitable for lightweight encryption to reduce overhead. However, this requirement further leads to the question of how to adjust the encryption algorithm and key length of each thread in real time in a multi-threaded environment based on network security and the availability of computational resources. Uncertainties in the network environment, such as potential threats to public networks, may require stronger encryption, but this also increases the computational burden. The limited availability of computing resources restricts the widespread application of strong encryption. The design of such a dynamic adjustment mechanism requires finding a balance between security, performance, and resource constraints. Summary of the Invention
[0004] The purpose of this invention is to provide a secure data transmission method based on multi-threaded control, thereby solving the problems existing in the prior art.
[0005] To achieve the above objectives, the present invention provides the following technical solution: a secure data transmission method based on multi-threaded control, the method comprising:
[0006] The sensitivity identifier is extracted from the packet header, and a lookup algorithm is used to match the preset sensitivity classification table to divide the data into three categories: high sensitivity, medium sensitivity, and low sensitivity. The priority queue allocation ratio is determined according to the sensitivity to obtain the initial traffic shaping parameters. The lookup algorithm includes, but is not limited to, hash lookup or binary search algorithm.
[0007] Based on the initial traffic shaping parameters, the current network traffic data is obtained, the preset congestion detection threshold and historical transmission records are analyzed, and the token bucket algorithm is used to determine the degree of network congestion. If the degree of congestion is higher than the preset congestion detection threshold, the token generation rate of highly sensitive data is adjusted to obtain the adjusted traffic shaping strategy.
[0008] Based on the adjusted traffic shaping strategy, the load detection frequency and data sampling rate are set, the sliding window algorithm is used to analyze the transmission delay and packet loss rate, and the token generation rate and priority queue allocation ratio are adjusted to obtain a new traffic shaping strategy.
[0009] Based on the new traffic shaping strategy, a load balancing strategy is adopted to reallocate thread resources, increase the CPU time slice allocation ratio for high-sensitive data threads, and perform encryption and transmission operations through multi-threaded parallel processing to ensure consistency with the mutex lock synchronization mechanism in the updated thread priority scheme, so as to obtain the final transmission result.
[0010] Preferably, the specific steps for obtaining current network traffic data based on initial traffic shaping parameters include: selecting an encryption algorithm from a preset encryption algorithm library based on the initial traffic shaping parameters: selecting the Advanced Encryption Standard 256-bit algorithm and setting a high-priority token consumption rule for high-sensitivity data, selecting the Advanced Encryption Standard 128-bit algorithm and setting a medium-priority token consumption rule for medium-sensitivity data, and selecting the ChaCha20 algorithm and setting a low-priority token consumption rule for low-sensitivity data, thereby obtaining the encryption algorithm configuration and token consumption rules, and obtaining the current network traffic data based on the encryption algorithm configuration and token consumption rules.
[0011] Preferably, the specific steps of setting the load detection frequency and data sampling rate according to the adjusted traffic shaping strategy include: obtaining CPU utilization and memory usage data from the system resource monitoring module according to the adjusted traffic shaping strategy, calculating the resource availability score using a weighted average algorithm, with the formula S=w1(1-C)+w2(1-M), where S is the resource availability score, C is the CPU utilization, M is the memory usage, w1 and w2 are preset weights, and w1+w2=1. If S is lower than the preset resource availability threshold, the CPU time slice allocation ratio of low-sensitivity data threads is reduced to obtain the initial thread resource allocation scheme.
[0012] Preferably, the specific steps of setting the load detection frequency and data sampling rate according to the adjusted traffic shaping strategy further include: analyzing the task queue length according to the initial thread resource allocation scheme, using a priority scheduling algorithm to allocate a higher proportion of CPU time slices to highly sensitive data threads, setting a fixed resource allocation cycle and a mutex lock synchronization mechanism, determining the dynamic thread pool size, and obtaining an optimized thread resource allocation scheme.
[0013] Preferably, the specific steps of setting the load detection frequency and data sampling rate according to the adjusted traffic shaping strategy further include: applying the encryption algorithm configuration and the adjusted traffic shaping strategy to the multi-threaded encryption task according to the optimized thread resource allocation scheme, wherein the high-sensitivity data thread performs Advanced Encryption Standard 256-bit encryption and binds a priority flag, the medium-sensitivity data thread performs Advanced Encryption Standard 128-bit encryption, and the low-sensitivity data thread performs ChaCha20 encryption to obtain the encrypted data packet.
[0014] Preferably, the specific steps of setting the load detection frequency and data sampling rate according to the adjusted traffic shaping strategy further include: extracting priority tags from the encrypted data packets, performing traffic shaping using the token bucket algorithm, adjusting the transmission order according to the token generation rate in the adjusted traffic shaping strategy, and if the network congestion level is higher than the preset congestion detection threshold, prioritizing the transmission of data packets with highly sensitive data tags to obtain the optimized transmission sequence.
[0015] Preferably, the specific steps of setting the load detection frequency and data sampling rate according to the adjusted traffic shaping strategy further include: obtaining the real-time transmission status according to the optimized transmission sequence, setting the load detection frequency and sliding step size, using the sliding window algorithm to analyze the transmission delay and packet loss rate, and if the delay exceeds the preset delay threshold, reducing the priority weight of the low-sensitivity data thread to obtain the updated thread priority scheme.
[0016] Preferably, the specific steps of setting the load detection frequency and data sampling rate according to the adjusted traffic shaping strategy further include: adjusting the dynamic thread pool size and resource allocation cycle according to the updated thread priority scheme, ensuring the consistency of encryption and transmission order through a mutex lock synchronization mechanism, sending the encrypted data packets to the target node through multi-threaded parallel processing to obtain the transmission result, obtaining real-time feedback data through transmission status monitoring based on the transmission result, and setting the load detection frequency and data sampling rate.
[0017] Preferably, the sensitivity classification table has preset sensitivity identifiers for multiple data types, including personal identification information, transaction records, log data, and public data.
[0018] Preferably, the token bucket algorithm is used to dynamically determine the network congestion level based on the relationship between the token generation rate and the data transmission rate per unit time, and to adjust the data transmission rate of each sensitivity level in real time.
[0019] As can be seen from the above technical solution, the present invention has the following beneficial effects:
[0020] This secure data transmission method based on multi-threaded control categorizes data into high, medium, and low sensitivity levels by extracting sensitivity identifiers from the data packet header, and then selects corresponding encryption algorithms and token consumption rules accordingly. In cases of network congestion, high-sensitivity data packets are transmitted first. The invention also dynamically adjusts thread resource allocation based on system resource conditions, allocating more CPU time slices to high-sensitivity data. Traffic shaping is performed using the token bucket algorithm, and a sliding window algorithm is employed to analyze transmission status, adjusting traffic strategies and thread resource allocation in real time. This method effectively improves network transmission efficiency while ensuring data security, and is particularly suitable for complex network environments that require simultaneous processing of data with varying sensitivity levels. Attached Figure Description
[0021] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation
[0022] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0023] Example 1:
[0024] like Figure 1 As shown, the present invention provides a technical solution: a secure data transmission method based on multi-threaded control, the method comprising:
[0025] The sensitivity identifier is extracted from the packet header, and a lookup algorithm is used to match the preset sensitivity classification table to divide the data into three categories: high sensitivity, medium sensitivity, and low sensitivity. The priority queue allocation ratio is determined according to the sensitivity to obtain the initial traffic shaping parameters.
[0026] Based on the initial traffic shaping parameters, the current network traffic data is obtained, the preset congestion detection threshold and historical transmission records are analyzed, and the token bucket algorithm is used to determine the degree of network congestion. If the degree of congestion is higher than the preset congestion detection threshold, the token generation rate of highly sensitive data is adjusted to obtain the adjusted traffic shaping strategy.
[0027] Based on the adjusted traffic shaping strategy, the load detection frequency and data sampling rate are set, the sliding window algorithm is used to analyze the transmission delay and packet loss rate, and the token generation rate and priority queue allocation ratio are adjusted to obtain a new traffic shaping strategy.
[0028] Based on the new traffic shaping strategy, a load balancing strategy is adopted to reallocate thread resources, increase the CPU time slice allocation ratio for high-sensitive data threads, and perform encryption and transmission operations through multi-threaded parallel processing to ensure consistency with the mutex lock synchronization mechanism in the updated thread priority scheme, so as to obtain the final transmission result.
[0029] This method first parses sensitivity identifiers from received data packet headers and uses efficient lookup algorithms (such as hash lookup or binary search) to quickly identify data categories by comparing them with a sensitivity classification table. Based on data sensitivity, the system sets different priority weights and allocates bandwidth resources proportionally to queues of different sensitivity levels, constructing an initial traffic shaping parameter model. Subsequently, by monitoring real-time network traffic and combining historical transmission data with a set congestion detection threshold, the token bucket algorithm is used to assess the current network congestion level. When the congestion level exceeds the threshold, the token generation rate of highly sensitive data is dynamically reduced to decrease its instantaneous bandwidth consumption and alleviate network pressure, thus forming an adaptively adjusted shaping strategy. Next, the system introduces a sliding window algorithm to fine-tune the token generation rate and queue resource ratio based on latency and packet loss rate information collected within a fixed time window, achieving fine-grained management of network load. During this process, the data sampling rate and load detection frequency are adjusted in a timely manner to ensure the representativeness and responsiveness of the monitored data. Finally, based on the new traffic shaping strategy, the system reallocates thread resources and uses a multi-threaded framework scheduler to adjust the CPU time slice allocation mechanism, giving high-sensitivity data threads higher processing priority. Mutex locks between threads ensure thread synchronization safety and avoid concurrency conflicts. In this multi-threaded environment, the system executes data encryption and transmission tasks in parallel, ensuring that the final data is successfully transmitted through a secure and efficient channel.
[0030] This method first identifies packet sensitivity using the following formula:
[0031] ;
[0032] in, This represents the sensitivity level of the i-th data packet. This represents the header information of the i-th data packet. This indicates a preset sensitivity rating table. This represents the search operation function;
[0033] Based on the recognition results, the data is allocated to a priority queue:
[0034] ;
[0035] in, This represents the set of priority queue allocation proportions. This indicates the allocation ratio of highly sensitive data. This indicates the proportion of sensitive data allocated in the data. This indicates the proportion of low-sensitivity data allocated.
[0036] The formula for determining the token bucket is:
[0037] ;
[0038] in, This represents the actual transmission rate of the current i-th type of data. Indicates the target transmission rate. This indicates the number of tokens available in the token bucket. This indicates the token bucket refresh cycle (time interval).
[0039] like Less than the set threshold This indicates network congestion, and the token generation rate should be adjusted as follows:
[0040] ;
[0041] in, This indicates the adjusted transmission rate. This is an adjustment coefficient used to suppress flow; its value is typically between 0.6 and 0.9.
[0042] To further evaluate transmission stability, a sliding window method was used to calculate the average delay and packet loss rate:
[0043] ; ;
[0044] in, This represents the average transmission delay within the sliding window. Indicates the window size and the number of most recent packets being evaluated. This represents the transmission delay of the i-th data packet. This indicates the current packet loss rate. This represents the number of data packets lost within the j-th time period. This represents the total amount of data sent within the j-th time period.
[0045] In thread resource configuration, allocate more time slices for highly sensitive data:
[0046] ;
[0047] in, This indicates the CPU time allocated to highly sensitive threads. This represents the total CPU time that can be allocated to the system. This represents the thread allocation coefficient for highly sensitive data, typically ranging from 0.4 to 0.6.
[0048] To ensure thread synchronization, a set of mutex locks is set up:
[0049] ;
[0050] in, For a set of mutex locks, This is a mutex lock object used for the critical section of the i-th thread.
[0051] This invention introduces a complete mathematical modeling and dynamic parameter adjustment mechanism, which can automatically adjust bandwidth and resource allocation strategies according to changes in real-time network status and data sensitivity, taking into account both data security and transmission efficiency. The token bucket and sliding window mechanism enhances the accuracy of flow control and status monitoring. Multi-threaded processing combined with mutex locks ensures concurrency safety, enabling the system to maintain excellent performance indicators such as low packet loss, low latency, and high throughput in high-concurrency environments.
[0052] This method can be directly applied to data synchronization systems on cloud computing platforms. For example, a medical data platform needs to synchronize electronic medical records in real time between the hospital and the cloud center. During peak backup periods at night, the system detects network congestion. This method dynamically reduces the transmission rate of low-sensitivity image data while increasing the CPU quota for threads storing high-sensitivity medical record information. A sliding window is used to monitor packet loss and further adjust parameters. Ultimately, while ensuring the timeliness of core data transmission, the overall system operates stably, demonstrating the practical value of this invention in real-world business systems.
[0053] Example 2:
[0054] The specific steps for obtaining current network traffic data based on initial traffic shaping parameters include: selecting an encryption algorithm from a preset encryption algorithm library based on the initial traffic shaping parameters: selecting the Advanced Encryption Standard 256-bit algorithm and setting high-priority token consumption rules for high-sensitivity data; selecting the Advanced Encryption Standard 128-bit algorithm and setting medium-priority token consumption rules for medium-sensitivity data; and selecting the ChaCha20 algorithm and setting low-priority token consumption rules for low-sensitivity data. This yields the encryption algorithm configuration and token consumption rules. Based on the encryption algorithm configuration and token consumption rules, the current network traffic data is obtained.
[0055] In this step, the initial traffic shaping parameters are used as the basis for control when entering the encryption algorithm configuration stage.
[0056] Based on the allocation ratio and priority corresponding to various sensitivities, the system accesses a preset encryption algorithm library.
[0057] A = {AES-256, AES-128, ChaCha20}, using the following mapping strategy:
[0058] ;
[0059] in, For the sensitivity of the i-th type of data, The selected encryption algorithm is represented by AES-256 (256-bit Advanced Encryption Standard), AES-128 (128-bit Advanced Encryption Standard), and ChaCha20 (a highly efficient encryption algorithm based on stream cipher structures).
[0060] At the same time, set corresponding token consumption rules based on encryption strength and performance overhead:
[0061] ;
[0062] in, This indicates the number of tokens consumed per unit of data. Indicates encryption algorithm The unit encryption computation time (CPU cycles / byte). This represents the sensitivity priority weighting coefficient, with typical values being: high sensitivity. =1.5, Medium Sensitivity =1.0, low sensitivity =0.7.
[0063] Combining the token bucket algorithm, the system according to The maximum token consumption for each data category per unit of time is dynamically set, thereby controlling the bandwidth of the encryption processing.
[0064] Ultimately, based on the above configuration, the system monitors the current network transmission status, measures and summarizes the data traffic under different encryption algorithms and their corresponding token rules, in order to update subsequent traffic shaping and thread allocation strategies.
[0065] This step enhances the system's fine-grained control over security and resource allocation by introducing a coupled processing mechanism for encryption algorithm selection and token consumption. By matching encryption algorithms and priority strategies to data of varying sensitivity, the data processing layer and transmission control layer are linked, improving the encryption strength and processing priority of sensitive data. AES-256 is used to encrypt highly sensitive data, ensuring information security; while lighter encryption algorithms (such as ChaCha20) are used for medium- and low-sensitivity data, reducing resource consumption. The overall design balances security and performance overhead, enabling the system to maintain high transmission throughput and response speed while preserving a high level of security.
[0066] Example 3:
[0067] According to the adjusted traffic shaping strategy, the specific steps for setting the load detection frequency and data sampling rate include: obtaining CPU utilization and memory usage data from the system resource monitoring module according to the adjusted traffic shaping strategy; calculating the resource availability score using a weighted average algorithm, with the formula S=w1(1-C)+w2(1-M), where S is the resource availability score, C is the CPU utilization, M is the memory usage, w1 and w2 are preset weights, and w1+w2=1. If S is lower than the preset resource availability threshold, the CPU time slice allocation ratio of low-sensitivity data threads is reduced to obtain the initial thread resource allocation scheme.
[0068] The specific operation is as follows: After the adjusted traffic shaping strategy is determined, the system needs to assess the current hardware resource status to ensure that the new scheduling strategy is effectively executed within the resource allowable range. The system obtains the current central processing unit (CPU) utilization C and memory utilization M in real time through the resource monitoring module.
[0069] To comprehensively measure the overall schedulability of the system, a resource availability score calculation model is introduced:
[0070] S = w1(1-C) + w2(1-M);
[0071] In this model: 1-C represents the remaining available percentage of CPU, 1-M represents the remaining available percentage of memory, and w1 and w2 represent the importance of CPU and memory resources, respectively. They are generally set to w1=0.6 and w2=0.4 to emphasize the importance of CPU resources.
[0072] The system sets resource availability thresholds. ,For example =0.3, when When this occurs, it indicates that the current system load is too high, and the scheduling strategy needs to reduce resource consumption.
[0073] At this point, the system adjusts its time slice allocation ratio with the goal of prioritizing the sacrifice of threads with low-sensitivity data:
[0074] ;
[0075] in, To adjust the time slice ratio of the low-sensitivity data thread, ∈(0,1) is the reduction factor, with typical values such as 0.5-0.8. This represents the adjusted time slice percentage.
[0076] Through the above mechanism, the system achieves dynamic optimization of multi-threaded scheduling resources, reserving critical resources for highly sensitive and moderately sensitive data processing threads, and avoiding impact on the execution of core data tasks when resources are scarce.
[0077] By introducing a resource availability scoring mechanism, the system can quantify current processing capacity in real time and intelligently adjust thread resource allocation based on hardware utilization, thereby improving the adaptability and stability of the scheduling strategy. Especially in high-load scenarios, dynamically compressing the execution resources of low-sensitivity tasks effectively ensures the continuity and priority of critical tasks, reducing the risk of system crashes or latency anomalies due to insufficient resources. Furthermore, the use of weight parameters allows the system to flexibly adjust resource priorities according to different business scenarios (such as a preference for CPU-intensive or memory-sensitive tasks).
[0078] Example 4:
[0079] According to the adjusted traffic shaping strategy, the specific steps for setting the load detection frequency and data sampling rate also include analyzing the task queue length based on the initial thread resource allocation scheme, using a priority scheduling algorithm to allocate a higher proportion of CPU time slices to highly sensitive data threads, setting a fixed resource allocation cycle and a mutex lock synchronization mechanism, determining the dynamic thread pool size, and obtaining the optimized thread resource allocation scheme.
[0080] After obtaining the initial thread resource allocation scheme, the system further analyzes the current queue length of each type of data thread through the task queue management module, setting the task queue lengths for high, medium, and low sensitivity data as follows: The system then assesses the urgency of task processing as follows:
[0081] ;
[0082] in, This represents the priority scheduling weight of the i-th type of data thread. Indicates the current length of the task queue. This represents the priority coefficient corresponding to data sensitivity. (For example:) =1.5, =1.0, =0.5).
[0083] After setting the initial thread resource allocation scheme, the system further analyzes the task queue lengths corresponding to various types of sensitive data threads to determine the current processing pressure. The system obtains the backlog of tasks for high-sensitivity, medium-sensitivity, and low-sensitivity data in real time through the task queue management module, denoted as the number of high-sensitivity tasks, medium-sensitivity tasks, and low-sensitivity tasks, respectively. Next, the system calculates a scheduling priority weight for each type of data thread. This weight is obtained by multiplying the number of tasks by the corresponding sensitivity weight coefficient. For example, high-sensitivity threads can be set to a weight of 1.5, medium-sensitivity threads to 1.0, and low-sensitivity threads to 0.5. If the number of high-sensitivity tasks is 50, medium-sensitivity tasks to 30, and low-sensitivity tasks to 20, then their priority scheduling weights are 75, 30, and 10, respectively. Subsequently, the system calculates the proportion of CPU time slices that should be allocated to each type of thread based on these weights. Specifically, the weight of a certain type of thread is divided by the sum of the weights of all threads to obtain the proportion of total CPU time that type of thread should occupy. Continuing with the example above, if the total weight of all threads is 115, then highly sensitive threads should receive 75 divided by 115, approximately 65% of the time slice, medium sensitive threads 26%, and low sensitive threads 9%. To maintain the continuity and stability of system scheduling, the system sets a fixed resource allocation cycle, such as a schedule refresh every 100 milliseconds, and employs a mutex mechanism to ensure that multiple threads do not experience data conflicts or concurrency anomalies when accessing shared resources (such as caches or encryption modules). Furthermore, the system determines whether to expand the thread pool size based on the growth rate of the task queue. This growth rate is calculated by the rate of change in the number of tasks. For example, if the number of highly sensitive tasks increases from 50 to 100 within 10 seconds, the growth rate is 5 tasks per second. The system multiplies the base number of threads by the task growth rate and then multiplies by a scaling factor, such as adding 0.2 threads for every additional task, to determine the total number of threads in the new thread pool. In summary, the system formulates an optimized thread scheduling scheme based on the number of tasks, sensitivity level, and resource status. This scheme includes the CPU time allocation for various types of threads, a fixed scheduling cycle, a mutex lock control method, and the size of the thread pool, thereby ensuring the stability and efficiency of the system in high-concurrency and multi-type task processing scenarios.
[0084] This step, by comprehensively considering task pressure (queue length), priority weights, and current resource status, achieves dynamic rescheduling of thread resources, significantly improving the system's resource utilization and service level assurance capabilities under high load conditions. A weighted scheduling strategy is adopted, ensuring highly sensitive data receives a more stable processing channel at critical moments, reducing latency and blocking caused by queuing. Periodic resource reallocation and dynamic thread pool adjustment mechanisms effectively handle sudden increases in tasks, enhancing system resilience. The mutex lock mechanism provides reliable synchronization guarantees for resource access during concurrent execution, reducing the occurrence of deadlocks or contention issues.
[0085] Example 5:
[0086] According to the adjusted traffic shaping strategy, the specific steps for setting the load detection frequency and data sampling rate also include applying the encryption algorithm configuration and the adjusted traffic shaping strategy to the multi-threaded encryption task based on the optimized thread resource allocation scheme. The high-sensitivity data thread performs Advanced Encryption Standard 256-bit encryption and binds a priority flag, the medium-sensitivity data thread performs Advanced Encryption Standard 128-bit encryption, and the low-sensitivity data thread performs ChaCha20 encryption to obtain the encrypted data packet.
[0087] This step is executed after the optimized thread resource allocation scheme is completed. Based on this scheme, a corresponding number of threads are started to execute the data encryption task in parallel. The system first assigns the encryption algorithm configuration and traffic shaping strategy selected in the previous steps to various types of data threads. High-sensitivity data threads are configured to execute the AES-256 (Advanced Encryption Standard 256-bit) encryption algorithm, which has high encryption strength, and are bound to a high-priority tag to ensure higher priority during network transmission and scheduling. Low-sensitivity data threads use the ChaCha20 stream encryption algorithm, a high-performance, low-latency encryption scheme suitable for quickly processing large amounts of data with low security requirements. During multi-threaded execution, each thread encrypts the original data block within its scope of function, based on the allocated resource ratio, available CPU time, and synchronization mechanism limitations. The entire encryption process follows the data transmission rhythm controlled by the aforementioned token bucket algorithm to ensure that the encrypted output data conforms to the integer shaping policy requirements. Finally, the encryption results output by each thread are encapsulated into independent data packets, carrying corresponding priority flags, for further processing by the network scheduling module.
[0088] This step effectively integrates the encryption process with thread resource scheduling and data priority strategies. By explicitly binding different levels of data to specific encryption algorithms and utilizing a multi-threaded parallel execution strategy, the encryption process is both efficient and meets data security requirements. The priority marking mechanism provides a basis for subsequent packet scheduling, improving the overall service quality assurance capability of the network system. By introducing multiple encryption algorithms, the system can ensure the security of highly sensitive data while reducing the resource burden on processing medium- and low-sensitivity data, achieving an optimal balance between performance and security.
[0089] Example 6:
[0090] According to the adjusted traffic shaping strategy, the specific steps of setting the load detection frequency and data sampling rate also include extracting priority tags from the encrypted data packets, performing traffic shaping using the token bucket algorithm, adjusting the transmission order according to the token generation rate in the adjusted traffic shaping strategy, and prioritizing the transmission of data packets with highly sensitive data tags if the network congestion level is higher than the preset congestion detection threshold, thereby obtaining the optimized transmission sequence.
[0091] After completing multi-threaded encryption and outputting encrypted data packets, the system reads the embedded priority flag field from each data packet. This flag field typically contains a sensitivity indicator, such as "H" for high sensitivity, "M" for medium sensitivity, and "L" for low sensitivity. The system then initiates a token bucket-based traffic shaping module, controlling the transmission order according to the token generation rate set in the traffic shaping strategy for each data level. The basic mechanism of the token bucket algorithm is: each data type has an independent token bucket, and the system continuously adds tokens to the bucket at a set rate. Only when there are enough tokens in the bucket can that type of data packet enter the transmission channel. Under stable network conditions, all types of data packets are scheduled fairly according to the token rate. However, when the system monitoring module identifies that the current network congestion level exceeds a preset threshold (e.g., link utilization exceeds 85%), the system will reorder the data packets to be transmitted according to the flag field, prioritizing data packets with high-sensitivity flags for placement in the transmission queue. This operation dynamically allocates more token generation rates to high-sensitivity categories based on a "high-priority priority token allocation strategy." For example, if the token rate ratio for the three types of data is 5:3:2 under normal conditions, it can be adjusted to 7:2:1 under congestion conditions to improve the bandwidth for high-sensitivity data transmission. Ultimately, the system dynamically optimizes and forms an ordered and controllable transmission sequence based on the current network conditions and priority weights. This sequence ensures that critical data passes through network bottlenecks with priority and security.
[0092] This step introduces a priority-aware mechanism and an adaptive token bucket strategy, enhancing the system's quality of service (QoS) assurance capabilities under high load or congestion scenarios. By identifying highly sensitive data and adjusting its transmission priority, it effectively prevents the risk of critical data delays or even loss due to network congestion. Dynamically adjusting the token generation rate enables the system to quickly respond to changes in network status. Combined with a packet priority sorting mechanism, it achieves on-demand allocation and precise scheduling of transmission link bandwidth resources, improving the overall security and efficiency of the transmission system.
[0093] Example 7:
[0094] According to the adjusted traffic shaping strategy, the specific steps for setting the load detection frequency and data sampling rate also include obtaining the real-time transmission status based on the optimized transmission sequence, setting the load detection frequency and sliding step size, using the sliding window algorithm to analyze the transmission delay and packet loss rate, and reducing the priority weight of low-sensitivity data threads if the delay exceeds the preset delay threshold to obtain the updated thread priority scheme.
[0095] This step runs continuously during the optimized transmission sequence to dynamically monitor and control transmission performance. The system first obtains the real-time transmission and reception times of current data packets through the data link monitoring module and calculates the actual transmission delay for each data packet based on network feedback information. To capture trends in transmission performance, the system uses a sliding window algorithm to analyze latency and packet loss rate. The sliding window size (the number of data packets contained in the window) and sliding step size (the number of packets or time period the window moves) are set according to network load conditions; for example, the default can be set to 100 packets with a step size of 20 packets or 200ms. The system calculates the individual transmission delay for each data packet within the sliding window and obtains the average latency value within the window. If this average value exceeds the system-set latency threshold (e.g., 150ms), it is considered that the current network is congested or experiencing a processing bottleneck. In this case, the system automatically triggers a thread priority weight adjustment strategy. Specifically, the weight parameter value set for low-sensitivity data threads is lowered; for example, if the original priority weight is 0.5, it can be reduced to 0.3. This move aims to reduce the proportion of CPU time slices and network resources allocated to low-sensitivity threads, freeing up more resources for high-sensitivity and medium-sensitivity data threads and alleviating system bottlenecks. The updated thread priority scheme will take effect in the next scheduling cycle, guiding the thread scheduler to allocate CPU execution time and other shared resources according to the latest priorities, maintaining stable data transmission within a controllable latency range.
[0096] By introducing a sliding window algorithm for real-time performance evaluation, the system can quickly detect trends in declining network transmission efficiency and dynamically adjust thread resource priorities based on transmission latency and packet loss. Compared to static allocation strategies, this method significantly enhances the system's adaptability, enabling it to dynamically respond to high-latency and unstable network environments while maintaining service continuity, thus improving the transmission assurance level of critical business data. The mechanism of reducing the weight of low-sensitivity threads also avoids a "hard interruption" to overall system performance, instead balancing transmission pressure through flexible compression, which helps maintain the smoothness and long-term stability of system operation.
[0097] Example 8:
[0098] The specific steps for setting the load detection frequency and data sampling rate according to the adjusted traffic shaping strategy also include adjusting the dynamic thread pool size and resource allocation cycle according to the updated thread priority scheme, ensuring the consistency of encryption and transmission order through a mutex lock synchronization mechanism, using multi-threaded parallel processing to send the encrypted data packets to the target node to obtain the transmission results, obtaining real-time feedback data through transmission status monitoring based on the transmission results, and setting the load detection frequency and data sampling rate.
[0099] After receiving the updated thread priority scheme, the system dynamically adjusts the thread pool size based on the latest priority weights of various thread types, i.e., increasing or decreasing the number of threads that can execute in parallel, to ensure that system resources are preferentially allocated to high-sensitivity and medium-sensitivity tasks. The resource allocation cycle is also reset based on network and task load conditions. For example, if an increase in the number of high-priority threads is detected, the resource allocation cycle can be shortened (e.g., from 200ms to 100ms) to improve response speed; conversely, the cycle is extended to save resources. The multi-threaded processing module schedules data packet encryption and transmission operations according to the current thread pool capacity and thread priorities, following a specific strategy. Each thread independently encrypts the data packet and then sends the data to the preset target node or server address via system calls or network transmission interfaces. Once the transmission operation is complete, the system obtains real-time feedback data, including transmission success rate, average latency, and packet loss, and writes it to the transmission status monitoring module. This module analyzes the feedback information to adjust the subsequent load detection frequency (e.g., increasing the sampling frequency from 500ms to 200ms) and data sampling rate (i.e., the range of data fields and the number of samples), making the system's perception granularity more refined and forming a closed-loop optimization control.
[0100] By dynamically adjusting the thread pool size and scheduling frequency based on thread priority, the system achieves agile resource allocation response, ensuring the timely processing of high-priority data. The introduction of a mutex mechanism enhances data consistency and system stability during concurrent operations. Parallel processing of encryption and transmission tasks significantly improves data output rate, while the feedback mechanism enables the system to understand transmission efficiency and network status in real time, thereby adjusting subsequent strategies and achieving a self-contained loop for system scheduling optimization.
[0101] The sensitivity rating table has preset sensitivity labels for multiple data types, including personal identification information, transaction records, log data, and public data.
[0102] This invention introduces a pre-defined sensitivity classification table into the data classification mechanism to quickly determine the sensitivity level of data types at the initial stage of data reception or processing. This table predefines several typical data types and their corresponding sensitivity identifiers using a key-value pair structure. Specifically, the classification table identifies "personal identity information" such as ID card numbers, mobile phone numbers, and biometric data as "highly sensitive"; "transaction records" such as financial statements and e-commerce payment details as "medium sensitive"; "log data" such as system operation logs and API call logs as "low sensitive"; and "public data" such as basic enterprise information and industry news as "non-sensitive" or "public". When parsing data packet headers or metadata, the system reads the data type field and matches it against the classification table using a fast lookup algorithm (such as hash lookup) to quickly identify the data sensitivity and proceed with subsequent traffic shaping, encryption processing, and thread scheduling. This classification table typically exists as a configuration file, possessing updateability and scalability, and can be dynamically adjusted according to regulatory changes or business needs.
[0103] By pre-setting a sensitivity classification table, the system achieves pre-processing identification and intelligent classification of data, providing a foundation for decision-making in flow control, encryption, and scheduling. This mechanism significantly reduces runtime data analysis overhead and improves classification efficiency. Furthermore, this method enhances the controllability and granularity of the system's security policies, enabling customized protection for data of different levels in subsequent processing flows. This aligns with cybersecurity principles such as tiered protection and least privilege, making it particularly suitable for scenarios requiring explicit legal protection of personal information.
[0104] The token bucket algorithm is used to dynamically determine the degree of network congestion based on the relationship between the token generation rate and the data transmission rate per unit time, and to adjust the data transmission rate of each sensitivity level in real time.
[0105] This invention employs the token bucket algorithm as the core flow control mechanism. The key idea of this algorithm is that the system sets up an independent token bucket for each type of sensitive data (high, medium, and low). The system adds tokens to the bucket at a set rate every unit of time. Only when there are enough tokens in the bucket can the relevant type of data be allowed to be sent. Under normal network conditions, the token generation rate is basically consistent with or slightly redundant to the data transmission rate, ensuring smooth transmission of data at all levels. The system continuously monitors the actual transmission rate of each type of data and compares it with the set token generation rate: if the actual transmission rate of a certain type of data is consistently lower than its token generation rate, it indicates that network transmission is smooth or resources are abundant; if the transmission rate of a certain type of data experiences frequent congestion, tokens cannot be used for a long time, or the generation rate is far lower than the expected transmission rate, it is preliminarily judged that there are signs of congestion on the link. To further improve the accuracy of the judgment, the system calculates indicators such as token utilization rate, backlog token growth trend, and transmission queue length every unit of time. If the overall evaluation result shows that the current network congestion level is higher than the set congestion threshold (e.g., the token backlog growth rate is consistently higher than 30%), the system will trigger a dynamic adjustment strategy. The adjustment strategy includes prioritizing a reduction in the token generation rate for buckets corresponding to low-sensitivity data (e.g., from 200 to 100 per second), while maintaining or increasing the token generation rate for high-sensitivity data (e.g., from 300 to 400 per second) to ensure the priority transmission needs of critical data. This dynamic adjustment process is ongoing and works in real-time with the thread scheduling module to ensure that the sensitivity-driven transmission strategy operates efficiently under different network load conditions.
[0106] A dynamic congestion assessment mechanism based on the token bucket algorithm is introduced, enabling the system to possess traffic awareness and response adjustment capabilities. This mechanism can precisely identify transmission bottlenecks, avoiding the delay or loss of critical data transmission caused by one-size-fits-all bandwidth compression. The sensitivity-based flow control scheme improves network resource utilization efficiency while ensuring priority passage for critical data, effectively enhancing the system's quality of service control capabilities in large-scale concurrent environments. Dynamically adjusting the token rate also helps to smooth network traffic output and reduce the impact of sudden data surges on the link.
[0107] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A secure data transmission method based on multi-threaded control, characterized in that, The method includes: The sensitivity identifier is extracted from the packet header, and a lookup algorithm is used to match the preset sensitivity classification table to divide the data into three categories: high sensitivity, medium sensitivity, and low sensitivity. The priority queue allocation ratio is determined according to the sensitivity to obtain the initial traffic shaping parameters. The lookup algorithm includes, but is not limited to, hash lookup or binary search algorithm. Based on the initial traffic shaping parameters, the current network traffic data is obtained, the preset congestion detection threshold and historical transmission records are analyzed, and the token bucket algorithm is used to determine the degree of network congestion. If the degree of congestion is higher than the preset congestion detection threshold, the token generation rate of highly sensitive data is adjusted to obtain the adjusted traffic shaping strategy. Based on the adjusted traffic shaping strategy, the load detection frequency and data sampling rate are set, the sliding window algorithm is used to analyze the transmission delay and packet loss rate, and the token generation rate and priority queue allocation ratio are adjusted to obtain a new traffic shaping strategy. Based on the new traffic shaping strategy, a load balancing strategy is adopted to reallocate thread resources, increase the CPU time slice allocation ratio for high-sensitive data threads, and perform encryption and transmission operations through multi-threaded parallel processing to ensure consistency with the mutex lock synchronization mechanism in the updated thread priority scheme and obtain the final transmission result. The specific steps for obtaining current network traffic data based on initial traffic shaping parameters include: selecting an encryption algorithm from a preset encryption algorithm library based on the initial traffic shaping parameters: selecting the Advanced Encryption Standard 256-bit algorithm and setting a high-priority token consumption rule for high-sensitivity data, selecting the Advanced Encryption Standard 128-bit algorithm and setting a medium-priority token consumption rule for medium-sensitivity data, and selecting the ChaCha20 algorithm and setting a low-priority token consumption rule for low-sensitivity data, thereby obtaining the encryption algorithm configuration and token consumption rule, and obtaining the current network traffic data based on the encryption algorithm configuration and token consumption rule; The specific steps for setting the load detection frequency and data sampling rate according to the adjusted traffic shaping strategy include: obtaining CPU utilization and memory usage data from the system resource monitoring module according to the adjusted traffic shaping strategy, calculating the resource availability score using a weighted average algorithm, with the formula S=w1(1-C)+w2(1-M), where S is the resource availability score, C is the CPU utilization, M is the memory usage, w1 and w2 are preset weights, w1+w2=1, and if S is lower than the preset resource availability threshold, reducing the CPU time slice allocation ratio of low-sensitivity data threads to obtain the initial thread resource allocation scheme; The specific steps of setting the load detection frequency and data sampling rate according to the adjusted traffic shaping strategy also include: analyzing the task queue length according to the initial thread resource allocation scheme, using a priority scheduling algorithm to allocate a higher proportion of CPU time slices to highly sensitive data threads, setting a fixed resource allocation cycle and a mutex lock synchronization mechanism, determining the dynamic thread pool size, and obtaining the optimized thread resource allocation scheme.
2. The secure data transmission method based on multi-threaded control according to claim 1, characterized in that: The specific steps of setting the load detection frequency and data sampling rate according to the adjusted traffic shaping strategy also include: applying the encryption algorithm configuration and the adjusted traffic shaping strategy to the multi-threaded encryption task according to the optimized thread resource allocation scheme; the high-sensitivity data thread performs Advanced Encryption Standard 256-bit encryption and binds a priority flag; the medium-sensitivity data thread performs Advanced Encryption Standard 128-bit encryption; and the low-sensitivity data thread performs ChaCha20 encryption to obtain the encrypted data packet.
3. The secure data transmission method based on multi-threaded control according to claim 2, characterized in that: The specific steps of setting the load detection frequency and data sampling rate according to the adjusted traffic shaping strategy further include: extracting priority tags from the encrypted data packets, performing traffic shaping using the token bucket algorithm, adjusting the transmission order according to the token generation rate in the adjusted traffic shaping strategy, and prioritizing the transmission of data packets with highly sensitive data tags if the network congestion level is higher than the preset congestion detection threshold, thereby obtaining an optimized transmission sequence.
4. The secure data transmission method based on multi-threaded control according to claim 3, characterized in that: The specific steps of setting the load detection frequency and data sampling rate according to the adjusted traffic shaping strategy further include: obtaining the real-time transmission status according to the optimized transmission sequence, setting the load detection frequency and sliding step size, using the sliding window algorithm to analyze the transmission delay and packet loss rate, and if the delay exceeds the preset delay threshold, reducing the priority weight of low-sensitivity data threads to obtain the updated thread priority scheme.
5. A secure data transmission method based on multi-threaded control according to claim 4, characterized in that: The specific steps for setting the load detection frequency and data sampling rate according to the adjusted traffic shaping strategy also include: adjusting the dynamic thread pool size and resource allocation cycle according to the updated thread priority scheme, ensuring the consistency of encryption and transmission order through a mutex lock synchronization mechanism, sending the encrypted data packets to the target node through multi-threaded parallel processing to obtain the transmission results, obtaining real-time feedback data through transmission status monitoring based on the transmission results, and setting the load detection frequency and data sampling rate.
6. The secure data transmission method based on multi-threaded control according to claim 1, characterized in that: The sensitivity rating table has preset sensitivity labels for multiple data types, including personal identification information, transaction records, log data, and public data.
7. A secure data transmission method based on multi-threaded control according to claim 1, characterized in that: The token bucket algorithm is used to dynamically determine the network congestion level based on the relationship between the token generation rate and the data transmission rate per unit time, and to adjust the data transmission rate of each sensitivity level in real time.
Citation Information
Patent Citations
Flow controllable forwarding method and system
CN120223643A