我要评分
获取效率
正确性
完整性
易理解

Principles

In traditional network forwarding paths, packets typically traverse multiple stages, including user-space applications, the socket layer, the TCP/IP stack, Netfilter, routing lookup, queue scheduling, and driver reception/transmission. For scenarios such as proxy forwarding, transparent forwarding, gateways, container networks, and service meshes, some traffic exhibits well-defined forwarding relationships and stable connection states. Repeatedly subjecting such traffic to the full protocol stack processing incurs unnecessary CPU overhead and increases end-to-end latency. HiSock uses eBPF programs to identify connections that can be accelerated, and uses the connection context on the kernel side to record the destination route, inbound interface, and Ethernet header information. When the acceleration conditions are met, it quickly redirects packets, improving network throughput and forwarding efficiency.

HiSock does not change the socket APIs of service applications, and the code of service programs does not need to be modified. You can use the example tool hisock_cmd to load the HiSock BPF programs and specify the cgroup, NIC interface, and range of ports to be accelerated. You can also enable the BPF programs to automatically learn the ports to be listened on based on the process name, so that the acceleration capability can be enabled for the target connection.

Figure 1 shows the principles of the HiSock feature.

Figure 1 eBPF-based HiSock solution