linux安装socket.io,CentOS7- 安装WebSocket-bench 进行Socket.io的压力测试

安装WebSocket-bench

安装node

安装websocket-bench

修改文件打开数

执行测试

参照: WebSocket-bench.

安装node

参照: CentOS 7 nodeJs环境相关安装.

安装websocket-bench

npm install -g websocket-bench

①安装出现error

······

make: Entering directory `/home/vagrant/.npm-global/lib/node_modules/websocket-bench/node_modules/utf-8-validate/build'

CXX(target) Release/obj.target/validation/src/validation.o

make: g++: Command not found

make: *** [Release/obj.target/validation/src/validation.o] Error 127

······

安装 g++

sudo yum -y install gcc-c++

再次安装 OK

[vagrant@localhost vagrant]$ npm install -g websocket-bench

npm WARN deprecated extendable@0.0.6: This project has been renamed to extendible. This project will not receive any updates anymore

npm WARN deprecated node-uuid@1.4.8: Use uuid module instead

npm WARN deprecated hoek@0.7.6: The major version is no longer supported. Please update to 4.x or newer

/home/vagrant/.npm-global/bin/websocket-bench -> /home/vagrant/.npm-global/lib/node_modules/websocket-bench/bin/websocket-bench

> bufferutil@1.2.1 install /home/vagrant/.npm-global/lib/node_modules/websocket-bench/node_modules/bufferutil

> node-gyp rebuild

make: Entering directory `/home/vagrant/.npm-global/lib/node_modules/websocket-bench/node_modules/bufferutil/build'

CXX(target) Release/obj.target/bufferutil/src/bufferutil.o

SOLINK_MODULE(target) Release/obj.target/bufferutil.node

COPY Release/bufferutil.node

make: Leaving directory `/home/vagrant/.npm-global/lib/node_modules/websocket-bench/node_modules/bufferutil/build'

> utf-8-validate@1.2.2 install /home/vagrant/.npm-global/lib/node_modules/websocket-bench/node_modules/utf-8-validate

> node-gyp rebuild

make: Entering directory `/home/vagrant/.npm-global/lib/node_modules/websocket-bench/node_modules/utf-8-validate/build'

CXX(target) Release/obj.target/validation/src/validation.o

SOLINK_MODULE(target) Release/obj.target/validation.node

COPY Release/validation.node

make: Leaving directory `/home/vagrant/.npm-global/lib/node_modules/websocket-bench/node_modules/utf-8-validate/build'

+ websocket-bench@0.2.0

added 5 packages from 9 contributors and updated 6 packages in 10.198s

②版本确认出现error

[vagrant@localhost vagrant]$ websocket-bench -V

bash: websocket-bench: command not found

PATH确认

[vagrant@localhost vagrant]$ echo $PATH

/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/vagrant/.local/bin:/home/vagrant/bin

通过上面的安装信息可以看到,路径需要添加 /home/vagrant/.npm-global/bin

[vagrant@localhost vagrant]$ PATH=$PATH:/home/vagrant/.npm-global/bin

[vagrant@localhost vagrant]$ export PATH

版本确认

[vagrant@localhost vagrant]$ websocket-bench -V

0.0.3

修改文件打开数

默认是 1024,推荐 60000

确认当前设置;

[vagrant@localhost vagrant]$ ulimit -n

1024

修改

[vagrant@localhost etc]$ su

Password:

[root@localhost etc]# ulimit -n 60000

[root@localhost etc]# su vagrant

[vagrant@localhost etc]$

[vagrant@localhost etc]$ ulimit -n

60000

执行测试

websocket-bench -a 2500 -c 200 http://localhost:3000

其他一些命令

Usage: websocket-bench [options]

Options:

-h, --help Output usage information

-V, --version Output the version number

-a, --amount Total number of persistent connection, Default to 100

-c, --concurency Concurent connection per second, Default to 20

-w, --worker Number of worker(s)

-g, --generator Js file for generate message or special event

-m, --message Number of message for a client. Default to 0

-o, --output Output file

-t, --type Type of websocket server to bench(socket.io, engine.io, faye, primus, wamp). Default to socket.io

-p, --transport Type of transport to websocket(engine.io, websockets, browserchannel, sockjs, socket.io). Default to websockets (Just for Primus)

-k, --keep-alive Keep alive connection

-v, --verbose Verbose Logging

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值