美文网首页
Coro-telnet环境搭建和测试

Coro-telnet环境搭建和测试

作者: 飞天神猫 | 来源:发表于2017-03-13 15:14 被阅读0次

    Coro-telnet环境搭建和测试

    利用io::socket::telnet,封装AE::socket+Coro::handle实现异步telnet
    需要安装包,排列即安装顺序

    • Canary-Stability-2011.tar
    • common-sense-3.74.tar
    • Guard-1.023.tar
    • AnyEvent-7.13.tar
    • Coro-6.511.tar

    测试telnet效率

    1 cmd 每秒可以交互 10台设备这样

    • 一台设备执行show users和show bfd共 2秒
    perl ./CoroTelnet.pl
    [1] joining...
    1489043536.65013 begin**
    RP/0/RSP0/CPU0:SN-AK-1#
    **********1489043536.65013 send command...
    1489043536.65013 cmdAfter**
    show users
    Thu Mar  9 15:15:28.510 GMT
       Line            User                 Service  Conns   Idle        Location
    RP/0/RSP0/CPU0:SN-AK-1#
    **********1489043536.65013 send command...
    1489043536.65013 cmdAfter**
    show bfd
    Thu Mar  9 15:15:29.162 GMT
    IPV4 Sessions Up: 16, Down: 7, Unknown/Retry: 0, Total: 23
    RP/0/RSP0/CPU0:SN-AK-1#
    [1] 1
    [1] joined!
    use 2.4281 sec
    
    • 50台设备执行这两条命令,7-10秒,效果不错,我只打印了show bfd结果,增大coro并发到500台设备交互效率基本维持在10秒左右
    -bash-4.3$ time perl ./CoroTelnet.pl
    Thu Mar  9 15:18:45.360 GMT
    IPV4 Sessions Up: 1, Down: 0, Unknown/Retry: 0, Total: 1
    RP/0/RSP0/CPU0:SH-SH-2#
    Thu Mar  9 15:18:45.381 GMT
    IPV4 Sessions Up: 0, Down: 0, Unknown/Retry: 0, Total: 0
    RP/0/RP0/CPU0:JS-SZ-2#
    Thu Mar  9 15:18:45.441 GMT
    IPV4 Sessions Up: 20, Down: 1, Unknown/Retry: 0, Total: 21
    RP/0/RSP0/CPU0:JS-NT-1.B#
    Thu Mar  9 15:18:45.443 GMT
    IPV4 Sessions Up: 0, Down: 0, Unknown/Retry: 0, Total: 0
    RP/0/RP1/CPU0:JS-NT-1#
    Thu Mar  9 15:18:45.445 GMT
    IPV4 Sessions Up: 17, Down: 15, Unknown/Retry: 0, Total: 32
    RP/0/RSP0/CPU0:JS-NT-2#
    Thu Mar  9 15:18:45.463 GMT
    IPV4 Sessions Up: 17, Down: 7, Unknown/Retry: 0, Total: 24
    RP/0/RSP0/CPU0:JS-CZ-2#
    Thu Mar  9 15:18:45.488 GMT
    IPV4 Sessions Up: 0, Down: 0, Unknown/Retry: 0, Total: 0
    RP/0/RP0/CPU0:JS-CZ-1#
    Thu Mar  9 15:18:45.495 GMT
    IPV4 Sessions Up: 18, Down: 2, Unknown/Retry: 0, Total: 20
    RP/0/RSP0/CPU0:JS-CZ-1#
    Thu Mar  9 15:18:45.503 GMT
    IPV4 Sessions Up: 15, Down: 6, Unknown/Retry: 0, Total: 21
    RP/0/RSP0/CPU0:ZJ-JH-2#
    Thu Mar  9 15:18:45.515 GMT
    IPV4 Sessions Up: 11, Down: 9, Unknown/Retry: 0, Total: 20
    RP/0/RSP0/CPU0:ZJ-WZ-2#
    Thu Mar  9 15:18:45.512 GMT
    IPV4 Sessions Up: 0, Down: 0, Unknown/Retry: 0, Total: 0
    RP/0/RP0/CPU0:JS-WX-1#
    Thu Mar  9 15:18:45.529 GMT
    IPV4 Sessions Up: 0, Down: 0, Unknown/Retry: 0, Total: 0
    RP/0/RP0/CPU0:JS-NT-2#
    Thu Mar  9 15:18:45.538 GMT
    IPV4 Sessions Up: 15, Down: 9, Unknown/Retry: 0, Total: 24
    RP/0/RSP0/CPU0:ZJ-JH-1#
    Thu Mar  9 15:18:45.537 GMT
    IPV4 Sessions Up: 0, Down: 0, Unknown/Retry: 0, Total: 0
    RP/0/RP0/CPU0:JS-SZ-1#
    Thu Mar  9 15:18:45.577 GMT
    IPV4 Sessions Up: 0, Down: 0, Unknown/Retry: 0, Total: 0
    RP/0/RP0/CPU0:JS-CZ-2#
    Thu Mar  9 15:18:45.590 GMT
    IPV4 Sessions Up: 9, Down: 7, Unknown/Retry: 0, Total: 16
    RP/0/RSP0/CPU0:ZJ-WZ-1#
    Thu Mar  9 15:18:45.617 GMT
    IPV4 Sessions Up: 17, Down: 21, Unknown/Retry: 0, Total: 38
    RP/0/RSP0/CPU0:ZJ-NB-2.B#
    Thu Mar  9 15:18:45.660 GMT
    IPV4 Sessions Up: 5, Down: 3, Unknown/Retry: 0, Total: 8
    RP/0/RSP0/CPU0:HB-WH-1#
    Thu Mar  9 15:18:45.719 GMT
    IPV4 Sessions Up: 12, Down: 2, Unknown/Retry: 0, Total: 14
    RP/0/RSP0/CPU0:FJ-PT-1#
    Thu Mar  9 15:18:45.726 GMT
    IPV4 Sessions Up: 34, Down: 7, Unknown/Retry: 0, Total: 41
    RP/0/RSP0/CPU0:SX-TY-1.B#
    Thu Mar  9 15:18:45.830 GMT
    IPV4 Sessions Up: 54, Down: 15, Unknown/Retry: 0, Total: 69
    RP/0/RSP0/CPU0:SN-XA-1#
    Thu Mar  9 15:18:45.963 GMT
    IPV4 Sessions Up: 10, Down: 10, Unknown/Retry: 0, Total: 20
    RP/0/RSP0/CPU0:SN-YA-1#
    Thu Mar  9 15:18:45.977 GMT
    IPV4 Sessions Up: 17, Down: 3, Unknown/Retry: 0, Total: 20
    RP/0/RSP0/CPU0:SN-WN-1#
    Thu Mar  9 15:18:46.028 GMT
    IPV4 Sessions Up: 23, Down: 7, Unknown/Retry: 0, Total: 30
    RP/0/RSP0/CPU0:SN-YL-1#
    Thu Mar  9 15:18:46.087 GMT
    IPV4 Sessions Up: 21, Down: 18, Unknown/Retry: 0, Total: 39
    RP/0/RSP0/CPU0:SC-CD-1#
    Thu Mar  9 15:18:46.050 GMT
    IPV4 Sessions Up: 35, Down: 8, Unknown/Retry: 0, Total: 43
    RP/0/8/CPU0:NX-YC-1#
    Thu Mar  9 15:18:46.163 GMT
    IPV4 Sessions Up: 8, Down: 4, Unknown/Retry: 0, Total: 12
    RP/0/RSP0/CPU0:SC-DY-1#
    Thu Mar  9 15:18:46.184 GMT
    IPV4 Sessions Up: 16, Down: 7, Unknown/Retry: 0, Total: 23
    RP/0/RSP0/CPU0:SN-AK-1#
    Thu Mar  9 15:18:46.192 GMT
    IPV4 Sessions Up: 11, Down: 16, Unknown/Retry: 0, Total: 27
    RP/0/RSP0/CPU0:SC-MY-1#
    Thu Mar  9 15:18:46.205 GMT
    IPV4 Sessions Up: 19, Down: 2, Unknown/Retry: 0, Total: 21
    RP/0/RSP0/CPU0:NM-TL-1.B#
    Thu Mar  9 15:18:46.181 GMT
    IPV4 Sessions Up: 11, Down: 3, Unknown/Retry: 0, Total: 14
    RP/0/7/CPU0:HA-LY-1#
    Thu Mar  9 15:18:46.287 GMT
    IPV4 Sessions Up: 6, Down: 0, Unknown/Retry: 0, Total: 6
    RP/0/RSP0/CPU0:GZ-BJ-1#
    Thu Mar  9 15:18:46.287 GMT
    IPV4 Sessions Up: 4, Down: 4, Unknown/Retry: 0, Total: 8
    RP/0/RSP0/CPU0:GZ-QDN-1#
    Thu Mar  9 15:18:46.310 GMT
    IPV4 Sessions Up: 6, Down: 1, Unknown/Retry: 0, Total: 7
    RP/0/RSP0/CPU0:GZ-TR-1#
    Thu Mar  9 15:18:46.325 GMT
    IPV4 Sessions Up: 7, Down: 1, Unknown/Retry: 0, Total: 8
    RP/0/RSP0/CPU0:GZ-LPS-1#
    Thu Mar  9 15:18:46.347 GMT
    IPV4 Sessions Up: 6, Down: 5, Unknown/Retry: 0, Total: 11
    RP/0/RSP0/CPU0:GZ-AS-1#
    Thu Mar  9 15:18:46.365 GMT
    IPV4 Sessions Up: 4, Down: 1, Unknown/Retry: 0, Total: 5
    RP/0/RSP0/CPU0:YN-CX-2#
    Thu Mar  9 15:18:46.431 GMT
    IPV4 Sessions Up: 5, Down: 1, Unknown/Retry: 0, Total: 6
    RP/0/RSP0/CPU0:YN-ZT-2#
    Thu Mar  9 15:18:46.449 GMT
    IPV4 Sessions Up: 5, Down: 3, Unknown/Retry: 0, Total: 8
    RP/0/RSP0/CPU0:YN-DL-1#
    Thu Mar  9 15:18:46.478 GMT
    IPV4 Sessions Up: 9, Down: 1, Unknown/Retry: 0, Total: 10
    RP/0/RSP0/CPU0:YN-LJ-1#
    Thu Mar  9 15:18:46.501 GMT
    IPV4 Sessions Up: 9, Down: 0, Unknown/Retry: 0, Total: 9
    RP/0/RSP0/CPU0:YN-BS-2#
    Thu Mar  9 15:18:46.497 GMT
    IPV4 Sessions Up: 6, Down: 1, Unknown/Retry: 0, Total: 7
    RP/0/RSP0/CPU0:YN-DL-2#
    Thu Mar  9 15:18:46.511 GMT
    IPV4 Sessions Up: 6, Down: 2, Unknown/Retry: 0, Total: 8
    RP/0/RSP0/CPU0:YN-CX-1#
    Thu Mar  9 15:18:46.596 GMT
    IPV4 Sessions Up: 5, Down: 2, Unknown/Retry: 0, Total: 7
    RP/0/RSP0/CPU0:YN-ZT-1#
    Thu Mar  9 15:18:46.676 GMT
    IPV4 Sessions Up: 5, Down: 2, Unknown/Retry: 0, Total: 7
    RP/0/RSP0/CPU0:YN-WS-2#
    Thu Mar  9 15:18:46.685 GMT
    IPV4 Sessions Up: 9, Down: 0, Unknown/Retry: 0, Total: 9
    RP/0/RSP0/CPU0:YN-LJ-2#
    Thu Mar  9 15:18:46.768 GMT
    IPV4 Sessions Up: 8, Down: 4, Unknown/Retry: 0, Total: 12
    RP/0/7/CPU0:JL-JL-1#
    Thu Mar  9 15:18:46.851 GMT
    IPV4 Sessions Up: 9, Down: 1, Unknown/Retry: 0, Total: 10
    RP/0/RSP0/CPU0:YN-BS-1#
    Thu Mar  9 15:18:49.114 GMT
    IPV4 Sessions Up: 0, Down: 0, Unknown/Retry: 0, Total: 0
    RP/0/RP1/CPU0:AH-HF-2#
    Thu Mar  9 15:18:49.974 GMT
    IPV4 Sessions Up: 0, Down: 0, Unknown/Retry: 0, Total: 0
    RP/0/RP0/CPU0:AH-HF-1#
    use 6.9964 sec
    
    real    0m7.040s
    user    0m0.191s
    sys     0m0.037s
    

    相关文章

      网友评论

          本文标题:Coro-telnet环境搭建和测试

          本文链接:https://www.haomeiwen.com/subject/ptafnttx.html