1. First of all, the user to write their own business pressure test Logic generator.js script on each of the pressure measuring machine 2. Get through the SSH login key of each pressure measuring machine
Here I ask colleagues to get a relatively quick and convenient configuration method----
Use the secret key from the CentOS system--------> tap the ssh character, then double-press the TAB key
There will be some data that we want ....
Then execute ssh-copy-id [email protected] Address
There will be some options, we choose Yes, and the root account to enter the password can be,
After success, we verify that we have successfully cooperated with the secret key--------------our console is to link more than one ballast machine, so to other ballast machine is the public key, the console is a private key
Direct-Typing SSH IP address to see if login is successful
3 Websocket-bench, controlling script writing
#!/bin/bash#disabled selinuxnodes="172.18.10.38172.18.10.37172.18.10.36172.18.10.35172.18.10.34172.18.10.33172.18.10.32172.18.10.31172.18.10.30172.18.10.49" forNodeinch${nodes} Do //---------The brace here is to let it run the command in parallel if you want to remove the {}& serially{echo"online ${node} ..."ssh [email protected]${node}"cd/usr/lib/node_modules/websocket-bench/lib/&& websocket-bench-a 998-c 2-k-G generator.js http://172.18 .10.10:3380"}& Done
View Code4 Loading Machine Generator.js script
1 /*global module, require*/2 vari =0;3 varm =1;4 varc =0;5 varLogger = require ('./logger');6 varStart =Date.now ();7 setTimeout (function () {8}, +);9Module.exports = {Ten onconnect:function (client, done) { One //Subscribe to Messages A var_m =m; -Client.emit ('Pusher_test:subscribe', {channel:'private-group-no'+ _m, Auth:'Callback'}); - Console.log (m); the //Send Message - setinterval (function () { - if(i<1000000000){ -Client.emit ('Pusher_test:messgae', {channel:'private-group-no'+ _m, msg:'I am >'+ ++i +'a message'}); +}}, +); - //Listening Messages +Client.on ('private-group-no'+_m, function (content) { AConsole.log (NewDate () +NewDate (). getmilliseconds ()); at Console.log (content); - }); -C + +;//is to determine the total number of subscribers - ifC2==0) { -m++; - } in Done (); -}};
View Code
Websocket-bench Distributed pressure measurement deployment