Provided in the present application are a method and apparatus for solving an
IPSec elephant flow on the basis of a DPDK. The method comprises: on the basis of a configuration file, initializing a CPU0 and a CPU1 into PMD thread cores, and initializing CPU2-CPU4 into
encryption / decryption engine operation cores, creating lock-free rings for communication between the PMD thread cores and the
encryption / decryption engine operation cores, and establishing a network card sending
queue and a network card receiving
queue; the PMD thread cores regularly executing
polling operations, acquiring messages, detecting an
elephant flow and a common flow, performing load balancing on the
elephant flow, and distributing the messages to the
encryption / decryption engine operation cores; and encrypting / decrypting the messages in the encryption / decryption engine operation cores, then sending the messages to the CPU1 for sorting, and then sending the messages to the network card sending
queue. In this way, the detection of an elephant flow is realized, and multi-core
IPSec encryption / decryption is performed on the elephant flow to solve the performance
bottleneck of a single-core processor. The present application can be applied to wider application scenarios.