Coro-telnet环境搭建和测试

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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 201,468评论 5 473
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 84,620评论 2 377
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 148,427评论 0 334
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,160评论 1 272
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,197评论 5 363
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,334评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,775评论 3 393
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,444评论 0 256
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,628评论 1 295
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,459评论 2 317
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,508评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,210评论 3 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,767评论 3 303
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,850评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,076评论 1 258
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,627评论 2 348
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,196评论 2 341

推荐阅读更多精彩内容