By xzllll

bpftune - BPF driven auto-tuning | install & usage

工具 | Tools 2026年6月2日

1. First | 序

bpftune 是由 Oracle 开源的一款基于 eBPF(Extended Berkeley Packet Filter) 技术的高级 Linux 内核自动调优工具。它的核心理念是提供一种轻量级、常驻(Always-on)、自适应的系统行为优化方案。

此篇记录安装&使用过程

📦
本篇所使用到的操作系统&软件版本(配置)如下所示

2. Install | 安装

  1. 使用 transactional-update 安装 bpftune

    transactional-update pkg install bpftune
    
  2. Reboot after update 更新后重启

    transactional-update reboot
    
  3. 重启完成后启用 bpftune

    systemctl enable --now bpftune.service
    

3. Usage | 使用

systemctl enable --now bpftune.service 开启相应服务后 bpftune 立即开始运行

bpftune 命令一些帮助文档

~> bpftune --help
Usage: /sbin/bpftune [OPTIONS]
        OPTIONS := { { -a|--allow tuner}
                     { -d|--debug} {-D|--daemon}
                     { -c|--cgroup cgroup_path}
                     { -L|--legacy}
                     { -h|--help}}
                     { -l|--libdir library_path}
                     { -p|--port port}
                     { -q|--query query}
                     { -r|--learning_rate learning_rate}
                     { -R|--rollback}
                     { -s|--stderr}
                     { -S|--suppport}
                     { -V|--version}}
~> bpftune -q help
                help                   list supported queries
              tuners                     show state of tuners
            tunables                    show list of tunables
           jtunables              show list of tunables(json)
             summary                  show summary of changes
              status                  show status of tunables
             jstatus            show status of tunables(json)
            rollback         show changes needed to roll back             

  1. 查看系统是否支持 bpftune

    ~> bpftune -S
    bpftune: bpftune works fully
    bpftune: bpftune supports per-netns policy (via netns cookie)
    
  2. 查看 tuners 状态

    ~> bpftune -q tuners
             ip_frag               active
         neigh_table               active
          net_buffer               active
               netns               active
         route_table               active
              sysctl               active
          tcp_buffer               active
            tcp_conn               active
          udp_buffer               active
    
  3. 显示可调参数状态

    ~> bpftune -q status
         ip_frag                        net.ipv4.ipfrag_high_thresh                            4194304
         ip_frag                       net.ipv6.ip6frag_high_thresh                            4194304
     neigh_table                 net.ipv4.neigh.default.gc_interval                                 30
     neigh_table               net.ipv4.neigh.default.gc_stale_time                                 60
     neigh_table                  net.ipv4.neigh.default.gc_thresh1                                128
     neigh_table                  net.ipv4.neigh.default.gc_thresh2                                512
     neigh_table                  net.ipv4.neigh.default.gc_thresh3                               1024
     neigh_table                 net.ipv6.neigh.default.gc_interval                                 30
     neigh_table               net.ipv6.neigh.default.gc_stale_time                                 60
     neigh_table                  net.ipv6.neigh.default.gc_thresh1                                128
     neigh_table                  net.ipv6.neigh.default.gc_thresh2                                512
     neigh_table                  net.ipv6.neigh.default.gc_thresh3                               1024
      net_buffer                        net.core.netdev_max_backlog                               1000
      net_buffer                     net.core.flow_limit_cpu_bitmap                                  0
      net_buffer                             net.core.netdev_budget                                300
      net_buffer                       net.core.netdev_budget_usecs                               2000
      net_buffer                  net.core.high_order_alloc_disable                                  0
     route_table                            net.ipv6.route.max_size                         2147483647
      tcp_buffer                                  net.ipv4.tcp_wmem                 4096 16384 4194304
      tcp_buffer                                  net.ipv4.tcp_rmem               4096 131072 33554432
      tcp_buffer                                   net.ipv4.tcp_mem               187011 249351 374022
      tcp_buffer                       net.ipv4.tcp_moderate_rcvbuf                                  1
      tcp_buffer                       net.ipv4.tcp_no_metrics_save                                  0
      tcp_buffer              net.ipv4.tcp_no_ssthresh_metrics_save                                  1
      tcp_buffer                  net.core.high_order_alloc_disable                                  0
      tcp_buffer                       net.ipv4.tcp_max_syn_backlog                               1024
      tcp_buffer                           net.ipv4.tcp_max_orphans                              65536
        tcp_conn            net.ipv4.tcp_allowed_congestion_control        "reno cubic bbr htcp dctcp"
        tcp_conn          net.ipv4.tcp_available_congestion_control        "reno cubic bbr htcp dctcp"
        tcp_conn                    net.ipv4.tcp_congestion_control                            "cubic"
        tcp_conn                  net.ipv4.tcp_thin_linear_timeouts                                  0
      udp_buffer                                   net.ipv4.udp_mem               374025 498702 748050
      udp_buffer                                  net.core.rmem_max                            4194304
      udp_buffer                              net.core.rmem_default                             212992
    

Thanks & Copy

GitHub - oracle/bpftune: bpftune uses BPF to auto-tune Linux systems
bpftune uses BPF to auto-tune Linux systems. Contribute to oracle/bpftune development by creating an account on GitHub.

标签

xzllll

三分钟热度三分钟收获