zoukankan      html  css  js  c++  java
  • docker_info_06_stressTest 压力测试

    docker_info_06_stressTest压力测试

    • linux下的压力测试工具(需要有epel源)
    yum install stress -y
    mkdir -p /data/docker/data/stress01
    cd /data/docker/data/stress01
    -----------------------------
    [root@zuiyoujie stress01]# vim Dockerfile
    --------------------------------
    # Dockerfile by zhaoshuai in 20180829.
    FROM centos
    RUN yum install -y wget
    RUN wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
    RUN yum install -y stress && yum clean all
    ENTRYPOINT ["stress"]
    --------------------------------
    
    # linux下的压力测试工具
    [root@zuiyoujie stress01]# docker build -t zs/stress:v1 /data/docker/data/stress01/
    Sending build context to Docker daemon 6.144 kB
    Sending build context to Docker daemon
    Step 0 : FROM centos
     ---> 9baab0af79c4
    Step 1 : RUN yum install -y wget
     ---> Using cache
     ---> 656f1c470ccf
    Step 2 : RUN wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
     ---> Running in 95c534233ea6
    --2016-11-08 14:51:29--  http://mirrors.aliyun.com/repo/epel-6.repo
    Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 112.124.140.210, 115.28.122.210
    # 中间省略部分。。。。。
    Loaded plugins: fastestmirror, ovl
    Cleaning repos: base epel extras updates
    Cleaning up everything
    Cleaning up list of fastest mirrors
     ---> 656d336595a2
    Removing intermediate container 78c64960bce8
    Successfully built 656d336595a2
    -----------------------------------------------------------
    
    • 特别注意:以下命令不要在物理机测试
    ---------------cpu权重分配--------------------
    # 默认分配1024权重
    [root@zuiyoujie stress01]# docker run -it --rm zs/stress:v1 --cpu 1             # 默认权重1024启动docker容器
    stress: info: [1] dispatching hogs: 1 cpu, 0 io, 0 vm, 0 hdd
    ^Cstress: FAIL: [1] (415) <-- worker 6 got signal 2
    stress: WARN: [1] (417) now reaping child worker processes
    stress: FAIL: [1] (421) kill error: No such process
    stress: FAIL: [1] (451) failed run completed in 76s
    
    # 使用top查看效果
    ---------
    [root@zuiyoujie stress01]# docker run -it --rm -c 512 zs/stress:v1 --cpu 1      # 手动制定权重启动docker容器
    stress: info: [1] dispatching hogs: 1 cpu, 0 io, 0 vm, 0 hdd
    ^Cstress: FAIL: [1] (415) <-- worker 6 got signal 2
    stress: WARN: [1] (417) now reaping child worker processes
    stress: FAIL: [1] (421) kill error: No such process
    stress: FAIL: [1] (451) failed run completed in 13s
    
    --------------CPU个数分配----------------------
    [root@zuiyoujie stress01]# docker run -it --rm --cpuset=0 zs/stress:v1 --cpu 1  # 旧版用法
    Warning: '--cpuset' is deprecated, it will be replaced by '--cpuset-cpus' soon. See usage.
    stress: info: [1] dispatching hogs: 1 cpu, 0 io, 0 vm, 0 hdd
    ^Cstress: FAIL: [1] (415) <-- worker 6 got signal 2
    stress: WARN: [1] (417) now reaping child worker processes
    stress: FAIL: [1] (421) kill error: No such process
    stress: FAIL: [1] (451) failed run completed in 84s
    
    ----------------------------------------------
    [root@zuiyoujie stress01]# docker run -it --rm --cpuset-cpus=0 zs/stress:v1 --cpu 1     # 新版用法
    stress: info: [1] dispatching hogs: 1 cpu, 0 io, 0 vm, 0 hdd
    ^Cstress: FAIL: [1] (415) <-- worker 6 got signal 2
    stress: WARN: [1] (417) now reaping child worker processes
    stress: FAIL: [1] (421) kill error: No such process
    stress: FAIL: [1] (451) failed run completed in 72s
    ----------------------------------------------
    
    -------测试docker容器对内存的限额-------
    [root@zuiyoujie stress01]# docker run -it --rm -m 128m zs/stress:v1 --vm 1 --vm-bytes 120m --vm-hang 0
    stress: info: [1] dispatching hogs: 0 cpu, 0 io, 1 vm, 0 hdd            # 手动结束进程
    ^Cstress: FAIL: [1] (415) <-- worker 6 got signal 2
    stress: WARN: [1] (417) now reaping child worker processes
    stress: FAIL: [1] (421) kill error: No such process
    stress: FAIL: [1] (451) failed run completed in 49s
    ----------------------------------------------
    # docker容器里的进程消耗的内存小于系统为容器分配的内存可以正常运行
    
    [root@zuiyoujie stress01]# docker run -it --rm -m 128m zs/stress:v1 --vm 1 --vm-bytes 256m --vm-hang 0
    stress: info: [1] dispatching hogs: 0 cpu, 0 io, 1 vm, 0 hdd
    stress: FAIL: [1] (415) <-- worker 6 got signal 9
    stress: WARN: [1] (417) now reaping child worker processes
    stress: FAIL: [1] (421) kill error: No such process
    stress: FAIL: [1] (451) failed run completed in 2s
    ----------------------------------------------
    # docker容器里的进程消耗的内存超过系统为容器分配的内存可以正常运行,最大可以在2倍分配值内运行,超过则崩溃
    -----------------------
    
  • 相关阅读:
    delphi7调用webservice Java 传入参数为空
    delphi客户端调服务器端的java webservice如何在参数中传对象? 转
    DELPHI7如何调用带参数的JAVA WebService
    Delphi调用java开发的WebService,传入参数出错
    cxgrid按条件计算合计值 TcxTreeList计算合计值
    收款凭证
    delphi TCXTreelist 通过代码控制行的可编辑性
    win7 共享
    单到冲回的暂估方式,暂估入库的操作流程是怎样的?
    js常用函数和常用技巧
  • 原文地址:https://www.cnblogs.com/tssc/p/13902444.html
Copyright © 2011-2022 走看看