服务器性能优化
服务器性能优化 在日常开发中如果需要进行服务器性能优化大概有哪些切入点,例客户端请求服务器一个业务接口,可以优化的对象有Linux,nginx,phpfpm,php,mysql,redis; linux 可以优化配置服务器可以连接的套接字文件进程数 /etc/sysctl.conf # 系统最大文件句柄数(所有进程可打开的文件总数上限) fs.file-max = 1000000 # 系统范围内已分配、未使用的文件句柄数(监控用,一般不直接设置) # fs.file-nr # 端口范围 net.ipv4.ip_local_port_range = 1024 65535 # TCP连接相关 net.core.somaxconn = 65535 net.ipv4.tcp_max_syn_backlog = 65536 net.core.netdev_max_backlog = 50000 # TIME-WAIT优化(高并发场景) net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_max_tw_buckets = 2000000 net.ipv4.tcp_fin_timeout = 30 nginx # ============ 全局配置部分 ============ user nginx; # 确保与系统用户一致 worker_processes auto; # 自动设置为CPU核心数 […]