Methods, apparatus, storage media, and electronic devices for determining parameter sets for the number of processes and threads.
The particle swarm optimization algorithm automatically identifies the globally optimal parameter set for network card performance testing and dynamically adjusts the number of processes and threads, solving the problem of inaccurate process and thread counts in existing technologies and improving testing efficiency and accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- JINAN INSPUR DATA TECH CO LTD
- Filing Date
- 2026-03-26
- Publication Date
- 2026-06-30
AI Technical Summary
In existing technologies, the number of processes and threads used to determine network card performance testing is inaccurate, resulting in insufficient network device transmission efficiency and tuning accuracy, low testing efficiency, and results influenced by personal experience.
The particle swarm optimization algorithm is used to automatically identify the globally optimal parameter set based on the performance test results of the initial parameter set. The number of processes and threads is then adjusted according to the globally optimal parameter set to dynamically optimize the parameter set until the target performance conditions are met.
It accelerates the process of finding the optimal resource scheduling parameters, reduces invalid test loops, improves optimization efficiency, and ensures the accuracy and consistency of the number of processes and threads.
Smart Images

Figure CN122309152A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, storage medium, and electronic device for determining parameter groups for the number of processes and threads. Background Technology
[0002] With the rapid development of data center network technology, the speed of server network cards has jumped from 10G / s to 100G / s or even higher, marking a significant enhancement in data transmission capabilities. This trend places higher demands on network card performance testing, especially in terms of optimizing parameter configurations, such as determining the number of processes and threads, which directly affect the transmission efficiency of network devices and the accuracy of network optimization.
[0003] Existing technical solutions primarily rely on human experience or fixed-parameter iteration to determine the optimal number of processes (ports) and threads for the iperf3 tool when testing network interface card (NIC) performance. Specifically, current techniques typically involve testers manually adjusting the number of processes and threads based on past experience, repeatedly performing performance tests to find the best combination. This is inefficient, and the results are influenced by personal experience, making it difficult to guarantee consistency and optimality. Alternatively, they may fix the number of threads or processes first, test different values of another parameter to find a local optimum, and then iterate backwards to try to approximate the global optimum. This approach is inefficient and lacks consideration of the synergistic effects between parameters. In other words, existing techniques suffer from inaccurate determination of the number of processes and threads. Summary of the Invention
[0004] This application provides a method, apparatus, storage medium, and electronic device for determining parameter groups of process number and thread number, so as to at least solve the problem of inaccurate determination of process number and thread number in the prior art.
[0005] This application provides a method for determining parameter sets for the number of processes and threads, comprising: determining a globally optimal parameter set in the initial parameter set based on initial performance test results of multiple initial parameter sets in the initial parameter set, wherein the initial performance test results are used to indicate the operation of a communication device when a first number of processes are created based on a first number of processes and a second number of threads indicated by the initial parameter set, and a second number of threads are created for each process; adjusting the first number of processes and the second number of threads of each of the multiple initial parameter sets according to the globally optimal number of processes and the globally optimal number of threads indicated by the globally optimal parameter set, respectively, to obtain an adjusted current parameter set; determining the current performance test results corresponding to each of the multiple current parameter sets in the current parameter set; and determining the current parameter set whose current performance test results satisfy the target performance conditions as the target parameter set.
[0006] This application also provides an apparatus for determining parameter sets for the number of processes and threads, comprising: a first determining module, which determines a globally optimal parameter set in the initial parameter set based on the initial performance test results of multiple initial parameter sets in the initial parameter set, wherein the initial performance test results are used to indicate the operation of the communication device when a first number of processes are created based on the first number of processes and the second number of threads indicated by the initial parameter set, and a second number of threads are created for each process; a dynamic optimization module, which adjusts the first number of processes and the second number of threads of each of the multiple initial parameter sets according to the globally optimal number of processes and the globally optimal number of threads indicated by the globally optimal parameter set, to obtain an adjusted current parameter set; a second determining module, which determines the current performance test results corresponding to each of the multiple current parameter sets in the current parameter set; and a termination judgment module, which determines the current parameter set whose current performance test results satisfy the target performance conditions as the target parameter set.
[0007] This application also provides an electronic device, including: a memory for storing a computer program; and a processor for implementing the steps of any of the methods for determining the number of processes and the number of threads parameter groups when executing the computer program.
[0008] This application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of any of the methods described above for determining the parameter group of the number of processes and the number of threads.
[0009] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the methods described above for determining the parameter group of the number of processes and the number of threads.
[0010] This application determines the globally optimal parameter group in the initial parameter group set based on the initial performance test results of multiple initial parameter groups. The initial performance test results are used to indicate the operation of the communication device when the first number of processes and the second number of threads indicated by the initial parameter group are created, and the second number of threads are created for each process. Based on the operation of the communication device under different process and thread configurations, the globally optimal initial configuration is automatically identified. Based on the globally optimal process and thread numbers indicated by the globally optimal parameter group, the first process and second thread numbers of each of the multiple initial parameter groups are adjusted to obtain the adjusted current parameter group set. This reduces the gap between each configuration in the parameter group set and the globally optimal configuration, accelerates the process of searching for the optimal resource scheduling parameters, reduces invalid or inefficient test loops, and improves optimization efficiency. The current performance test results corresponding to each of the multiple current parameter groups in the current parameter group set are determined. Thus, the current parameter group whose current performance test results meet the target performance conditions is determined as the target parameter group, solving the problem of inaccurate determination of the number of processes and threads in the prior art. Attached Figure Description
[0011] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 A hardware structure block diagram of a server device for a method of determining a parameter group of process number and thread number provided in an embodiment of this application;
[0013] Figure 2 A flowchart illustrating a method for determining a parameter group for the number of processes and threads, provided in an embodiment of this application;
[0014] Figure 3 A flowchart illustrating another method for determining the number of processes and the number of threads provided in this application embodiment;
[0015] Figure 4 This is a schematic diagram of a device for determining a parameter group for the number of processes and threads according to an embodiment of this application;
[0016] Figure 5 This is a schematic diagram of the structure of an electronic device for determining a parameter group of process number and thread number according to an embodiment of this application. Detailed Implementation
[0017] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0018] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0019] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0020] The methods and embodiments provided in this application can be executed on a server device or a similar computing device. Taking running on a server device as an example, Figure 1 This is a hardware structure block diagram of a server device for a method of determining a parameter group for the number of processes and threads, according to an embodiment of this application. Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a central processing unit (CPU), a microprocessor (MCU), or a programmable logic device (FPGA)) and a memory 104 for storing data are also shown. The server device may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that… Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the server equipment described above. For example, the server equipment may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0021] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the method for determining the number of processes and threads parameter groups in this embodiment. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, thus implementing the above-described method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to server devices via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0022] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider for the server device. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0023] The embodiments of this application provide a method for determining a parameter group of process number and thread number. The method is described in detail below in conjunction with the execution flow of the method for determining the parameter group of process number and thread number.
[0024] To better understand the technical solutions provided in the embodiments of this application, the key terms involved in the embodiments of this application will be introduced first:
[0025] Particle Swarm Optimization (PSO) algorithm.
[0026] iperf3: A tool for measuring network bandwidth performance.
[0027] Number of Processes (NP).
[0028] Number of Threads (NT).
[0029] Fitness Function (FF).
[0030] As an optional implementation method, such as Figure 2As shown, the methods for determining the parameter sets for the number of processes and threads include:
[0031] S202, based on the initial performance test results of multiple initial parameter groups in the initial parameter group set, determine the globally optimal parameter group in the initial parameter group set, wherein the initial performance test results are used to indicate the operation of the communication device when the first number of processes and the second number of threads are created based on the first number of processes and the second number of threads indicated by the initial parameter group, and the second number of threads are created for each process.
[0032] S204. Based on the number of globally optimal processes and the number of globally optimal threads indicated by the globally optimal parameter group, adjust the number of first processes and the number of second threads of each of the multiple initial parameter groups to obtain the adjusted current parameter group set.
[0033] S206, Determine the current performance test results corresponding to each of the multiple current parameter groups in the current parameter group set;
[0034] S208, the current parameter group whose current performance test results meet the target performance conditions is determined as the target parameter group.
[0035] As an optional implementation, in step S202, the globally optimal parameter set in the initial parameter set is determined based on the initial performance test results of multiple initial parameter sets in the initial parameter set set.
[0036] Optionally, the aforementioned initial parameter set can be a combination of pre-generated random numbers of processes (first number of processes) and threads (second number of threads), forming multiple initial parameter sets; performance tests are performed on each initial parameter set to evaluate the operation of the communication device (such as a server or network device) under a specific number of processes and threads. The aforementioned operation mainly includes, but is not limited to, performance indicators such as network card utilization, data throughput, and latency; among the test results of all initial parameter sets, the parameter set that can achieve the optimal performance indicators or meet a specific performance target is found, which is the aforementioned globally optimal parameter set.
[0037] In step S204 above, the number of first processes and the number of second threads of each of the multiple initial parameter groups are adjusted according to the number of globally optimal processes and the number of globally optimal threads indicated by the globally optimal parameter group, so as to obtain the adjusted current parameter group set.
[0038] Optionally, at the end of the current iteration, based on the performance test results of all parameter groups, the particle with the highest network card utilization (globally optimal parameter group) is identified, and its current (P,T) parameter group is taken as gbest (globally optimal solution), where P is the number of processes and T is the number of threads.
[0039] As an optional implementation, the initial parameter set is {(2,4), (3,6), (4,12)}. Assuming that the test results of parameter set (4,12) indicate that the hardware device has the best operating performance, then (4,12) is the globally optimal parameter set. Taking the adjustment of the first initial parameter set (2,4) based on the globally optimal parameter set (4,12) as an example:
[0040] The adjusted number of processes = 2 + W1 × (4 - 2); the adjusted number of threads = 4 + W2 × (12 - 4), where W1 and W2 are weight coefficients that can be dynamically adjusted through adaptive learning, and no specific restrictions are imposed here.
[0041] Further, in step S206, the current performance test results corresponding to each of the multiple current parameter groups in the current parameter group set are determined. Optionally, based on the generated current parameter group set, a performance test is performed for each parameter group to evaluate the operating status of the communication device under the new parameter configuration.
[0042] Optionally, in step S208 above, the current parameter group whose current performance test results meet the target performance conditions is determined as the target parameter group. Optionally, the target performance conditions are, for example, a target network card utilization rate close to 100%, while maintaining a high data throughput level and a low latency range.
[0043] Through the above-described embodiments described in this application, based on the initial performance test results of multiple initial parameter groups in the initial parameter group set, a globally optimal parameter group in the initial parameter group set is determined. The initial performance test results are used to indicate the operation of the communication device when a first number of processes are created based on the first number of processes and the second number of threads indicated by the initial parameter group, and a second number of threads are created for each process. Based on the operation of the communication device under different process and thread configurations, the globally optimal initial configuration is automatically identified. Based on the globally optimal number of processes and the globally optimal number of threads indicated by the globally optimal parameter group, the first number of processes and the second number of threads of each of the multiple initial parameter groups are adjusted to obtain the adjusted current parameter group set, narrowing the gap between each configuration in the parameter group set and the globally optimal configuration, accelerating the process of searching for optimal resource scheduling parameters, reducing invalid or inefficient test loops, and improving optimization efficiency. The current performance test results corresponding to each of the multiple current parameter groups in the current parameter group set are determined. Thus, the current parameter group whose current performance test results meet the target performance conditions is determined as the target parameter group, solving the problem of inaccurate determination of the number of processes and threads in the prior art.
[0044] In one optional implementation, after determining the current performance test results corresponding to each of the multiple current parameter groups in the current parameter group set, the process includes:
[0045] S1. Based on the performance test results of the initial parameter group in the first sequence position in the initial parameter group set and the current performance test results of the current parameter group in the first sequence position in the current parameter group set, determine the individual optimal parameter group that matches the first sequence position.
[0046] S2, Repeat the above steps to determine the optimal parameter set for each individual that matches each sequence position.
[0047] Optionally, the aforementioned sequence positions serve as position identifiers for each parameter group within the particle swarm, distinguishing different parameter groups and facilitating comparison of performance test results before and after iterations. The aforementioned individual optimal parameter group can be understood as the optimal parameter configuration experienced by the particle at each sequence position during historical iterations. Throughout the optimization process, each performance test and parameter adjustment completes one iteration of the algorithm. After each iteration, the individual optimal parameter group corresponding to each sequence position needs to be updated based on the current and historical performance test results.
[0048] As an optional implementation, assume there is a set of 5 initial parameter sets, with the sequence positions arranged in the order of generation. The initial parameter set for the first sequence position is (P=1, T=4). After one iteration, the parameter set for the first sequence position in the current parameter set set becomes (P=2, T=5). Performance testing shows that the new parameter set performs better. Therefore, the individual optimal parameter set for the first sequence position is updated to (P=2, T=5). The above comparison and update process is repeated until the parameter sets for all sequence positions have been checked and updated. Before entering the next iteration, each sequence position has a record of the latest individual optimal parameter set. These records will serve as reference points in future iterations for comparison and optimization.
[0049] By iteratively testing and comparing parameter sets located at different sequence positions through the above implementation method, and gradually updating the optimal parameter set for each individual position, it is ensured that each parameter set has the opportunity to become the optimal choice for a certain individual in the sequence, thereby improving the comprehensiveness and accuracy of the optimization process, and thus improving the accuracy of determining the optimal process number and thread number parameter sets.
[0050] In one alternative implementation, after determining the optimal set of parameters for each individual matching each sequence position, the process includes:
[0051] S1, based on the number of globally optimal processes indicated by the globally optimal parameter group and the number of individually optimal processes indicated by the individually optimal parameter group that matches the first sequence position, adjust the number of current processes indicated by the current parameter group that is in the first sequence position in the current parameter group set;
[0052] S2, based on the number of globally optimal threads indicated by the globally optimal parameter group and the number of individually optimal threads indicated by the individual optimal parameter group that matches the first sequence position, adjust the number of current threads indicated by the current parameter group that is in the first sequence position in the current parameter group set;
[0053] S3. Repeat the above steps to adjust the number of current processes and the number of current threads indicated by the current parameter group at each sequence position.
[0054] In step S1 above, the number of current processes indicated by the current parameter group at the first sequence position in the current parameter group set is adjusted based on the number of globally optimal processes indicated by the globally optimal parameter group and the number of individually optimal processes indicated by the individually optimal parameter group matching the first sequence position. Optionally, the individually optimal parameter group for the parameter group at the first sequence position is the one that produces the best performance test result among all historical parameter configurations at that sequence position.
[0055] Assume the globally optimal parameter set is (P_{gbest}=8) and (T_{gbest}=16), and the individual optimal parameter set at the first sequence position is (P_{pbest}=5) and (T_{pbest}=10); the parameter set at the first sequence position in the current parameter set is (P_{current}=4) and (T_{current}=12).
[0056] Understandably, if (P_{current}) is lower than (P_{gbest}) and (P_{pbest}), it will move closer to both. It can also be set to prioritize, for example, (P_{gbest}) to guide it towards the global optimum. The adjusted (P_{new}) can be set as the arithmetic mean or weighted average of (P_{gbest}) and (P_{pbest}) to balance the influence of global orientation and historical optimum. (P_{new}) may be adjusted to a value in (6) or closer to (8). No specific restrictions are placed on the calculation formula here.
[0057] In step S2 above, the number of current threads indicated by the current parameter group that is in the first sequence position in the current parameter group set is adjusted according to the number of globally optimal threads indicated by the globally optimal parameter group and the number of individually optimal threads indicated by the individual optimal parameter group that matches the first sequence position.
[0058] Alternatively, based on the same method of adjusting the number of processes, (T_{gbest}) can be adjusted according to (T_{gbest}) and (T_{pbest}) to make it closer to (T_{gbest}), while taking into account the influence of (T_{pbest}) to ensure that the adjusted parameter set does not deviate too much from the historical optimal path.
[0059] In step S3 above, the above steps are repeated, adjusting the current number of processes and threads indicated by the current parameter set at each sequence position. Based on the above algorithm, the entire parameter set is traversed, and the same type of adjustment is performed on the parameter sets at the remaining sequence positions. In each traversal, the latest globally optimal parameter set and the individual optimal parameter set for each sequence position are used to dynamically update and gradually approach the globally optimal solution.
[0060] Through the implementation steps described in this application, after each iteration, the parameter set at each sequence position in the current parameter set is adjusted by comparing and comprehensively considering the information of the globally optimal parameter set and the individual optimal parameter set. This adjustment process follows the principle of dynamic optimization, guiding the parameter set to move in the direction that maximizes network card performance, while utilizing the historical information of the individual optimal parameter set to ensure the stability and comprehensiveness of the search process. Through continuous iteration and parameter adjustment, the algorithm can find the optimal configuration of the number of processes and threads in a high-dimensional parameter space, achieving precise optimization of network card performance.
[0061] In one optional implementation, the number of current processes indicated by the current parameter group at the first sequence position in the current parameter group set is adjusted based on the number of globally optimal processes indicated by the globally optimal parameter group and the number of individually optimal processes indicated by the individually optimal parameter group matching the first sequence position. This adjustment includes:
[0062] S1, determine the first adjustment difference based on the difference between the globally optimal number of processes matching the first sequence position and the current number of processes indicated by the current parameter group at the first sequence position;
[0063] S2, determine the second adjustment difference based on the difference between the optimal number of individual processes matching the first sequence position and the current number of processes indicated by the current parameter group at the first sequence position;
[0064] S3, determine the target process adjustment quantity based on the first adjustment difference and the second adjustment difference;
[0065] S4 calculates the sum of the target process adjustment quantity and the current process quantity.
[0066] The following describes steps S1-S4 using an optional implementation method:
[0067] Assume the number of globally optimal processes indicated by the globally optimal parameter set is (P_{gbest}=8), the number of current processes indicated by the current parameter set at the first sequence position is (P_{current}=4), and the first adjustment difference ΔP1=P_{gbest}-P_{current}=8-4=4.
[0068] Assuming the number of individual optimal processes indicated by the individual optimal parameter group matching the first sequence position is (P_{pbest}=6), the second adjustment difference ΔP2=P_{pbest}-P_{current}=6-4=2.
[0069] After determining the first and second adjustment differences, the number of adjustments to the target process can be determined through weighted averaging or other fusion strategies. For example, different weights can be assigned to the differences between the global optimum and the individual optimum to balance the contributions of global convergence and historical optima.
[0070] For example, the target adjustment quantity is calculated as follows: let Wg1 and Wp1 be the weights of the global optimal and individual optimal adjustment differences, respectively, and the target process adjustment quantity ΔPtarget = Wg1 × ΔP1 + Wp1 × ΔP2.
[0071] Process count update: Add the target process count adjustment to the current process count to get the adjusted process count Pnew = P_{current} + ΔPtarget.
[0072] Through the above implementation, the algorithm can dynamically adjust the number of processes in the first sequence position parameter group in the current parameter group set, guided by the globally optimal parameter group and the individual optimal parameter group. By comprehensively considering the global search direction and historical optimal paths, it helps the parameter group converge quickly to the optimal solution, improving the accuracy of the process and thread count parameter groups used to determine the optimal network card performance.
[0073] In one optional implementation, the number of current threads indicated by the current parameter group at the first sequence position in the current parameter group set is adjusted based on the number of globally optimal threads indicated by the globally optimal parameter group and the number of individually optimal threads indicated by the individually optimal parameter group matching the first sequence position. This adjustment includes:
[0074] S1, determine the third adjustment difference based on the difference between the globally optimal number of threads matching the first sequence position and the current number of threads indicated by the current parameter group at the first sequence position;
[0075] S2, determine the fourth adjustment difference based on the difference between the optimal number of individual threads matching the first sequence position and the current number of threads indicated by the current parameter group at the first sequence position;
[0076] S3, determine the target thread adjustment quantity based on the third adjustment difference and the fourth adjustment difference;
[0077] S4 calculates the sum of the target thread adjustment number and the current thread number.
[0078] The following describes steps S1-S4 using an optional implementation method:
[0079] Assume the number of globally optimal threads indicated by the globally optimal parameter group is (T_{gbest}=32), the number of current threads indicated by the parameter group currently in the first sequence position is (T_{current}=20), and the third adjustment difference ΔT1=T_{gbest}-T_{current}=32-20=12.
[0080] Assuming the number of individual optimal threads indicated by the individual optimal parameter group matching the first sequence position is (T_{pbest}=25), the fourth adjustment difference ΔT2=T_{pbest}-T_{current}=25-20=5.
[0081] After determining the third and fourth adjustment differences, the number of target thread adjustments is determined by weighted average or other fusion strategies. Assuming Wg2 corresponds to the global optimal weight and Wp2 corresponds to the individual optimal weight, the number of target thread adjustments ΔTtarget = Wg2 × ΔT1 + Wp2 × ΔT2.
[0082] Add the target thread count to the current thread count to get the adjusted thread count Tnew = T_{current} + ΔTtarget.
[0083] By using the above-described implementation method, the difference between the global optimal number of threads and the current number of threads is calculated, and the adjustment direction learned from the global optimal solution is determined. Furthermore, by comparing the individual optimal number of threads with the current number of threads, the adjustment direction based on the individual historical optimal solution is determined. This helps to avoid the algorithm being completely dominated by the global optimal solution and ignoring the potentially high-quality configurations that may exist in the individual historical path, thus solving the problem of inaccurate determination of the number of processes and threads in the prior art.
[0084] In one optional implementation, determining the initial performance test results of multiple initial parameter groups in the initial parameter group set includes:
[0085] Perform the following operation on each initial parameter set in the initial parameter set set:
[0086] S1, during the test operation, collects multiple instantaneous load status values of the communication device within the target acquisition period through a sliding window;
[0087] S2 determines the performance test results of the initial parameter group based on the average value of multiple instantaneous load state values.
[0088] Optionally, software tools (such as iperf3) are typically used to simulate data transmission and test the instantaneous load status of communication devices (such as network cards) under a parameter configuration of a given number of processes and threads. The instantaneous load status value is the real-time workload of the communication device within the collection period, reflecting data such as network throughput, latency, and packet loss rate. The target collection period is the time interval set for collecting the instantaneous load status.
[0089] As an optional implementation, first define the size of the sliding window, for example, 30 seconds. The window will continuously monitor the load status of the communication device. Start the test for the first initial parameter set in the initial parameter set, for example, setting the number of processes (P=2) and the number of threads (T=4). Within the target acquisition period, such as once per second, collect the instantaneous load status values of the network card, including data throughput, error rate, etc.
[0090] As time progresses, the data samples within the sliding window are continuously updated; new data is added, and the oldest data is removed, maintaining a constant window size. For example, if the data collection period is 30 seconds, and data is collected once per second, then 30 instantaneous load state values will be collected within the sliding window. Once all data within the sliding window has been collected, the average of these instantaneous load state values is calculated, for example, using the following formula to determine the performance test result:
[0091]
[0092] The `sar -n DEV 1` command can be executed on the server to collect data in real time (once per second), accurately reflecting the instantaneous load status of the network card under test; N is the duration of a single test (default 30 seconds), and short-term fluctuations are eliminated by averaging through a sliding window. For fitness, the network card utilization rate is collected as the fitness value, and then the current individual optimal solution and the global optimal solution can be calculated.
[0093] It should be noted that the above-described embodiments described in this application continuously collect the instantaneous load status of the device during the test process through a sliding window, thereby eliminating the impact of instantaneous fluctuations on the performance test results, ensuring the stability and reliability of the data, further improving the accuracy of determining the global optimal parameter set and the individual optimal parameter set, and thus improving the accuracy of updating the parameter set results based on the global optimal parameter set and the individual optimal parameter set.
[0094] In one alternative implementation, determining that the current performance test results meet the target performance conditions includes at least one of the following:
[0095] Method 1: If the current performance test result in the current parameter set matches the target sequence position and indicates that the utilization rate of the communication device is greater than the first threshold, then the current performance test result is determined to meet the target performance condition.
[0096] Method 2: During the iteration process, if the utilization rate of the communication device in the performance test result set that matches the target sequence position is greater than the second threshold and satisfies the consecutive target number, then the current performance test result is determined to meet the target performance condition.
[0097] Method 3: If the rate of change between the current performance test result and the initial performance test result that matches the target sequence position is less than the third threshold, the current performance test result is determined to meet the target performance condition.
[0098] Optionally, in the above method one, if the current performance test result matching the target sequence position in the current parameter set indicates that the utilization rate of the communication device is greater than a first threshold, it is determined that the current performance test result meets the target performance condition; for example, after the latest iteration, the performance test result (the utilization rate index of the communication device) is obtained from the parameter set of the target sequence position; it is checked whether the current utilization rate exceeds the first threshold (e.g., 99.5%), and if it does, the current performance test result is considered to meet the target performance condition.
[0099] The implementation method described in Method 1 ensures that the configuration of resource scheduling parameters (such as the number of processes and threads) enables the device's performance to approach or reach its theoretical limit, and provides real-time feedback on whether the configuration is reasonable, thus accelerating the process of reaching the optimal configuration.
[0100] Optionally, in the above-mentioned Method 2, during the iteration process, if the utilization rate of the communication device in the set of performance test results matching the target sequence position is greater than the second threshold and meets the consecutive target number, it is determined that the current performance test result meets the target performance condition; for example, in the process of multiple iterations, the performance test results matching the target sequence position are continuously collected to form a sequence, and it is checked whether there are test results with consecutive target number (N times, for example, N=3) in the sequence, in which the utilization rate of the communication device exceeds the second threshold (assuming it is 90%). If so, it means that the performance has reached and maintained a high stable level in the continuous iterations, and meets the target performance condition.
[0101] The implementation method described in Method 2 avoids the mistaken identification of temporary performance improvements caused by fluctuations in the test environment or randomness of the algorithm as the result of stable optimization. By evaluating the continuous test results, the effectiveness of resource scheduling parameter adjustment is verified, the reliability of parameter configuration is improved, and the continuous stability of equipment performance is ensured.
[0102] Optionally, in Method 3 above, if the rate of change between the current performance test result matching the target sequence position and the initial performance test result is less than a third threshold, the current performance test result is determined to meet the target performance condition. The current performance test result at the target sequence position is compared with the initial performance test result, and the rate of change in utilization is calculated, for example, rate of change = (current utilization - initial utilization) / initial utilization. It is then determined whether the rate of change is less than the third threshold (e.g., 0.05%). If the rate of change is less than the third threshold, the change in the current performance test result is considered to be relatively stable, meeting the target performance condition (meeting the convergence condition, the iteration process can be stopped).
[0103] Assuming the initial test result shows a network card utilization rate of 85%, the current test result is 84.9%, and the third threshold is 0.05%, then the rate of change is (84.9–85) / 85 = -0.117647%, which is less than 0.05%, satisfying the condition that the performance change rate is less than the third threshold. Therefore, the current performance test result meets the target performance condition.
[0104] The implementation method described in Method 3 overcomes the over-optimization problem in existing technologies, where parameter adjustments no longer significantly improve performance, but resource consumption and testing time continue to increase. By setting a change rate threshold, it is possible to determine whether the optimization process has made substantial progress, avoiding invalid iterations and improving optimization efficiency and accuracy.
[0105] It should also be noted that this application can set an iteration number threshold, and even if the performance test conditions are not met, the configuration parameters will stop being updated after the iteration number threshold is reached.
[0106] The following describes a complete implementation of the method for determining the number of processes and threads parameter groups described in this application, such as... Figure 3 As shown:
[0107] S302, Initialize the particle swarm. Define each particle as a two-dimensional vector (P,T), where P represents the number of ports (corresponding to the number of processes) in the iperf3 test, and T represents the number of parallel threads.
[0108] S304, start the test and collect data using Util. The fitness function is based on network card utilization: , The `sar -n DEV 1` command can be executed on the server to collect data in real time (once per second), accurately reflecting the instantaneous load status of the network card under test; N is the duration of a single test (default 30 seconds), and short-term fluctuations are eliminated by averaging through a sliding window. To assess fitness, network interface card (NIC) utilization is used as the fitness metric, which allows for the calculation of the current individual optimal solution and the global optimal solution. This design shifts the parameter optimization objective from "maximum bandwidth" to "saturated utilization of NIC resources," better aligning with the essence of hardware performance.
[0109] Specifically, check S306: Util ≥ 99.5%? That is, does the network card performance meet the requirements? If it does, execute S306-1 and output the optimal configuration. If it does not meet the requirements, check S308: Has the maximum number of iterations been reached? If the maximum number of iterations has been reached, execute S308-1 and output the current optimal configuration. If the maximum number of iterations has not been reached, continue updating the configuration parameters, i.e., execute S310 to update the particle velocity and position.
[0110] Specifically, the algorithm can employ an improved particle swarm optimization process: during the initialization phase, 10 particles are randomly generated (P∈[1,16], T∈[1,64]), and in each iteration, the particle velocity and position are updated using the following formula:
[0111] ;
[0112] ;
[0113] Where w is the inertia weight, c1 and c2 are learning factors, r1 and r2 are random numbers, pbest is the individual optimal solution, which is the historical optimal solution of the individual particle, and gbest is the global optimal solution, which reflects the optimal solution of the current population. Let $\frac{j}{j}$ be the velocity of the $j$-th particle after the (k+1)th iteration. The speed of the previous iteration, Let be the position of the j-th particle after the (k+1)-th iteration. This represents the position of the previous iteration.
[0114] It should be noted that in this application, the position of each particle represents a combination of the number of ports (processes P) and the number of threads (T), representing a candidate solution to the optimization problem. The number of ports ranges from 1 to 16, and the number of threads ranges from 1 to 64. For example, if the position of particle 1 is [2,4], it means that the number of ports P is 2 and the number of threads T is 4. The speed of the particle determines the search direction and step size of the particle in the solution space, indicating how to adjust the size of the number of ports and the number of threads.
[0115] For example, after the first iteration, the parameter set (P,T) corresponding to particle 1, i.e., the parameter set at the first sequence position, is (2,4). At this time, the global optimal solution (i.e., the parameter set with the highest network card utilization) corresponds to (4,10), and the individual optimal solution for particle 1 at the first sequence position is (3,6). Taking the number of update processes as an example, the number of processes can be adjusted in the next iteration using the following formula:
[0116] =w× +c1×r1×(4-2)+c2×r2×(3-2);
[0117] Updated number of processes =2+ The same applies to updating the number of threads.
[0118] S312, Boundary Constraint Processing. Specifically, to ensure the engineering feasibility of the parameter combination, real-time boundary processing is performed on the updated particle positions: P=min(max(round(P),1),16), T=min(max(round(T),1),64). The round() function integerizes the parameters, and [1,16] and [1,64] represent the reasonable engineering ranges for the number of ports and threads, respectively. Through this mechanism, the parameter combination generated by the algorithm can maximize network card utilization while avoiding test anomalies such as port exhaustion and thread overruns.
[0119] To balance convergence speed and testing efficiency, a dual-threshold termination condition is designed: Performance saturation termination: When the global optimal fitness is ≥99.5% (network card utilization is close to the physical limit), the (P,T) combination is immediately output; Iteration limit termination: If the maximum number of iterations (default 30) is reached and the system is still not saturated, the optimal solution in the iteration process is output to avoid getting stuck in an infinite loop.
[0120] For example, first, the population is initialized, resulting in a set of combinations of P and T, such as particle 1 being [2,3], particle 2 being [6,3], particle 3 being [5,8], and so on. Each combination corresponds to a network card utilization rate of 55%, 60%, 70%, etc., obtained from testing. In the initial iteration, the individual optimal solution is the optimal solution for each particle in the history. Thus, the individual optimal solution for particle 1 is [2,3], for particle 2 it is [6,3], and for particle 3 it is [5,8]. The global optimal solution for the particles is the particle corresponding to a network card utilization rate of 70%, i.e., [5,8]. The number of processes P is 5, and the number of threads T is 8.
[0121] In the next iteration, by calculation, if the velocity of particle 1 is [-1,1], the velocity of particle 2 is [1,1], the velocity of particle 3 is [2,2], and so on, then the next particle positions are: particle 1 is [1,4], particle 2 is [7,4], and particle 3 is [7,10]. Each solution is tested to obtain network card utilization rates of 50%, 80%, and 65%, respectively. Comparing the network card utilization rates of the two iterations, the individual optimal solutions for each particle are updated: particle 1 is [2,3], particle 2 is [7,4], and particle 3 is [5,8]. At this point, the global optimal solution is updated to [7,4]. Based on the individual optimal solutions and the global optimal solution, the particle velocities are calculated again, and the next particle positions are updated. Through this particle update method, the optimal solution is continuously obtained.
[0122] According to another aspect of the embodiments of this application, an apparatus for determining the process number and thread number parameter group for implementing the above-described method for determining the process number and thread number parameter group is also provided. For example... Figure 4 As shown, the device includes:
[0123] The first determining module 402 determines the globally optimal parameter set in the initial parameter set based on the initial performance test results of multiple initial parameter sets in the initial parameter set. The initial performance test results are used to indicate the operation of the communication device when the first number of processes and the second number of threads are created based on the first number of processes and the second number of threads indicated by the initial parameter set, and the second number of threads are created for each process.
[0124] The dynamic optimization module 404 adjusts the number of first processes and the number of second threads of each of the multiple initial parameter groups according to the number of globally optimal processes and the number of globally optimal threads indicated by the globally optimal parameter group, so as to obtain the adjusted current parameter group set.
[0125] The second determining module 406 determines the current performance test results corresponding to each of the multiple current parameter groups in the current parameter group set;
[0126] The termination judgment module 408 determines the current parameter group whose current performance test results meet the target performance conditions as the target parameter group.
[0127] Optionally, the second determining module 406 mentioned above includes: a third determining unit, used to determine the individual optimal parameter group matching the first sequence position based on the performance test results of the initial parameter group in the initial parameter group set at the first sequence position and the current performance test results of the current parameter group in the current parameter group set at the first sequence position; repeating the above steps to determine the individual optimal parameter group matching each sequence position in turn.
[0128] Optionally, the third determining unit includes an adjustment unit, configured to adjust the number of current processes indicated by the current parameter group at the first sequence position in the current parameter group set according to the number of globally optimal processes indicated by the globally optimal parameter group and the number of individually optimal processes indicated by the individually optimal parameter group matching the first sequence position; adjust the number of current threads indicated by the current parameter group at the first sequence position in the current parameter group set according to the number of globally optimal threads indicated by the globally optimal parameter group and the number of individually optimal threads indicated by the individually optimal parameter group matching the first sequence position; repeat the above steps to adjust the number of current processes and the number of current threads indicated by the current parameter group at each sequence position in turn.
[0129] Optionally, the aforementioned adjustment unit is configured to: determine a first adjustment difference based on the difference between the number of globally optimal processes matching the first sequence position and the number of current processes indicated by the current parameter group at the first sequence position; determine a second adjustment difference based on the difference between the number of individually optimal processes matching the first sequence position and the number of current processes indicated by the current parameter group at the first sequence position; determine a target process adjustment quantity based on the first adjustment difference and the second adjustment difference; and sum the target process adjustment quantity with the current process quantity.
[0130] Optionally, the aforementioned adjustment unit is used to determine a third adjustment difference based on the difference between the globally optimal number of threads matching the first sequence position and the current number of threads indicated by the current parameter group at the first sequence position; determine a fourth adjustment difference based on the difference between the individually optimal number of threads matching the first sequence position and the current number of threads indicated by the current parameter group at the first sequence position; determine the target thread adjustment quantity based on the third and fourth adjustment differences; and sum the target thread adjustment quantity with the current thread quantity.
[0131] Optionally, the first determining module 402 is further configured to perform the following operations on each initial parameter group in the initial parameter group set: when performing the test operation, collect multiple instantaneous load state values of the communication device within the target acquisition period through a sliding window; and determine the performance test result of the initial parameter group based on the average value of the multiple instantaneous load state values.
[0132] Optionally, the third determining unit is further configured to: determine that the current performance test result meets the target performance condition if the utilization rate of the communication device is greater than a first threshold when the current performance test result matching the target sequence position in the current parameter set indicates that the current performance test result meets the target performance condition; determine that the current performance test result meets the target performance condition if, during the iteration process, the utilization rate of the communication device in the performance test result set matching the target sequence position is greater than a second threshold and meets the target number of consecutive iterations; and determine that the current performance test result meets the target performance condition if the rate of change between the current performance test result matching the target sequence position and the initial performance test result is less than a third threshold.
[0133] For a description of the features of the apparatus corresponding to the method for determining the number of processes and threads in the embodiment, please refer to the relevant description of the embodiment corresponding to the method for determining the number of processes and threads in the embodiment, which will not be repeated here.
[0134] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above-described method embodiments for determining the number of processes and the number of threads parameter groups.
[0135] The electronic device used in this application can be a terminal device or a server. This embodiment uses a mobile phone or computer as an example for illustration. Figure 5 As shown, the electronic device includes a memory 502 and a processor 504. The memory 502 stores a computer program, and the processor 504 is configured to execute the steps of any of the above method embodiments through the computer program.
[0136] Optionally, in this embodiment, the aforementioned electronic device may be located in at least one of a plurality of network devices in a computer network.
[0137] Alternatively, as those skilled in the art will understand, Figure 5 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones (such as Android phones, iOS phones, etc.), tablets, PDAs, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 4 This does not limit the structure of the aforementioned electronic devices. For example, the electronic device may also include components that are more... Figure 5 The more or fewer components shown (such as network interfaces, etc.), or having the same Figure 5 The different configurations shown.
[0138] The memory 502 can be used to store software programs and modules, such as the program instructions / modules corresponding to the method and apparatus for determining the number of processes and threads parameter groups in this embodiment. The processor 504 executes various functional applications by running the software programs and modules stored in the memory 502, thereby implementing the aforementioned method for determining the number of processes and threads parameter groups. The memory 502 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 502 may further include memory remotely located relative to the processor 504, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Specifically, the memory 502 may be used, but is not limited to, for storing information such as signals and data. As an example, such as... Figure 5 As shown, the memory 502 may include, but is not limited to, the first determining module 402, dynamic optimization module 404, second determining module 406, and termination determination module 408 from the device for determining the number of processes and threads parameter groups. Furthermore, it may include, but is not limited to, other module units from the device for determining the number of processes and threads parameter groups, which will not be elaborated upon in this example.
[0139] Optionally, the transmission device 506 described above is used to receive or send data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission device 506 includes a Network Interface Controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. In another example, the transmission device 506 is a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0140] In addition, the above-mentioned electronic device also includes: a display 508; and a connection bus 510 for connecting the various module components in the above-mentioned electronic device.
[0141] In other embodiments, the aforementioned terminal device or server can be a node in a distributed system, wherein the distributed system can be a blockchain system, which is a distributed system formed by connecting multiple nodes through network communication. The nodes can form a point-to-point network, and any form of computing device, such as a server, terminal, or other electronic device, can become a node in the blockchain system by joining this point-to-point network.
[0142] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above-described method embodiments for determining the number of processes and the number of threads parameter groups when it is run.
[0143] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0144] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described methods for determining the number of processes and the number of threads parameter groups.
[0145] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above-described method embodiments for determining the number of processes and the number of threads parameter groups.
[0146] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0147] The foregoing has provided a detailed description of the method, apparatus, storage medium, and electronic device for determining parameter sets for the number of processes and threads, as provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only intended to aid in understanding the method and core ideas of this application. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A method for determining a parameter set for the number of processes and threads, characterized in that, include: Based on the initial performance test results of multiple initial parameter groups in the initial parameter group set, the globally optimal parameter group in the initial parameter group set is determined, wherein the initial performance test results are used to indicate the operation of the communication device when the first number of processes and the second number of threads are created based on the first number of processes and the second number of threads indicated by the initial parameter group, and the second number of threads are created for each of the processes. Based on the globally optimal number of processes and the globally optimal number of threads indicated by the globally optimal parameter group, the number of the first process and the number of the second thread of each of the multiple initial parameter groups are adjusted to obtain the adjusted current parameter group set; Determine the current performance test results corresponding to each of the multiple current parameter groups in the current parameter group set; The current parameter set whose current performance test results meet the target performance conditions is determined as the target parameter set.
2. The method according to claim 1, characterized in that, After determining the current performance test results corresponding to each of the multiple current parameter groups in the current parameter group set, the process includes: Based on the performance test results of the initial parameter group in the initial parameter group set that is in the first sequence position, and the current performance test results of the current parameter group in the current parameter group set that is in the first sequence position, determine the individual optimal parameter group that matches the first sequence position; Repeat the above steps to determine the optimal parameter set for each individual that matches each sequence position.
3. The method according to claim 2, characterized in that, After determining the optimal set of parameters for the individual that matches each sequence position, the process includes: Based on the number of globally optimal processes indicated by the globally optimal parameter group and the number of individually optimal processes indicated by the individually optimal parameter group that matches the first sequence position, the number of current processes indicated by the current parameter group that is in the first sequence position in the current parameter group set is adjusted. Based on the number of globally optimal threads indicated by the globally optimal parameter group and the number of individually optimal threads indicated by the individual optimal parameter group that matches the first sequence position, the number of current threads indicated by the current parameter group that is in the first sequence position in the current parameter group set is adjusted. Repeat the above steps to adjust the number of current processes and the number of current threads indicated by the current parameter group at each sequence position.
4. The method according to claim 3, characterized in that, Based on the number of globally optimal processes indicated by the globally optimal parameter group and the number of individually optimal processes indicated by the individually optimal parameter group matching the first sequence position, the number of current processes indicated by the current parameter group in the current parameter group set at the first sequence position is adjusted, including: A first adjustment difference is determined based on the difference between the globally optimal number of processes matching the first sequence position and the current number of processes indicated by the current parameter group at the first sequence position; A second adjustment difference is determined based on the difference between the optimal number of processes of the individual matching the first sequence position and the current number of processes indicated by the current parameter group at the first sequence position; The target process adjustment quantity is determined based on the first adjustment difference and the second adjustment difference; The number of adjustments to the target process is summed with the number of current processes.
5. The method according to claim 3, characterized in that, Based on the globally optimal thread count indicated by the globally optimal parameter group and the individually optimal thread count indicated by the individually optimal parameter group matching the first sequence position, the current thread count indicated by the current parameter group in the current parameter group set at the first sequence position is adjusted, including: A third adjustment difference is determined based on the difference between the globally optimal number of threads matching the first sequence position and the current number of threads indicated by the current parameter group at the first sequence position; A fourth adjustment difference is determined based on the difference between the individual optimal thread count matching the first sequence position and the current thread count indicated by the current parameter group at the first sequence position; The target thread adjustment quantity is determined based on the third adjustment difference and the fourth adjustment difference; The target thread adjustment quantity is summed with the current thread quantity.
6. The method according to claim 1, characterized in that, Determine the initial performance test results for multiple initial parameter sets within the initial parameter set set, including: For each of the initial parameter sets in the set of initial parameter sets, the following operation is performed: During the test operation, multiple instantaneous load status values of the communication device are collected through a sliding window within the target collection period; The performance test result of the initial parameter group is determined based on the average of multiple instantaneous load state values.
7. The method according to claim 2, characterized in that, Determining that the current performance test results meet the target performance conditions includes at least one of the following: If the current performance test result, which matches the target sequence position in the current parameter set, indicates that the utilization rate of the communication device is greater than a first threshold, then the current performance test result is determined to meet the target performance condition. During the iteration process, if the utilization rate of the communication device is greater than the second threshold and the number of consecutive target values is met in the performance test result set that matches the target sequence position, it is determined that the current performance test result meets the target performance condition. If the rate of change between the current performance test result matching the target sequence position and the initial performance test result is less than a third threshold, the current performance test result is determined to meet the target performance condition.
8. An apparatus for determining a parameter set of process number and thread number, characterized in that, include: The first determining module determines the globally optimal parameter set in the initial parameter set based on the initial performance test results of multiple initial parameter sets in the initial parameter set. The initial performance test results are used to indicate the operation of the communication device when the first number of processes and the second number of threads are created based on the first number of processes and the second number of threads indicated by the initial parameter set, and the second number of threads are created for each process. The dynamic optimization module adjusts the number of the first process and the number of the second thread for each of the multiple initial parameter groups according to the number of the globally optimal process and the number of the globally optimal thread indicated by the globally optimal parameter group, to obtain the adjusted current parameter group set. The second determining module determines the current performance test results corresponding to each of the multiple current parameter groups in the current parameter group set; The termination judgment module determines the current parameter group whose current performance test results meet the target performance conditions as the target parameter group.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method as claimed in any one of claims 1 to 7.