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

负载问题,难道只有我有高负载吗? #283

Closed
Yiipanny opened this issue Aug 20, 2016 · 24 comments
Closed

负载问题,难道只有我有高负载吗? #283

Yiipanny opened this issue Aug 20, 2016 · 24 comments

Comments

@Yiipanny
Copy link

空跑的时候负载很低,一但web终端连上了,负载就上去了

1个终端,负载1.0左右
2个终端,负载1.7左右
3个终端,负载2.1左右

处理器是E3-1220 3.1G主频,因为是在kvm虚拟机里跑的,只分配了2个核心,3个终端就能把处理器沾满了,所以这种情况算正常吗?

@ibuler
Copy link
Member

ibuler commented Aug 22, 2016

应该是有人再tail或者cat大日志

@Yiipanny
Copy link
Author

不不,这是我新开的机子,没人上的来,只做console连接操作而已,也没有做核心限制

@kikiyou
Copy link
Contributor

kikiyou commented Aug 25, 2016

我这边也是负载高,所以我一般 定时晚上重启一下 jumpserver

@liuzheng
Copy link
Contributor

麻烦把机器(kvm内)的软件环境贴上来,
cat /proc/cpuinfo
uname -a
pip list
python --version

以下命令请麻烦在负载高的时候运行
free
iostat 2 3
ps auxw|grep python

@Yiipanny
Copy link
Author

换了个单核的Xen机器来试验了

[root@localhost ~]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
stepping : 4
microcode : 0x416
cpu MHz : 2800.084
cache size : 25600 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 2
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu de tsc msr pae cx8 sep cmov pat clflush mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nopl nonstop_tsc eagerfpu pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm ida arat epb xsaveopt pln pts dtherm fsgsbase erms
bogomips : 5600.16
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:

[root@localhost ~]# uname -a
Linux localhost 3.10.0-229.20.1.el7.x86_64 #1 SMP Tue Nov 3 19:10:07 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

[root@localhost ~]# pip list
ansible (1.9.4)
Babel (0.9.6)
backports-abc (0.4)
backports.ssl-match-hostname (3.4.0.2)
certifi (2016.8.8)
chardet (2.2.1)
configobj (4.7.2)
decorator (3.4.0)
Django (1.6)
django-bootstrap-form (3.2)
django-crontab (0.6.0)
django-smtp-ssl (1.0)
ecdsa (0.13)
gevent (1.0)
greenlet (0.4.2)
iniparse (0.4)
iotop (0.6)
Jinja2 (2.7.2)
kitchen (1.1.1)
M2Crypto (0.21.1)
MarkupSafe (0.11)
msgpack-python (0.4.7)
MySQL-python (1.2.5)
paramiko (1.16.0)
passlib (1.6.5)
perf (0.1)
pip (8.1.2)
psutil (3.3.0)
pycrypto (2.4.1)
pycurl (7.19.0)
pygobject (3.14.0)
pygpgme (0.3)
pyinotify (0.9.6)
pyliblzma (0.5.3)
pyparsing (1.5.6)
pyte (0.5.2)
pyudev (0.15)
pyxattr (0.5.1)
PyYAML (3.10)
pyzmq (14.3.1)
requests (2.6.0)
salt (2015.5.10)
setuptools (0.9.8)
singledispatch (3.4.0.3)
six (1.9.0)
slip (0.4.0)
slip.dbus (0.4.0)
tornado (4.3)
urlgrabber (3.10)
urllib3 (1.10.2)
wcwidth (0.1.7)
xlrd (0.9.4)
XlsxWriter (0.7.7)
yum-metadata-parser (1.1.4)

[root@localhost ~]# python --version
Python 2.7.5

@Yiipanny
Copy link
Author

[root@localhost ~]# free
total used free shared buff/cache available
Mem: 2041424 388948 637224 106432 1015252 1495136
Swap: 131068 364 130704
[root@localhost ~]# iostat 2 3
Linux 3.10.0-229.20.1.el7.x86_64 (localhost.efmoe.net) 08/30/2016 x86_64 (1 CPU)

avg-cpu: %user %nice %system %iowait %steal %idle
2.70 0.00 8.81 0.01 0.17 88.31

Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
xvda 0.65 0.12 5.26 416229 17730872
xvdb 0.00 0.00 0.00 1504 3276

avg-cpu: %user %nice %system %iowait %steal %idle
75.62 0.00 24.38 0.00 0.00 0.00

Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
xvda 1.00 0.00 5.97 0 12
xvdb 0.00 0.00 0.00 0 0

avg-cpu: %user %nice %system %iowait %steal %idle
77.00 0.00 23.00 0.00 0.00 0.00

Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
xvda 0.00 0.00 0.00 0 0
xvdb 0.00 0.00 0.00 0 0

