Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux tcp相关 #1

Open
sophister opened this issue May 20, 2017 · 3 comments
Open

linux tcp相关 #1

sophister opened this issue May 20, 2017 · 3 comments
Labels

Comments

@sophister
Copy link
Owner

sophister commented May 20, 2017

  • 查看 tcp 的 established queue 大小: cat /proc/sys/net/core/somaxconn
  • 查看 tcp 的 syn recv queue 大小: cat /proc/sys/net/ipv4/tcp_max_syn_backlog
  • 暂时未知: ss -lt
  • 查看socket摘要: ss -s
  • Display summary statistics for each protocol: netstat -s

系统收到 syn 请求,先放到 syn recv queue;收到client第二次 ack时,从 syn recv queue取出来,放入 established queue

  • 查看服务器上各个socket连接数: cat /proc/net/sockstat

  • 查看服务器tcp各个状态连接数: ss -ant | awk 'NR>1 {++s[$1]} END {for(k in s) print k,s[k]}'

  • 查看服务器tcp的各个状态连接数: netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

  • 查看tcp的本机可用端口范围:cat /proc/sys/net/ipv4/ip_local_port_range

  • 查看 tcp udp 已占用的端口数:netstat -an | grep -e tcp -e udp | wc -l

  • /proc/sys/net/ipv4/tcp_timestamps - 控制timestamp选项开启/关闭

  • /proc/sys/net/ipv4/tcp_tw_recycle - 减少timewait socket释放的超时时间

  • /proc/sys/net/ipv4/tcp_abort_on_overflow 当 accept queue 满时,是否立即返回 RST 包给client

@sophister
Copy link
Owner Author

linux上跟踪某个process的内部系统调用时间: strace -s128 -ttt -p process_id -c

@sophister
Copy link
Owner Author

CentOS自带的防火墙坑了,导致node.js请求后端一直超时。原因见这篇:

nf_conntrack: table full, dropping packet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant