Ubuntu默认的open files为1024, 可以通过ulimit -n
来查看;
在高并发场景下, 网络服务打开的文件描述符可能会超过这个限制, 那么我们需要来增大这个值
执行如下命令, 会增大open files值, 但是重启后会被恢复
#!/usr/bin/env bpftrace | |
#include <linux/sched.h> | |
BEGIN | |
{ | |
printf("Trace new processes via exec() syscalls. Hit Ctrl-C to end.\n"); | |
} | |
tracepoint:syscalls:sys_enter_exec* |
// 打印traceback | |
// src/runtime/traceback.go | |
func traceback2() { | |
// Everything throw does should be recursively nosplit so it | |
// can be called even when it's unsafe to grow the stack. | |
pc := getcallerpc() | |
sp := getcallersp() | |
gp := getg() | |
traceback(pc, sp, 0, gp) |
# | |
# /etc/sysctl.conf - Configuration file for setting system variables | |
# See /etc/sysctl.d/ for additional system variables. | |
# See sysctl.conf (5) for information. | |
# | |
#kernel.domainname = example.com | |
# Uncomment the following to stop low-level messages on console | |
#kernel.printk = 3 4 1 3 |