Udp receives the data, to carry on the processing, computational cost is larger, how to use multi-core processing? Now I use the threadpool processing can only use a CPU cores
CodePudding user response:
C #, with TPL, namely the tasks below Parallel invocation, such as the Parallel. The For
CodePudding user response:
How do you know a CPU cores were used?
Multi-threading does not necessarily fast, if you are a dual-core, best four threads
CodePudding user response:
reference 1st floor caozhy response: , c # using the TPL, namely the tasks below Parallel invocation, such as the Parallel. For Business process play simple say like that, I receive packets around 4000 packages per second, each packet json processing, take the time information, then send the processing, I use the parallel for and foreach all don't know how to write CodePudding user response:
refer to the second floor of autumn red fruit response: how do you know a CPU cores were used? Multi-threading does not necessarily fast, if you are a dual-core, best to open four threads Computer CPU for six nuclear data backlog, observation is only about 16% of the CPU performance CodePudding user response:
Will receive the package cache to safety in the queue, for 12 threads (quantity will be subject to test is the best), from the security queue data concurrency CodePudding user response:
Currently USES is concurrentqueue, use threadpool processing queue data, limitation lies in the processing of large amount of calculation, the problem is how to call more CPU to calculate CodePudding user response:
Personally, CPU scheduling is the business of operating system CPU utilization is low, there may be a bottleneck problem, such as memory, when sending the network speed, etc. You can use the similar loadrunner tools for testing CodePudding user response:
See # 1,