[root@localhost ~]# ps auxw|grep python
root 771 0.0 0.7 553064 16264 ? Ssl Jul22 7:29 /usr/bin/python -Es /usr/sbin/tuned -l -P
root 28674 0.0 0.0 113120 1416 ? S Aug19 0:00 /bin/bash -c ulimit -S -c 0 >/dev/null 2>&1 ; python ./run_server.py
root 28676 0.1 2.8 650096 58452 ? Sl Aug19 21:00 python ./run_server.py
root 31880 0.0 0.0 112656 976 pts/0 R+ 21:14 0:00 grep --color=auto python

@ibuler
Copy link
Member

ibuler commented Aug 30, 2016

使用这个分支测试一下

b48af94

@Yiipanny
Copy link
Author

还是一样的高负载

@ibuler
Copy link
Member

ibuler commented Aug 30, 2016

负载高可能是有大的日志操作,否则不会高的,如cat 1G.log tail access.log,否则不会高的

@Yiipanny
Copy link
Author

我可以打包票并没有做任何操作,现在只是单单连上console就很高的负载了,根本没有做任何操作的

@ibuler
Copy link
Member

ibuler commented Aug 30, 2016

安装一个 teamview,我给你看看,q小窗我 老广

@liuzheng
Copy link
Contributor

@efmoe 你的负载没在python上,最后的ps auxw|grep python表明了cpu使用率0.1%,mem使用率2.8%,你说的负载是高mem还是高cpu?

cpu top: ps auxw|sort -n -r -k 3|head
mem top : ps auxw|sort -n -r -k 4|head

同样帖结果

@Yiipanny
Copy link
Author

@liuzheng712 我让老广远程来看看吧,可能正好统计到了低的时候

@ibuler
Copy link
Member

ibuler commented Aug 30, 2016

@liuzheng712 web terminal的问题,开启几个web terminal load会上来,具体问题再看看

@luashiping
Copy link

我也碰到这样的问题!貌似是线程出问题了,我strace追踪进程的时候,发现很多futex(0x1970b70, FUTEX_WAIT_PRIVATE, 0, NULL) = 0这样的输出,应该是线程的问题

在 2016年8月30日,下午11:20,老广 notifications@github.com 写道:

@liuzheng712 https://github.com/liuzheng712 web terminal的问题,开启几个web terminal load会上来,具体问题再看看


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub #283 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/ACshPSdnsBCnaZuMNbPduBBZDfYqcjCgks5qlEo3gaJpZM4Jo_iq.

@luashiping
Copy link

负载高的原因以及找到,runserver.py文件第419行:
r, w, e = select.select([self.channel, sys.stdin], [], [])
这里的sys.stdin不知道道有什么意义,我想不到开发者的用途。
改成
r, w, e = select.select([self.channel], [], [])
这样就可以了!

发自 网易邮箱大师
在2016年09月01日 17:20,lushiping 写道:
我也碰到这样的问题!貌似是线程出问题了,我strace追踪进程的时候,发现很多futex(0x1970b70, FUTEX_WAIT_PRIVATE, 0, NULL) = 0这样的输出,应该是线程的问题
在 2016年8月30日,下午11:20,老广 notifications@github.com 写道:

@liuzheng712 web terminal的问题,开启几个web terminal load会上来,具体问题再看看


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@ivanjoy42
Copy link

ivanjoy42 commented Sep 2, 2016

我遇到的问题是:大量输出后,当前连接会卡住几十秒。例如长时间top然后退出,或长时间tail日志然后ctrl+c等。卡的时候jumpserver服务器cpu会占满一个核心。
ps: 我使用的命令行连接,没有使用web

@luashiping
Copy link

@ibuler 这个问题你看看 是不是我上面说的这个问题。我这边这样改了之后是ok的,你这边的select好像没有必要监视标准输入描述符

@ibuler
Copy link
Member

ibuler commented Sep 5, 2016

@luashiping 监听stdin是为了获取用户的输入

@luashiping
Copy link

@ibuler 额!web terminal输入吗?监视输入是通过self.channel的!如果再加上监视sys.stdin,我这边只要打开一个web terminal窗口,服务端cpu就打满!我调试的时候去掉这个就好了。

@ibuler
Copy link
Member

ibuler commented Sep 5, 2016

ok, 我测试一下

ibuler added a commit that referenced this issue Sep 5, 2016
#283  More see this issue
@ibuler
Copy link
Member

ibuler commented Sep 5, 2016

Fixed 8f66678

@Yiipanny
Copy link
Author

Yiipanny commented Sep 5, 2016

@ibuler 我测试了的确没什么CPU占用了,但是去掉sys.stdin对系统对jumpserver的功能有啥影响不?

@ibuler
Copy link
Member

ibuler commented Sep 5, 2016

在 run_server.py没有影响

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

No branches or pull requests

6 participants