diff --git a/.gitignore b/.gitignore index 0fd2fc2dbe9..4aadccbc9d3 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ target/ /agent/src/ebpf/kernel/*.ll /agent/src/ebpf/kernel/*.objdump /agent/src/ebpf/kernel/*.elf +/agent/src/ebpf/kernel/build/ /agent/src/ebpf/user/socket_trace_bpf_5_2.c /agent/src/ebpf/user/socket_trace_bpf_core.c /agent/src/ebpf/user/socket_trace_bpf_common.c @@ -39,6 +40,7 @@ target/ /agent/src/ebpf/user/socket_trace_bpf_kylin.c /agent/src/ebpf/user/perf_profiler_bpf_common.c /agent/src/ebpf/user/af_packet_fanout_bpf_common.c +/agent/src/ebpf/user/extended/*_bpf_common.c /agent/src/ebpf/user/deepflow_ebpfctl_bin.c /agent/src/ebpf/user/profile/java_agent_so_gnu.c /agent/src/ebpf/user/profile/java_agent_so_musl.c diff --git a/agent/src/config/config.rs b/agent/src/config/config.rs index 7c36a017a7a..3940b09e98a 100644 --- a/agent/src/config/config.rs +++ b/agent/src/config/config.rs @@ -23,8 +23,15 @@ use std::net::{IpAddr, ToSocketAddrs}; use std::path::Path; use std::time::Duration; +#[cfg(feature = "extended_observability")] +use std::ffi::CString; + #[cfg(any(target_os = "linux", target_os = "android"))] use envmnt::{ExpandOptions, ExpansionType}; +#[cfg(feature = "extended_observability")] +use libc::c_int; +#[cfg(feature = "extended_observability")] +use log::warn; use log::{debug, error, info}; use md5::{Digest, Md5}; #[cfg(any(target_os = "linux", target_os = "android"))] @@ -39,6 +46,9 @@ use tokio::runtime::Runtime; use crate::common::l7_protocol_log::{L7ProtocolBitmap, L7ProtocolParser}; use crate::dispatcher::recv_engine::DEFAULT_BLOCK_SIZE; +#[cfg(any(target_os = "linux", target_os = "android"))] +#[cfg(feature = "extended_observability")] +use crate::ebpf; use crate::flow_generator::{DnsLog, MemcachedLog}; #[cfg(any(target_os = "linux", target_os = "android"))] use crate::platform::{OsAppTag, ProcessData}; @@ -1235,6 +1245,97 @@ impl Default for EbpfTunning { } } +#[derive(Clone, Debug, Deserialize, PartialEq, Eq)] +#[serde(default)] +pub struct NicOptimizeConfig { + pub interface: String, + pub rx_ring_size: u64, + pub rss_channel_count: u64, + pub irq_cpu_list: String, + pub xdp_cpu_redirect: bool, + pub xdp_queue_size: u64, + pub xdp_cpu_redirect_list: String, +} + +const XDP_QUEUE_SIZE_MIN: u64 = 512; +const XDP_QUEUE_SIZE_MAX: u64 = 8192; + +impl Default for NicOptimizeConfig { + fn default() -> Self { + Self { + interface: "".to_string(), + rx_ring_size: 0, + rss_channel_count: 0, + irq_cpu_list: "".to_string(), + xdp_cpu_redirect: false, + xdp_queue_size: 2048, + xdp_cpu_redirect_list: "".to_string(), + } + } +} + +impl NicOptimizeConfig { + #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(feature = "extended_observability")] + pub fn apply(&self) { + let to_cstring = |field: &str, value: &str| { + CString::new(value) + .map_err(|_| { + warn!( + "Skip NIC optimization for interface {:?}: {} contains NUL byte", + self.interface, field + ); + }) + .ok() + }; + + let Some(nic_name) = to_cstring("interface", self.interface.as_str()) else { + return; + }; + let Some(irq_cpu) = to_cstring("irq_cpu_list", self.irq_cpu_list.as_str()) else { + return; + }; + let Some(xdp_cpu) = + to_cstring("xdp_cpu_redirect_list", self.xdp_cpu_redirect_list.as_str()) + else { + return; + }; + + let ret = unsafe { + ebpf::nic_optimize_config( + nic_name.as_ptr(), + self.rx_ring_size as c_int, + self.rss_channel_count as c_int, + irq_cpu.as_ptr(), + self.xdp_cpu_redirect, + self.xdp_queue_size as c_int, + xdp_cpu.as_ptr(), + ) + }; + + if ret != 0 { + warn!( + "Failed to configure NIC optimization for interface '{}' \ + (ret={}, rx_ring_size={}, rss_channel_count={}, \ + xdp_cpu_redirect={}, xdp_queue_size={})", + self.interface, + ret, + self.rx_ring_size, + self.rss_channel_count, + self.xdp_cpu_redirect, + self.xdp_queue_size, + ); + } + } +} + +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Eq)] +#[serde(default)] +pub struct EbpfNetwork { + pub nic_opt_enabled: bool, + pub nic_optimize: Vec, +} + #[derive(Clone, Debug, Deserialize, PartialEq, Eq)] #[serde(default)] pub struct EbpfSocketPreprocess { @@ -1285,6 +1386,7 @@ pub struct Ebpf { pub file: EbpfFile, pub profile: EbpfProfile, pub tunning: EbpfTunning, + pub network: EbpfNetwork, #[serde(skip)] pub java_symbol_file_refresh_defer_interval: i32, } @@ -1297,6 +1399,7 @@ impl Default for Ebpf { file: EbpfFile::default(), profile: EbpfProfile::default(), tunning: EbpfTunning::default(), + network: EbpfNetwork::default(), java_symbol_file_refresh_defer_interval: 60, } } @@ -3219,6 +3322,15 @@ impl UserConfig { ))); } + for nic in &self.inputs.ebpf.network.nic_optimize { + if !(XDP_QUEUE_SIZE_MIN..=XDP_QUEUE_SIZE_MAX).contains(&nic.xdp_queue_size) { + return Err(ConfigError::RuntimeConfigInvalid(format!( + "xdp_queue_size {} for interface {} not in [{}, {}]", + nic.xdp_queue_size, nic.interface, XDP_QUEUE_SIZE_MIN, XDP_QUEUE_SIZE_MAX, + ))); + } + } + Ok(()) } diff --git a/agent/src/config/handler.rs b/agent/src/config/handler.rs index 2b6468c3bfd..dc361cd8d53 100755 --- a/agent/src/config/handler.rs +++ b/agent/src/config/handler.rs @@ -3553,6 +3553,26 @@ impl ConfigHandler { restart_agent = !first_run; } + // The hot-update configuration items in ebpf.network are handled within the set_ebpf() callback. + let network = &mut ebpf.network; + let new_network = &mut new_ebpf.network; + + if network.nic_opt_enabled != new_network.nic_opt_enabled { + info!( + "Update inputs.ebpf.network.nic_opt_enabled from {:?} to {:?}.", + network.nic_opt_enabled, new_network.nic_opt_enabled + ); + network.nic_opt_enabled = new_network.nic_opt_enabled; + } + + if network.nic_optimize != new_network.nic_optimize { + info!( + "Update inputs.ebpf.network.nic_optimize from {:?} to {:?}.", + network.nic_optimize, new_network.nic_optimize + ); + network.nic_optimize = new_network.nic_optimize.clone(); + } + let kprobe = &mut ebpf.socket.kprobe; let new_kprobe = &mut new_ebpf.socket.kprobe; if kprobe.disabled != new_kprobe.disabled { diff --git a/agent/src/ebpf/Makefile b/agent/src/ebpf/Makefile index 687c5a7bb45..10d4421f710 100644 --- a/agent/src/ebpf/Makefile +++ b/agent/src/ebpf/Makefile @@ -158,7 +158,7 @@ PERF_PROFILER_ELFS := user/perf_profiler_bpf_common.c \ user/perf_profiler_bpf_5_2_plus.c \ user/perf_profiler_bpf_5_15_plus.c -ELFFILES := $(SOCKET_TRACE_ELFS) $(PERF_PROFILER_ELFS) $(AF_PACKET_FANOUT_ELFS) $(TCP_OPTION_TRACING_ELFS) +ELFFILES := $(SOCKET_TRACE_ELFS) $(PERF_PROFILER_ELFS) $(EXTEND_ELFS) tools/bintobuffer: $(call msg,TOOLS,tools/bintobuffer) diff --git a/agent/src/ebpf/kernel/Makefile b/agent/src/ebpf/kernel/Makefile index 5173006740f..8f3318419d5 100644 --- a/agent/src/ebpf/kernel/Makefile +++ b/agent/src/ebpf/kernel/Makefile @@ -60,7 +60,7 @@ FINAL_TARGET = -emit-llvm -D__TARGET_ARCH_$(ARCH) -o ${@:.elf=.ll} -c $^ && $(LL all: $(TAEGET_KERN_ELF) -EBPF_CLAGS ?= -I. -Ivmlinux -Iinclude -I../../../crates/trace-utils/src \ +EBPF_CLAGS ?= -I. -Ivmlinux -Iinclude -I../user/extended/bpf/include -I../../../crates/trace-utils/src \ -D__BPF_TRACING__ -D GROUP_LEADER_OFFSET_OVERRIDE=0 \ -DSTART_BOOTTIME_OFFSET_OVERRIDE=0 \ -DSTART_BOOTTIME_VARNAME=real_start_time diff --git a/agent/src/ebpf/kernel/include/bpf_base.h b/agent/src/ebpf/kernel/include/bpf_base.h index d13e812121d..d2f3d05a617 100644 --- a/agent/src/ebpf/kernel/include/bpf_base.h +++ b/agent/src/ebpf/kernel/include/bpf_base.h @@ -30,7 +30,6 @@ #include #include #include -#include "utils.h" struct task_struct; @@ -150,6 +149,13 @@ static int __attribute__ ((__unused__)) (*bpf_get_stack) (void *ctx, void *buf, __u32 size, int flags) = (void *)67; + +// Linux 4.14: Added support for BPF_MAP_TYPE_CPUMAP, allowing packets to be redirected to specific CPUs. +static long + __attribute__ ((__unused__)) (*bpf_redirect_map)(void *map, __u32 key, __u64 flags) = + (void *)51; + + /* llvm builtin functions that eBPF C program may use to * emit BPF_LD_ABS and BPF_LD_IND instructions */ @@ -334,6 +340,7 @@ _Pragma("GCC error \"PT_GO_REGS_PARM\""); #define TP_SYSCALL_PROG(F) SEC("tracepoint/syscalls/sys_"__stringify(F)) int df_T_##F #define TP_SCHED_PROG(F) SEC("tracepoint/sched/sched_"__stringify(F)) int df_T_##F +#define TP_XDP_PROG(F) SEC("tracepoint/xdp/xdp_"__stringify(F)) int df_T_##F #define PROGTP(F) SEC("prog/tp/"__stringify(F)) int df_TP_##F #define PROGKP(F) SEC("prog/kp/"__stringify(F)) int df_KP_##F #define PROGPE(F) SEC("prog/pe/"__stringify(F)) int df_PE_##F diff --git a/agent/src/ebpf/kernel/perf_profiler.bpf.c b/agent/src/ebpf/kernel/perf_profiler.bpf.c index f1c7f870f65..3b743e23d7e 100644 --- a/agent/src/ebpf/kernel/perf_profiler.bpf.c +++ b/agent/src/ebpf/kernel/perf_profiler.bpf.c @@ -19,6 +19,7 @@ * SPDX-License-Identifier: GPL-2.0 */ +#include #include #include "config.h" #include "bpf_base.h" diff --git a/agent/src/ebpf/mod.rs b/agent/src/ebpf/mod.rs index e47bb80995c..e2e9a37cadf 100644 --- a/agent/src/ebpf/mod.rs +++ b/agent/src/ebpf/mod.rs @@ -941,6 +941,57 @@ extern "C" { */ pub fn set_tcp_option_tracing_enabled(enabled: bool) -> c_int; pub fn set_tcp_option_tracing_sample_window(bytes: c_uint) -> c_int; + + /** + * @brief Enable or disable NIC optimization. + * + * This function sets the NIC optimization feature on or off. When enabled, + * the system may adjust RX ring sizes, RSS channels, and CPU affinities + * to improve packet processing performance. + * + * @param enabled Set to 1 to enable, or 0 to disable. On the Rust side, + * this can be converted from a bool. + * + * @return 0 on success, non-zero on failure. + * + * @note Corresponding C function: `int set_nic_optimization(bool enabled)` + */ + pub fn set_nic_optimization(enabled: bool) -> c_int; + + /** + * @brief Configure optimization parameters for a single NIC. + * + * This function applies NIC-specific optimization settings, including + * RX ring size, RSS channel count, IRQ CPU binding, and XDP CPU redirection. + * It allows fine-grained performance tuning for each network interface. + * + * @param nic_name The name of the network interface (C string). + * @param rx_ring_size The size of the RX ring buffer. + * @param rss_channel_count Number of RSS channels to use. + * @param irq_cpu_list Comma-separated list of CPU IDs for IRQ binding. + * @param xdp_cpu_redirect Set to 1 to enable XDP CPU redirect, 0 to disable. + * @param xdp_queue_size The size of the XDP queue. + * @param xdp_cpu_list Comma-separated list of CPU IDs for XDP processing. + * + * @return 0 on success, non-zero on failure. + * + * @note Corresponding C function: + * ```c + * int nic_optimize_config(const char* nic_name, int rx_ring_size, + * int rss_channel_count, const char* irq_cpu_list, + * bool xdp_cpu_redirect, int xdp_queue_size, + * const char* xdp_cpu_list); + * ``` + */ + pub fn nic_optimize_config( + nic_name: *const c_char, + rx_ring_size: c_int, + rss_channel_count: c_int, + irq_cpu_list: *const c_char, + xdp_cpu_redirect: bool, + xdp_queue_size: c_int, + xdp_cpu_list: *const c_char, + ) -> c_int; } } } diff --git a/agent/src/ebpf/samples/rust/socket-tracer/Cargo.toml b/agent/src/ebpf/samples/rust/socket-tracer/Cargo.toml index 0b691165def..2e7fd8f07cd 100644 --- a/agent/src/ebpf/samples/rust/socket-tracer/Cargo.toml +++ b/agent/src/ebpf/samples/rust/socket-tracer/Cargo.toml @@ -21,3 +21,5 @@ lazy_static = "1.4.0" log = "0.4" env_logger = "0.9" trace-utils = { path = "../../../../../crates/trace-utils" } +# Enable this option when building the Enterprise edition. +# trace-utils-interp = { path = "../../../../../crates/trace-utils-interp" } diff --git a/agent/src/ebpf/samples/rust/socket-tracer/src/main.rs b/agent/src/ebpf/samples/rust/socket-tracer/src/main.rs index 5eb4d1bc905..7361a87a892 100644 --- a/agent/src/ebpf/samples/rust/socket-tracer/src/main.rs +++ b/agent/src/ebpf/samples/rust/socket-tracer/src/main.rs @@ -28,6 +28,21 @@ use std::thread; use std::time::{Duration, UNIX_EPOCH}; use log::info; +// Reference trace-utils-interp when building the Enterprise edition. +// The purpose is to ensure that Rust links against libtrace_utils_interp-xxxx.rlib +// during the linking stage. +// +// interpreter_tracer.c calls is_php_process(), +// and this function is defined in the trace-utils-interp crate. +// +// However, the Rust code in socket_tracer does not directly reference +// trace-utils-interp. As a result, Cargo considers this dependency unused +// and excludes it from the linking stage. +// +// Therefore, we explicitly reference trace-utils-interp here to force +// Cargo to include it in the final link. +//use trace_utils_interp as _; + extern "C" { fn print_uprobe_http2_info(data: *mut c_char, len: c_uint); fn print_uprobe_grpc_dataframe(data: *mut c_char, len: c_uint); @@ -746,6 +761,31 @@ fn main() { std::thread::sleep(Duration::from_secs(1)); } + // ------ Nic Optimization ---- + //if set_nic_optimization(true) != 0 { + // println!("set_nic_optimization() error."); + // ::std::process::exit(1); + //} + + //let nic_name = CString::new("p2p2").unwrap(); + //let irq_cpu_list = CString::new("").unwrap(); + //let xdp_cpu_list = CString::new("").unwrap(); + + //if nic_optimize_config( + // nic_name.as_c_str().as_ptr(), + // 0, // rx_ring_size + // 0, // rss_channel_count + // irq_cpu_list.as_c_str().as_ptr(), + // true, // xdp_cpu_redirect + // 0, // xdp_queue_size + // xdp_cpu_list.as_c_str().as_ptr(), + //) != 0 + //{ + // println!("nic_optimize_config() error."); + // ::std::process::exit(1); + //} + // ------ Nic Optimization end ---- + //thread::sleep(Duration::from_secs(60)); //stop_continuous_profiler(); //print!( diff --git a/agent/src/ebpf/user/config.h b/agent/src/ebpf/user/config.h index d99487e987f..6fdf59318d3 100644 --- a/agent/src/ebpf/user/config.h +++ b/agent/src/ebpf/user/config.h @@ -180,6 +180,7 @@ enum cfg_feature_idx { FEATURE_PROFILE_PYTHON, FEATURE_PROFILE_PHP, FEATURE_PROFILE_V8, + FEATURE_CPU_BALANCER, FEATURE_MAX, }; @@ -194,6 +195,7 @@ enum cfg_feature_idx { #define FEATURE_FLAG_PROFILE_PYTHON (1 << FEATURE_PROFILE_PYTHON) #define FEATURE_FLAG_PROFILE_PHP (1 << FEATURE_PROFILE_PHP) #define FEATURE_FLAG_PROFILE_V8 (1 << FEATURE_PROFILE_V8) +#define FEATURE_FLAG_CPU_BALANCER (1 << FEATURE_CPU_BALANCER) #define FEATURE_FLAG_PROFILE (FEATURE_FLAG_PROFILE_ONCPU | FEATURE_FLAG_PROFILE_OFFCPU | FEATURE_FLAG_PROFILE_MEMORY) diff --git a/agent/src/ebpf/user/load.c b/agent/src/ebpf/user/load.c index 549e31eb971..2600b209b54 100644 --- a/agent/src/ebpf/user/load.c +++ b/agent/src/ebpf/user/load.c @@ -630,6 +630,8 @@ static enum bpf_prog_type get_prog_type(struct sec_desc *desc) prog_type = BPF_PROG_TYPE_SOCKET_FILTER; } else if (!strncmp(desc->name, "sockops", 7)) { prog_type = BPF_PROG_TYPE_SOCK_OPS; + } else if (!memcmp(desc->name, "xdp", 3)) { + prog_type = BPF_PROG_TYPE_XDP; } else { prog_type = BPF_PROG_TYPE_UNSPEC; } diff --git a/agent/src/ebpf/user/probe.c b/agent/src/ebpf/user/probe.c index 2f48734d32b..3c66d8e7964 100644 --- a/agent/src/ebpf/user/probe.c +++ b/agent/src/ebpf/user/probe.c @@ -73,6 +73,8 @@ int bpf_get_program_fd(void *obj, const char *name, void **p) __name += 4; } else if (strncmp(__name, "sched_", 6) == 0) { __name += 6; + } else if (strncmp(__name, "xdp_", 4) == 0) { + __name += 4; } res = diff --git a/agent/src/ebpf/user/tracer.c b/agent/src/ebpf/user/tracer.c index 798a20f5cce..cfce1a79800 100644 --- a/agent/src/ebpf/user/tracer.c +++ b/agent/src/ebpf/user/tracer.c @@ -140,7 +140,6 @@ pthread_mutex_t match_pids_lock; // Used to store process IDs for matching various features pids_match_hash_t pids_match_hash; -static int tracepoint_attach(struct tracepoint *tp); static int perf_reader_setup(struct bpf_perf_reader *perf_readerm, int thread_nr); static void perf_reader_release(struct bpf_perf_reader *perf_reader); @@ -1020,7 +1019,7 @@ int probe_detach(struct probe *p) return ret; } -static int tracepoint_attach(struct tracepoint *tp) +int tracepoint_attach(struct tracepoint *tp) { if (tp->link) { return ETR_EXIST; @@ -1039,7 +1038,7 @@ static int tracepoint_attach(struct tracepoint *tp) return ETR_OK; } -static int tracepoint_detach(struct tracepoint *tp) +int tracepoint_detach(struct tracepoint *tp) { if (tp->link == NULL) { return ETR_NOTEXIST; diff --git a/agent/src/ebpf/user/tracer.h b/agent/src/ebpf/user/tracer.h index fc6634d254d..aa2e53e6c79 100644 --- a/agent/src/ebpf/user/tracer.h +++ b/agent/src/ebpf/user/tracer.h @@ -755,4 +755,41 @@ struct ebpf_object *create_ebpf_object(const void *bpf_code, * @return 0 on success, or a non-zero value on error. */ int load_ebpf_object(struct ebpf_object *obj); + +/** + * tracepoint_attach - Attach an eBPF program to a tracepoint + * @tp: Pointer to tracepoint descriptor + * + * This function attaches the eBPF program referenced by @tp->prog + * to its corresponding tracepoint and stores the returned link + * object into @tp->link. + * + * Return: + * ETR_OK - Attach success + * ETR_EXIST - Tracepoint already attached + * ETR_INVAL - Attach failed + * + * Notes: + * - This function is NOT fully thread-safe. Caller must ensure + * proper synchronization if called concurrently. + * - On failure, attach_failed_count will be incremented. + */ +int tracepoint_attach(struct tracepoint *tp); + +/** + * tracepoint_detach - Detach an eBPF program from a tracepoint + * @tp: Pointer to tracepoint descriptor + * + * This function detaches the eBPF program associated with the + * given tracepoint and releases the link object. + * + * Return: + * ETR_OK - Detach success + * ETR_NOTEXIST - Tracepoint not attached + * + * Notes: + * - Safe to call even if detach callback is NULL. + * - Caller must ensure no concurrent attach/detach. + */ +int tracepoint_detach(struct tracepoint *tp); #endif /* DF_USER_TRACER_H */ diff --git a/agent/src/ebpf/user/utils.h b/agent/src/ebpf/user/utils.h index 1d53ef6b9e7..7188120f745 100644 --- a/agent/src/ebpf/user/utils.h +++ b/agent/src/ebpf/user/utils.h @@ -48,6 +48,8 @@ #define MAX_PATH_LENGTH 1024 #define CONTAINER_ID_SIZE 65 +#ifndef _LINUX_SYSINFO_H /* Header guard used by glibc and musl */ +#define _LINUX_SYSINFO_H struct sysinfo { long uptime; @@ -66,6 +68,8 @@ struct sysinfo { char _f[20 - 2 * sizeof(unsigned long) - sizeof(uint32_t)]; }; +#endif + extern int sysinfo(struct sysinfo *__info); #ifndef likely diff --git a/agent/src/ebpf_dispatcher.rs b/agent/src/ebpf_dispatcher.rs index 8c471fd1c84..f5d61997f50 100644 --- a/agent/src/ebpf_dispatcher.rs +++ b/agent/src/ebpf_dispatcher.rs @@ -1049,6 +1049,18 @@ impl EbpfCollector { tcp_option_trace.enabled ); } + + // NicOptimize + if ebpf::set_nic_optimization(config.ebpf.network.nic_opt_enabled) != 0 { + warn!( + "Failed to apply NIC optimization setting (enabled: {})", + config.ebpf.network.nic_opt_enabled + ); + } + + for nic in &config.ebpf.network.nic_optimize { + nic.apply(); + } } if ebpf::running_socket_tracer( @@ -1526,8 +1538,21 @@ impl EbpfCollector { tcp_option_trace.enabled ); } + + // NicOptimize + if ebpf::set_nic_optimization(config.ebpf.network.nic_opt_enabled) != 0 { + warn!( + "Failed to apply NIC optimization setting (enabled: {})", + config.ebpf.network.nic_opt_enabled + ); + } + + for nic in &config.ebpf.network.nic_optimize { + nic.apply(); + } } } + if config.l7_log_enabled() || config.dpdk_enabled { self.start(); } else { diff --git a/server/agent_config/README-CH.md b/server/agent_config/README-CH.md index 1218f86bf16..6e57e7574c6 100644 --- a/server/agent_config/README-CH.md +++ b/server/agent_config/README-CH.md @@ -5165,6 +5165,362 @@ inputs: 禁用 Node.js(V8)解释器剖析。禁用后将不采集 Node.js 进程的函数调用栈, 可节省约 6.4 MB 内核内存(v8_unwind_info_map)。 +### 网络 {#inputs.ebpf.network} + +#### NIC optimization Enabled {#inputs.ebpf.network.nic_opt_enabled} + +**标签**: + +`hot_update` +ee_feature + +**FQCN**: + +`inputs.ebpf.network.nic_opt_enabled` + +**默认值**: +```yaml +inputs: + ebpf: + network: + nic_opt_enabled: false +``` + +**模式**: +| Key | Value | +| ---- | ---------------------------- | +| Type | bool | + +**详细描述**: + +是否启用网卡优化功能,用于提升多核环境下的网络包处理能力 +以及突发流量承载能力。 + +开启后将综合进行以下优化: + - RSS 硬件队列数量配置 + - RX ring 描述符数量调优 + - 硬件中断与 CPU 亲和性绑定(IRQ 绑核) + - 可选的 XDP CPUMAP 软件重定向分发 + +该优化主要解决 RSS 硬件无法基于封装报文内层头部 +(如 GRE、Double VLAN、VXLAN、ERSPAN)进行哈希分摊的问题, +避免流量集中在单个 CPU 上造成过载和丢包。 + +通过调整 RX ring 描述符数量,可提升突发流量场景下的 +接收缓存能力,降低 ring 满导致的丢包风险。 + +在启用 XDP CPU Redirect 时,数据包会在接收后通过 +CPUMAP 在多个 CPU 核心之间进行软件层重分发, +从而突破硬件 RSS 的能力限制,实现更均衡的负载分布。 + +建议在以下场景开启该功能: + 1)使用 tcpdump 抓包发现该接口流量主要为 GRE、 + Double VLAN、VXLAN 等封装报文; + 2)通过 `top`(按 1)观察各 CPU 软中断占用率时, + 发现某一个 CPU 的 softirq 接近 100%, + 而其他 CPU 软中断占用率明显偏低。 + +为获得最佳性能,建议将中断 CPU 和 XDP 重定向 CPU +配置在与物理网卡相同的 NUMA 节点上。 + +#### 网卡优化配置 {#inputs.ebpf.network.nic_optimize} + +**标签**: + +`hot_update` +ee_feature + +**FQCN**: + +`inputs.ebpf.network.nic_optimize` + +**默认值**: +```yaml +inputs: + ebpf: + network: + nic_optimize: + - interface: '' + irq_cpu_list: '' + rss_channel_count: 0 + rx_ring_size: 0 + xdp_cpu_redirect: false + xdp_cpu_redirect_list: '' + xdp_queue_size: 2048 +``` + +**模式**: +| Key | Value | +| ---- | ---------------------------- | +| Type | dict | + +**详细描述**: + +针对指定网卡接口进行性能优化配置。 + +该功能通过调优 RSS 队列、中断绑核、RX ring 大小、 +以及可选的 XDP CPUMAP 重定向机制,提升多核扩展能力 +和突发流量承载能力。 + +建议在以下场景开启: + - 接口流量主要为 GRE、Double VLAN、VXLAN、ERSPAN 等封装报文; + - 某个 CPU 的 softirq 占用率接近 100%,而其他 CPU 空闲。 + +为了获得更好的性能,程序会自动停用 irqbalance 服务,以防止网卡中断在 CPU 之间迁移。 + +可为多个接口分别配置优化策略。 + +样例: +```yaml +inputs: + ebpf: + network: + nic_opt_enabled: true + nic_optimize: + - interface: eth0 + rx_ring_size: 4096 + rss_channel_count: 2 + irq_cpu_list: 1,2 + xdp_cpu_redirect: true + xdp_queue_size: 2048 + xdp_cpu_redirect_list: 4,5,6,7 + - interface: eth1 + rx_ring_size: 4096 + rss_channel_count: 2 + irq_cpu_list: 1,2 + xdp_cpu_redirect: true + xdp_queue_size: 2048 + xdp_cpu_redirect_list: 4,5,6,7 +``` + +##### 网卡接口 {#inputs.ebpf.network.nic_optimize.interface} + +**标签**: + + + +**FQCN**: + +`inputs.ebpf.network.nic_optimize.interface` + +**默认值**: +```yaml +inputs: + ebpf: + network: + nic_optimize: + - interface: '' +``` + +**模式**: +| Key | Value | +| ---- | ---------------------------- | +| Type | string | + +**详细描述**: + +需要进行优化的网卡接口名称。 + +##### RX Ring 描述符数量 {#inputs.ebpf.network.nic_optimize.rx_ring_size} + +**标签**: + + + +**FQCN**: + +`inputs.ebpf.network.nic_optimize.rx_ring_size` + +**默认值**: +```yaml +inputs: + ebpf: + network: + nic_optimize: + - rx_ring_size: 0 +``` + +**模式**: +| Key | Value | +| ---- | ---------------------------- | +| Type | int | + +**详细描述**: + +网卡接收环(RX ring)的描述符数量。 + +增大该值可提升突发流量场景下的缓存能力, +降低因 ring 满导致的丢包风险。 +具体使用`ethtool -g ` 查看当前配置,根据实际情况调整到合适的值。 + +默认值为 0 表示保持原状忽略此项配置。 + +##### RSS 队列数量 {#inputs.ebpf.network.nic_optimize.rss_channel_count} + +**标签**: + + + +**FQCN**: + +`inputs.ebpf.network.nic_optimize.rss_channel_count` + +**默认值**: +```yaml +inputs: + ebpf: + network: + nic_optimize: + - rss_channel_count: 0 +``` + +**模式**: +| Key | Value | +| ---- | ---------------------------- | +| Type | int | + +**详细描述**: + +RSS 硬件队列数量。 +数据包在物理网卡完成哈希后,将分发到指定数量的队列并触发中断。 + +最大一般支持 16,且不要超过逻辑 CPU 核数。 +具体使用`ethtool -l ` 查看当前配置,根据实际情况调整到合适的值。 + +当启用 XDP CPU Redirect 时建议设置为 1。 +默认值为 0 表示保持原状忽略此项配置。 + +##### 硬件中断 CPU 列表 {#inputs.ebpf.network.nic_optimize.irq_cpu_list} + +**标签**: + + + +**FQCN**: + +`inputs.ebpf.network.nic_optimize.irq_cpu_list` + +**默认值**: +```yaml +inputs: + ebpf: + network: + nic_optimize: + - irq_cpu_list: '' +``` + +**模式**: +| Key | Value | +| ---- | ---------------------------- | +| Type | string | + +**详细描述**: + +用于处理网卡硬件中断的 CPU ID 或 CPU 列表。 + +数量建议与 RSS 队列数量一致。 +若启用 XDP CPU Redirect,仅需指定一个 CPU。 + +可设置为: + - 指定 CPU 列表(如 2,4,6) + - local(自动匹配本地 NUMA 节点 CPU) + +建议所选 CPU 与物理网卡位于同一 NUMA 节点。 + +##### 启用 XDP CPU 重定向 {#inputs.ebpf.network.nic_optimize.xdp_cpu_redirect} + +**标签**: + + + +**FQCN**: + +`inputs.ebpf.network.nic_optimize.xdp_cpu_redirect` + +**默认值**: +```yaml +inputs: + ebpf: + network: + nic_optimize: + - xdp_cpu_redirect: false +``` + +**模式**: +| Key | Value | +| ---- | ---------------------------- | +| Type | bool | + +**详细描述**: + +是否启用 XDP CPUMAP 重定向分发。 + +用于解决硬件 RSS 无法对封装报文 +(如 Double VLAN、ERSPAN 等)进行均匀分摊, +导致单核过载和丢包的问题。 + +##### XDP 队列大小 {#inputs.ebpf.network.nic_optimize.xdp_queue_size} + +**标签**: + + + +**FQCN**: + +`inputs.ebpf.network.nic_optimize.xdp_queue_size` + +**默认值**: +```yaml +inputs: + ebpf: + network: + nic_optimize: + - xdp_queue_size: 2048 +``` + +**模式**: +| Key | Value | +| ---- | ---------------------------- | +| Type | int | + +**详细描述**: + +XDP CPUMAP 队列大小。 + +取值范围:[512, 8192],建议配置为 2 的幂。 + +增大可提升突发流量承载能力,但会占用更多内存。 + +##### XDP 重定向 CPU 列表 {#inputs.ebpf.network.nic_optimize.xdp_cpu_redirect_list} + +**标签**: + + + +**FQCN**: + +`inputs.ebpf.network.nic_optimize.xdp_cpu_redirect_list` + +**默认值**: +```yaml +inputs: + ebpf: + network: + nic_optimize: + - xdp_cpu_redirect_list: '' +``` + +**模式**: +| Key | Value | +| ---- | ---------------------------- | +| Type | string | + +**详细描述**: + +XDP 重定向后用于处理数据包的 CPU 列表。 + +填写样式如:4,6,8 + ### 调优 {#inputs.ebpf.tunning} #### 采集队列大小 {#inputs.ebpf.tunning.collector_queue_size} diff --git a/server/agent_config/README.md b/server/agent_config/README.md index f1329ba5f04..3d3dc7b5b44 100644 --- a/server/agent_config/README.md +++ b/server/agent_config/README.md @@ -5304,6 +5304,372 @@ inputs: Disable Node.js (V8) interpreter profiling. When disabled, Node.js process stack traces will not be collected, saving approximately 6.4 MB of kernel memory (v8_unwind_info_map). +### Network {#inputs.ebpf.network} + +#### NIC optimization Enabled {#inputs.ebpf.network.nic_opt_enabled} + +**Tags**: + +`hot_update` +ee_feature + +**FQCN**: + +`inputs.ebpf.network.nic_opt_enabled` + +**Default value**: +```yaml +inputs: + ebpf: + network: + nic_opt_enabled: false +``` + +**Schema**: +| Key | Value | +| ---- | ---------------------------- | +| Type | bool | + +**Description**: + +Whether to enable NIC optimization for enhanced multi-core packet +processing and burst traffic resilience. + +When enabled, the system applies a combination of: + - RSS hardware queue configuration + - RX ring descriptor size tuning + - IRQ (interrupt) CPU affinity binding + - Optional XDP CPUMAP-based CPU redirection + +This optimization mitigates scenarios where RSS hardware cannot hash +inner headers of encapsulated traffic (e.g., GRE, Double VLAN, +VXLAN, ERSPAN), which may otherwise cause traffic to be concentrated +on a single CPU core and lead to packet drops or performance bottlenecks. + +RX ring tuning improves burst handling capability by increasing +the number of descriptors available for packet reception, reducing +the likelihood of ring overflow under high traffic conditions. + +When XDP CPU redirect is enabled, packets are redistributed in +software across multiple CPU cores after initial reception, +providing better load balancing beyond hardware RSS capabilities. + +Recommended to enable this feature when: + 1) Traffic on the interface consists primarily of encapsulated + packets (e.g., verified via tcpdump showing GRE, Double VLAN, + VXLAN, etc.). + 2) One CPU core shows near 100% softirq utilization (e.g., + observed via `top` with per-CPU view), while other CPUs + remain underutilized. + +For optimal performance, IRQ CPUs and XDP redirect CPUs should be +configured on the same NUMA node as the physical NIC. + +#### NIC Optimize {#inputs.ebpf.network.nic_optimize} + +**Tags**: + +`hot_update` +ee_feature + +**FQCN**: + +`inputs.ebpf.network.nic_optimize` + +**Default value**: +```yaml +inputs: + ebpf: + network: + nic_optimize: + - interface: '' + irq_cpu_list: '' + rss_channel_count: 0 + rx_ring_size: 0 + xdp_cpu_redirect: false + xdp_cpu_redirect_list: '' + xdp_queue_size: 2048 +``` + +**Schema**: +| Key | Value | +| ---- | ---------------------------- | +| Type | dict | + +**Description**: + +Configure NIC-level performance optimizations for specific interfaces. + +This feature improves packet processing scalability and burst handling +by tuning hardware RSS queues, interrupt CPU affinity, RX ring size, +and optional XDP CPUMAP-based CPU redirection. + +Recommended when: + - Traffic is primarily encapsulated (GRE, Double VLAN, VXLAN, ERSPAN). + - One CPU shows near 100% softirq usage while others are idle. + +To achieve better performance, the program will automatically disable the +irqbalance service to prevent network interface interrupts from migrating +between CPUs. + +Multiple NIC optimize entries can be configured for different interfaces. + +Example: +```yaml +inputs: + ebpf: + network: + nic_opt_enabled: true + nic_optimize: + - interface: eth0 + rx_ring_size: 4096 + rss_channel_count: 2 + irq_cpu_list: 1,2 + xdp_cpu_redirect: true + xdp_queue_size: 2048 + xdp_cpu_redirect_list: 4,5,6,7 + - interface: eth1 + rx_ring_size: 4096 + rss_channel_count: 2 + irq_cpu_list: 1,2 + xdp_cpu_redirect: true + xdp_queue_size: 2048 + xdp_cpu_redirect_list: 4,5,6,7 +``` + +##### Interface {#inputs.ebpf.network.nic_optimize.interface} + +**Tags**: + + + +**FQCN**: + +`inputs.ebpf.network.nic_optimize.interface` + +**Default value**: +```yaml +inputs: + ebpf: + network: + nic_optimize: + - interface: '' +``` + +**Schema**: +| Key | Value | +| ---- | ---------------------------- | +| Type | string | + +**Description**: + +Name of the network interface to optimize. + +##### RX Ring Size {#inputs.ebpf.network.nic_optimize.rx_ring_size} + +**Tags**: + + + +**FQCN**: + +`inputs.ebpf.network.nic_optimize.rx_ring_size` + +**Default value**: +```yaml +inputs: + ebpf: + network: + nic_optimize: + - rx_ring_size: 0 +``` + +**Schema**: +| Key | Value | +| ---- | ---------------------------- | +| Type | int | + +**Description**: + +Number of RX descriptors in NIC receive ring. + +Increasing this value improves burst traffic buffering +and reduces packet drops caused by ring overflow. +Specifically, use `ethtool -g ` to check the current +configuration, and adjust to an appropriate value based on your workload. + +0 (default) means keep the original state and ignore this setting. + +##### RSS Channel Count {#inputs.ebpf.network.nic_optimize.rss_channel_count} + +**Tags**: + + + +**FQCN**: + +`inputs.ebpf.network.nic_optimize.rss_channel_count` + +**Default value**: +```yaml +inputs: + ebpf: + network: + nic_optimize: + - rss_channel_count: 0 +``` + +**Schema**: +| Key | Value | +| ---- | ---------------------------- | +| Type | int | + +**Description**: + +Number of hardware RSS queues. +Determines how many queues packets are distributed to after +hardware hash calculation. + +Maximum supported value is typically 16 and must not exceed +the number of logical CPU cores. +Specifically, use `ethtool -l ` to check the current configuration +and adjust to an appropriate value based on your workload. + +When XDP CPU redirect is enabled, it is recommended to set this to 1. +0 (default) means keep the original state and ignore this setting. + +##### Hardware IRQ CPU List {#inputs.ebpf.network.nic_optimize.irq_cpu_list} + +**Tags**: + + + +**FQCN**: + +`inputs.ebpf.network.nic_optimize.irq_cpu_list` + +**Default value**: +```yaml +inputs: + ebpf: + network: + nic_optimize: + - irq_cpu_list: '' +``` + +**Schema**: +| Key | Value | +| ---- | ---------------------------- | +| Type | string | + +**Description**: + +CPU ID or comma-separated CPU list used for handling NIC interrupts. + +Recommended to match the number of RSS queues. +If XDP CPU redirect is enabled, only one CPU is required. + +Value can be: + - Specific CPU list (e.g., 2,4,6) + - "local" (auto match CPUs in local NUMA node) + +CPUs should be located on the same NUMA node as the NIC. + +##### Enable XDP CPU Redirect {#inputs.ebpf.network.nic_optimize.xdp_cpu_redirect} + +**Tags**: + + + +**FQCN**: + +`inputs.ebpf.network.nic_optimize.xdp_cpu_redirect` + +**Default value**: +```yaml +inputs: + ebpf: + network: + nic_optimize: + - xdp_cpu_redirect: false +``` + +**Schema**: +| Key | Value | +| ---- | ---------------------------- | +| Type | bool | + +**Description**: + +Enable XDP CPUMAP redirect to redistribute packets across CPUs +in software. + +Useful when hardware RSS cannot distribute encapsulated traffic +(e.g., Double VLAN, ERSPAN) evenly across CPUs, resulting in +single-core overload and packet drops. + +##### XDP Queue Size {#inputs.ebpf.network.nic_optimize.xdp_queue_size} + +**Tags**: + + + +**FQCN**: + +`inputs.ebpf.network.nic_optimize.xdp_queue_size` + +**Default value**: +```yaml +inputs: + ebpf: + network: + nic_optimize: + - xdp_queue_size: 2048 +``` + +**Schema**: +| Key | Value | +| ---- | ---------------------------- | +| Type | int | + +**Description**: + +Size of the XDP CPUMAP queue. + +Valid range: [512, 8192]. Powers of two are recommended. + +Larger values improve burst tolerance but consume more memory. + +##### XDP Redirect CPU List {#inputs.ebpf.network.nic_optimize.xdp_cpu_redirect_list} + +**Tags**: + + + +**FQCN**: + +`inputs.ebpf.network.nic_optimize.xdp_cpu_redirect_list` + +**Default value**: +```yaml +inputs: + ebpf: + network: + nic_optimize: + - xdp_cpu_redirect_list: '' +``` + +**Schema**: +| Key | Value | +| ---- | ---------------------------- | +| Type | string | + +**Description**: + +CPU list used for processing packets after XDP redirection. + +Format example: 4,6,8 + ### Tunning {#inputs.ebpf.tunning} #### Collector Queue Size {#inputs.ebpf.tunning.collector_queue_size} diff --git a/server/agent_config/template.yaml b/server/agent_config/template.yaml index 1095afc4188..03547d208b9 100644 --- a/server/agent_config/template.yaml +++ b/server/agent_config/template.yaml @@ -3870,6 +3870,342 @@ inputs: nodejs_disabled: false # type: section # name: + # en: Network + # ch: 网络 + # description: + network: + # type: bool + # name: NIC optimization Enabled + # unit: + # range: [] + # enum_options: [] + # modification: hot_update + # ee_feature: true + # description: + # en: |- + # Whether to enable NIC optimization for enhanced multi-core packet + # processing and burst traffic resilience. + # + # When enabled, the system applies a combination of: + # - RSS hardware queue configuration + # - RX ring descriptor size tuning + # - IRQ (interrupt) CPU affinity binding + # - Optional XDP CPUMAP-based CPU redirection + # + # This optimization mitigates scenarios where RSS hardware cannot hash + # inner headers of encapsulated traffic (e.g., GRE, Double VLAN, + # VXLAN, ERSPAN), which may otherwise cause traffic to be concentrated + # on a single CPU core and lead to packet drops or performance bottlenecks. + # + # RX ring tuning improves burst handling capability by increasing + # the number of descriptors available for packet reception, reducing + # the likelihood of ring overflow under high traffic conditions. + # + # When XDP CPU redirect is enabled, packets are redistributed in + # software across multiple CPU cores after initial reception, + # providing better load balancing beyond hardware RSS capabilities. + # + # Recommended to enable this feature when: + # 1) Traffic on the interface consists primarily of encapsulated + # packets (e.g., verified via tcpdump showing GRE, Double VLAN, + # VXLAN, etc.). + # 2) One CPU core shows near 100% softirq utilization (e.g., + # observed via `top` with per-CPU view), while other CPUs + # remain underutilized. + # + # For optimal performance, IRQ CPUs and XDP redirect CPUs should be + # configured on the same NUMA node as the physical NIC. + # + # ch: |- + # 是否启用网卡优化功能,用于提升多核环境下的网络包处理能力 + # 以及突发流量承载能力。 + # + # 开启后将综合进行以下优化: + # - RSS 硬件队列数量配置 + # - RX ring 描述符数量调优 + # - 硬件中断与 CPU 亲和性绑定(IRQ 绑核) + # - 可选的 XDP CPUMAP 软件重定向分发 + # + # 该优化主要解决 RSS 硬件无法基于封装报文内层头部 + # (如 GRE、Double VLAN、VXLAN、ERSPAN)进行哈希分摊的问题, + # 避免流量集中在单个 CPU 上造成过载和丢包。 + # + # 通过调整 RX ring 描述符数量,可提升突发流量场景下的 + # 接收缓存能力,降低 ring 满导致的丢包风险。 + # + # 在启用 XDP CPU Redirect 时,数据包会在接收后通过 + # CPUMAP 在多个 CPU 核心之间进行软件层重分发, + # 从而突破硬件 RSS 的能力限制,实现更均衡的负载分布。 + # + # 建议在以下场景开启该功能: + # 1)使用 tcpdump 抓包发现该接口流量主要为 GRE、 + # Double VLAN、VXLAN 等封装报文; + # 2)通过 `top`(按 1)观察各 CPU 软中断占用率时, + # 发现某一个 CPU 的 softirq 接近 100%, + # 而其他 CPU 软中断占用率明显偏低。 + # + # 为获得最佳性能,建议将中断 CPU 和 XDP 重定向 CPU + # 配置在与物理网卡相同的 NUMA 节点上。 + nic_opt_enabled: false + # type: dict + # name: + # en: NIC Optimize + # ch: 网卡优化配置 + # unit: + # range: [] + # enum_options: [] + # modification: hot_update + # ee_feature: true + # description: + # en: |- + # Configure NIC-level performance optimizations for specific interfaces. + # + # This feature improves packet processing scalability and burst handling + # by tuning hardware RSS queues, interrupt CPU affinity, RX ring size, + # and optional XDP CPUMAP-based CPU redirection. + # + # Recommended when: + # - Traffic is primarily encapsulated (GRE, Double VLAN, VXLAN, ERSPAN). + # - One CPU shows near 100% softirq usage while others are idle. + # + # To achieve better performance, the program will automatically disable the + # irqbalance service to prevent network interface interrupts from migrating + # between CPUs. + # + # Multiple NIC optimize entries can be configured for different interfaces. + # + # Example: + # ```yaml + # inputs: + # ebpf: + # network: + # nic_opt_enabled: true + # nic_optimize: + # - interface: eth0 + # rx_ring_size: 4096 + # rss_channel_count: 2 + # irq_cpu_list: 1,2 + # xdp_cpu_redirect: true + # xdp_queue_size: 2048 + # xdp_cpu_redirect_list: 4,5,6,7 + # - interface: eth1 + # rx_ring_size: 4096 + # rss_channel_count: 2 + # irq_cpu_list: 1,2 + # xdp_cpu_redirect: true + # xdp_queue_size: 2048 + # xdp_cpu_redirect_list: 4,5,6,7 + # ``` + # + # ch: |- + # 针对指定网卡接口进行性能优化配置。 + # + # 该功能通过调优 RSS 队列、中断绑核、RX ring 大小、 + # 以及可选的 XDP CPUMAP 重定向机制,提升多核扩展能力 + # 和突发流量承载能力。 + # + # 建议在以下场景开启: + # - 接口流量主要为 GRE、Double VLAN、VXLAN、ERSPAN 等封装报文; + # - 某个 CPU 的 softirq 占用率接近 100%,而其他 CPU 空闲。 + # + # 为了获得更好的性能,程序会自动停用 irqbalance 服务,以防止网卡中断在 CPU 之间迁移。 + # + # 可为多个接口分别配置优化策略。 + # + # 样例: + # ```yaml + # inputs: + # ebpf: + # network: + # nic_opt_enabled: true + # nic_optimize: + # - interface: eth0 + # rx_ring_size: 4096 + # rss_channel_count: 2 + # irq_cpu_list: 1,2 + # xdp_cpu_redirect: true + # xdp_queue_size: 2048 + # xdp_cpu_redirect_list: 4,5,6,7 + # - interface: eth1 + # rx_ring_size: 4096 + # rss_channel_count: 2 + # irq_cpu_list: 1,2 + # xdp_cpu_redirect: true + # xdp_queue_size: 2048 + # xdp_cpu_redirect_list: 4,5,6,7 + # ``` + # upgrade_from: + # --- + # type: string + # name: + # en: Interface + # ch: 网卡接口 + # description: + # en: |- + # Name of the network interface to optimize. + # + # ch: |- + # 需要进行优化的网卡接口名称。 + # --- + # interface: "" + # --- + # type: int + # name: + # en: RX Ring Size + # ch: RX Ring 描述符数量 + # description: + # en: |- + # Number of RX descriptors in NIC receive ring. + # + # Increasing this value improves burst traffic buffering + # and reduces packet drops caused by ring overflow. + # Specifically, use `ethtool -g ` to check the current + # configuration, and adjust to an appropriate value based on your workload. + # + # 0 (default) means keep the original state and ignore this setting. + # + # ch: |- + # 网卡接收环(RX ring)的描述符数量。 + # + # 增大该值可提升突发流量场景下的缓存能力, + # 降低因 ring 满导致的丢包风险。 + # 具体使用`ethtool -g ` 查看当前配置,根据实际情况调整到合适的值。 + # + # 默认值为 0 表示保持原状忽略此项配置。 + # --- + # rx_ring_size: 0 + # --- + # type: int + # name: + # en: RSS Channel Count + # ch: RSS 队列数量 + # description: + # en: |- + # Number of hardware RSS queues. + # Determines how many queues packets are distributed to after + # hardware hash calculation. + # + # Maximum supported value is typically 16 and must not exceed + # the number of logical CPU cores. + # Specifically, use `ethtool -l ` to check the current configuration + # and adjust to an appropriate value based on your workload. + # + # When XDP CPU redirect is enabled, it is recommended to set this to 1. + # 0 (default) means keep the original state and ignore this setting. + # + # ch: |- + # RSS 硬件队列数量。 + # 数据包在物理网卡完成哈希后,将分发到指定数量的队列并触发中断。 + # + # 最大一般支持 16,且不要超过逻辑 CPU 核数。 + # 具体使用`ethtool -l ` 查看当前配置,根据实际情况调整到合适的值。 + # + # 当启用 XDP CPU Redirect 时建议设置为 1。 + # 默认值为 0 表示保持原状忽略此项配置。 + # --- + # rss_channel_count: 0 + # --- + # type: string + # name: + # en: Hardware IRQ CPU List + # ch: 硬件中断 CPU 列表 + # description: + # en: |- + # CPU ID or comma-separated CPU list used for handling NIC interrupts. + # + # Recommended to match the number of RSS queues. + # If XDP CPU redirect is enabled, only one CPU is required. + # + # Value can be: + # - Specific CPU list (e.g., 2,4,6) + # - "local" (auto match CPUs in local NUMA node) + # + # CPUs should be located on the same NUMA node as the NIC. + # + # ch: |- + # 用于处理网卡硬件中断的 CPU ID 或 CPU 列表。 + # + # 数量建议与 RSS 队列数量一致。 + # 若启用 XDP CPU Redirect,仅需指定一个 CPU。 + # + # 可设置为: + # - 指定 CPU 列表(如 2,4,6) + # - local(自动匹配本地 NUMA 节点 CPU) + # + # 建议所选 CPU 与物理网卡位于同一 NUMA 节点。 + # --- + # irq_cpu_list: "" + # --- + # type: bool + # name: + # en: Enable XDP CPU Redirect + # ch: 启用 XDP CPU 重定向 + # description: + # en: |- + # Enable XDP CPUMAP redirect to redistribute packets across CPUs + # in software. + # + # Useful when hardware RSS cannot distribute encapsulated traffic + # (e.g., Double VLAN, ERSPAN) evenly across CPUs, resulting in + # single-core overload and packet drops. + # + # ch: |- + # 是否启用 XDP CPUMAP 重定向分发。 + # + # 用于解决硬件 RSS 无法对封装报文 + # (如 Double VLAN、ERSPAN 等)进行均匀分摊, + # 导致单核过载和丢包的问题。 + # --- + # xdp_cpu_redirect: false + # --- + # type: int + # name: + # en: XDP Queue Size + # ch: XDP 队列大小 + # description: + # en: |- + # Size of the XDP CPUMAP queue. + # + # Valid range: [512, 8192]. Powers of two are recommended. + # + # Larger values improve burst tolerance but consume more memory. + # + # ch: |- + # XDP CPUMAP 队列大小。 + # + # 取值范围:[512, 8192],建议配置为 2 的幂。 + # + # 增大可提升突发流量承载能力,但会占用更多内存。 + # --- + # xdp_queue_size: 2048 + # --- + # type: string + # name: + # en: XDP Redirect CPU List + # ch: XDP 重定向 CPU 列表 + # description: + # en: |- + # CPU list used for processing packets after XDP redirection. + # + # Format example: 4,6,8 + # + # ch: |- + # XDP 重定向后用于处理数据包的 CPU 列表。 + # + # 填写样式如:4,6,8 + # --- + # xdp_cpu_redirect_list: "" + # + nic_optimize: + - interface: "" + rx_ring_size: 0 + rss_channel_count: 0 + irq_cpu_list: "" + xdp_cpu_redirect: false + xdp_queue_size: 2048 + xdp_cpu_redirect_list: "" + # type: section + # name: # en: Tunning # ch: 调优 # description: