原创 net.ipv4.tcp_syn_retries

驗證 net.ipv4.tcp_syn_retries: node2:/root/test#sysctl -p |grep -i syn error: "net.bridge.bridge-nf-call-ip6tables" is

原创 接收窗口大小

發送窗口與接收窗口 一個非常容易混淆的概念是「發送窗口」和「接收窗口」,很多人會認爲接收窗口就是發送窗口。 先來問一個問題,wireshark 抓包中顯示的 win=29312 指的是「發送窗口」的大小嗎? 當然不是的,其實這裏

原创 nginx root 和alias

root: 192.168.137.1 - - [23/Jun/2020:09:40:07 +0800] "GET /index.html HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 6

原创 openresty lua

#user nobody; worker_processes 10; #error_log logs/error.log; #error_log logs/error.log notice; #error_log log

原创 nginx 通用配置規則

worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info

原创 nginx gzip json [2]

node1:/etc/nginx#cat nginx.conf worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice;

原创 nginx gzip json 配置「1」

node1:/etc/nginx#cat /etc/nginx/nginx.conf worker_processes 1; #error_log logs/error.log; #error_log logs/error.lo

原创 net.ipv4.tcp_tw_reuse = 1 重用time_wait

net.ipv4.tcp_tw_reuse = 1 開啓tcp_tw_reuse net.ipv4.ip_local_port_range = 50001 50001 node2:/root/test#python connect

原创 tcp_fin_timeout

node2:/root/test#sysctl -w net.ipv4.tcp_fin_timeout="1" net.ipv4.tcp_fin_timeout = 1 node2:/root/test#time python clos

原创 net.ipv4.tcp_max_tw_buckets=10

這個參數表示操作系統允許TIME_WAIT套接字數量的最大值, 如果超過這個數字,TIME_WAIT套接字將立刻被清除並打印警告信息。 該參數默認爲 180000,過多的TIME_WAIT套接字會使Web服務器變慢。 node2:/r

原创 程序停掉close_wait立馬回收

node1:/root#netstat -na | grep 8080 tcp 0 0 192.168.137.2:8080 0.0.0.0:* LISTEN

原创 模擬半連接佔滿

半連接: 半連接隊列(Incomplete connection queue),又稱 SYN 隊列 全連接隊列(Completed connection queue),又稱 Accept 隊列 服務端 node1:/root/te

原创 數據包設置了不允許分片

node2:/root/test#python test8080.py 1461 The big message was sent! Your network supports really big packets! 發送長度爲14

原创 keepalive 自動關閉無法訪問的連接

node2:/root/test#cat connect2.py import socket import IN import struct import time b=2 def getnum(x): b='2' f