In a dynamic server, CPUVP (cpu virtual processor) is a multi-threaded process that runs on the processor until the following situations occur:
1. CPUVP has no task to do, for example, there is no clue to wait for execution in the ready queue.
2. The operating system forces the CPUVP to give the CPU to other processes.
To optimize throughput, you need to set NUMCPUVPS to the minimum number of tasks that can be processed normally. This number should be less than or equal to the number of CPUs in the system, we recommend that you do not set the number of CPUVP to be greater than the number of available CPUs. If the number of CPUVP cannot meet the requirements, this means you need to improve the CPU performance to solve the problem. Only when another CPU exists can the problem be solved by adding CPUVP. You can also stop other tasks in the system and release the CPU cycle for the virtual processor to improve performance.
Increasing the number of CPUVP without increasing the CPU will only cause more serious problems and lead to more CPU competition. In this way, the operating system will do more work to schedule competition for these CPUs, the result is that the cpu vp is heavier, and context switching is increased, which not only consumes time but also consumes more CPU.
Because the system is not only a CPUVP, but also other processes apply for a CPU cycle, in some multi-processor systems, NUMCPUVPS should be less than the total number of CPUs, for multi-processor systems, we recommend that you set NUMCPUVPS as follows: NUMCPUVPS = Total number of CPUs-1
Run onstat-grea to check the ready queue and check whether the CPU cannot undertake the task. The clues of the ready queue are the clues to be executed. If the number of clues in the ready queue starts to increase rapidly, the CPUVP can no longer undertake such heavy tasks. It is normal to see several readiness clues on the adjusted system, or to increase some clues at the beginning of the test. It is reasonable to have a readiness clue on each CPUVP.
In addition, check the cpu vp usage. If the cpu vp cannot keep up with the task growth, the virtual processor is saturated. You can use the onstat-gglo command to monitor the usage of the virtual processor, if the sum of the time used by the system and the CPUVP is close to the test time, the CPUVP is saturated. If the NUMCPUVPS value is lower than the number of CPUs in the system, you can add a CPUVP, but do not exceed the total number of CPUs in the system.
Note: In a multi-processor system, the CPU time that can be used is equal to the number of processors multiplied by the test time. a cpuvp cannot consume more than one processor at a certain time, therefore, the total CPU ratio of a cpuvp is no more than 100% of the test time.
If the CPU resources in the system are saturated and the workload cannot be reduced or the resources can be increased, you can reduce NUMCPUVPS to improve performance. However, this change only takes effect when CPUVP urgently needs CPU resources of other virtual processors or processes. Reduce one CPUVP each time, and set NUMCPUVPS to a value greater than 0.
For developers: When the CPUVP is not congested, it is doing useful work and can well manage the running of its clues. At this moment, the system is in the optimal state. For example, if the process needs to sleep to wait for the completion of I/O or the lock to be released, rather than waiting for other clues to run, each CPU may have multiple cpuvpns, to obtain the maximum throughput. However, using multi-CPUVP reduces system efficiency because the system not only has to spend a lot of money to handle context switching, but also has to pay a price for competition in the fast cache of growing processors. We should ensure that the thread of cyclic execution gives the CPU more clues to work. Finally, avoid using the operating system directly. For example, other problems may occur when the number of CPUVP is used to determine the number of threads that are not responsible for CPU activity. The system administrator needs to monitor the system and increase the number of CPUVP if the CPU is idle.
Multi-clue background information
The two responsibilities of the operating system are to improve the utilization of CPU resources and ensure that processes can access resources equally. The operating systems are different, but processes run on the CPU until the following events occur.
1. process ended
2. The process must wait for some events, such as the completion of a disk I/O.
3. The process exceeds the time slice allocated to it, and other processes are waiting for execution.
4. If a process with a higher priority needs to use the CPU, the process must immediately discard the CPU usage.
When one of these conditions occurs, the operating system stops the processes executed on the CPU, retains the status of important processes, and starts to execute another process. This is a well-known context switch. The principle is that the CPU will never be idle at work. The concept of multi-clue is basically the same. The main difference is that the work is divided into various clues, which are also called Lightweight processes), while the virtual processor performs task switching between clues, for example, when a clue needs to wait for a disk I/O to complete, CPUVP retains its context, selects a new clue from the ready queue for execution, and loads the context of the new clue, starting from the new program address, thread switching is more efficient than process context switching.