查看当前进程打开的进程数:
lsof -n -p 【process id】|wc -l
查看当前进程的限制
cat /proc/【process id】/limitsLimit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited ms
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 2048 2048 processes
Max open files 1024 1024 files
Max locked memory 32768 32768 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 2048 2048 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
------------------------------------------ 检查网络连接信息 ------------------------------------------
检查网络连接信息:
netstat -tano | awk '{print $6}' | sort | uniq -c
ss -s
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
------------------------------------------ 检查进程所关联的进程信息 ------------------------------------------
检查进程所关联的进程信息:
lsof -n -p PROCESS_ID | wc -l
cat /proc/PROCESS_ID/limits
kmemsize is one of the (many) memory parameters in a virtuozzo vps. Please post the output of this command:
cat /proc/user_beancounters
1、查看apache当前并发访问数:
netstat -an | grep ESTABLISHED | wc -l
2、查看有多少个进程数:
ps aux | grep httpd | wc -l
3、可以使用如下参数查看数据
ps -ef | grep httpd | wc -l
------------------------------------------ mrtg ------------------------------------------
/usr/local/mrtg/cfgmaker public@localhost > /etc/mrtg/mrtg.cfg
indexmaker /etc/mrtg/mrtg.cfg --output=/app/web/_ipub_/diag/mrtg/index.htm --title="MRTG monitor"
env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
------------------------------------------ 使用文件创建swap分区 ------------------------------------------
二、使用文件创建swap分区
bs blocksize ,每个块大小为1k.count=2048000。则总大小为2G的文件。
dd if=/dev/zero of=/swapfile bs=1k count=2048000
mkswap /swapfile
swapon /swapfile
修改/etc/fstab使其启动时自动mount:
在/etc/fstab中增加如下语句:
/swapfile swap swap defaults 0 0
------------------------------------------ 查询 Httpd 的主进程 id 号 ------------------------------------------
方法一: ps -ef | grep httpd | grep apache | head -n 1 | awk '{print $3}'
方法二: cat /var/run/httpd.pid
lsof -n -p PROCESS_ID
------------------------------------------ 查询 Httpd 的消耗的内存多少 ------------------------------------------
ps -C httpd -O rss | gawk '{ count ++; sum += $2 }; END {count --; print "Number of processes =",count; print "Memory usage per process =",sum/1024/count, "MB"; print "Total memory usage =", sum/1024, "MB" ;};'

本文介绍了如何查看服务器进程数量、并发访问数、内存使用情况等关键指标,包括使用命令行工具如lsof、ps、netstat等进行操作,并提供了检查网络连接、进程关联进程信息的方法。
804

被折叠的 条评论
为什么被折叠?



