Chinaunix

标题: 帮忙分析下 [打印本页]

作者: 嘉伟w    时间: 2012-07-11 10:43
标题: 帮忙分析下
我运行一个python   ./test.py脚本没有问题  然后再5个并发也没有问题for((i=1;i<=5;i++))
do
    nohup ./test.py > nohup${i}.out 2>&1 &
done   
但是100个并发就大规模当掉了for((i=1;i<=100;i++))
do
    nohup ./test.py > nohup${i}.out 2>&1 &
done
作者: anonymous0502    时间: 2012-07-11 11:00
当掉是什么现象?
我试了下好像可以吧,我的测试py很简单,可能
  1. [root@fruit tmp]# vi sh2.sh
  2. [root@fruit tmp]# ./sh2.sh
  3. [root@fruit tmp]# ps -ef|grep python|wc -l
  4. 201
  5. [root@fruit tmp]# killall python
  6. [root@fruit tmp]# cat sh2.sh
  7. #!/bin/sh
  8. for((i=1;i<=200;i++))
  9. do
  10.     nohup /tmp/py2.py > nohup${i}.out 2>&1 &
  11. done

  12. [root@fruit tmp]# cat py2.py
  13. #!/usr/bin/env python
  14. #coding:utf-8
  15. import time,os
  16. i=1
  17. while i<10000000:
  18.     os.system('date')
  19.     time.sleep(0.1)
  20.     i+=1
  21. print 'task done'
复制代码
  1. [root@fruit py]# ls /tmp/nohup*|wc -l
  2. 200
复制代码

作者: 嘉伟w    时间: 2012-07-11 11:07
回复 2# anonymous0502


    就像这样
作者: anonymous0502    时间: 2012-07-11 11:15
不知道是不是跟你的py脚本里的具体操作内容有关,我用上面写的来试200个都可以啊
作者: 嘉伟w    时间: 2012-07-11 11:19
回复 4# anonymous0502


    但是我这并发10个就可以    他的奔溃日志里是这样的 但是我这边协议也更新了 纠结
作者: anonymous0502    时间: 2012-07-11 12:41
没用过这个东西,根据错误能google到一些资料,有些帖子提到了可能的原因,可能需要修改一下test.py脚本吧






欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2