Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Option to turn of logging in echo_server #37

Merged
merged 1 commit into from

2 participants

@oberstet

I am performance testing WS servers. Excessive console output can skew results. Have a look:

1st = logging on
2nd = logging off

oberstet@THINKPAD-T410S /f/scm/Autobahn/testsuite/wsperf (master)
$ python wsperf_commander.py -w ws://192.168.1.141:9002 -s node.json
Running 6 tests against 1 servers: ...... - all tests finished.

WebSocketNode/1.0.4,0,128
WebSocketNode/1.0.4,16,131
WebSocketNode/1.0.4,64,120
WebSocketNode/1.0.4,256,134
WebSocketNode/1.0.4,1024,149
WebSocketNode/1.0.4,4096,246

oberstet@THINKPAD-T410S /f/scm/Autobahn/testsuite/wsperf (master)
$ python wsperf_commander.py -w ws://192.168.1.141:9002 -s node.json
Running 6 tests against 1 servers: ...... - all tests finished.

WebSocketNode/1.0.4,0,115
WebSocketNode/1.0.4,16,87
WebSocketNode/1.0.4,64,101
WebSocketNode/1.0.4,256,118
WebSocketNode/1.0.4,1024,116
WebSocketNode/1.0.4,4096,177

@theturtle32 theturtle32 merged commit 6204cc1 into theturtle32:master
@theturtle32
Owner

Cool, thanks! Are you posting the results somewhere? I'd love to see how WebSocket-Node stacks up against the competition. :-D

@oberstet

I'll post soon .. want to make sure it's somehow significant/reliable. This is a cooperation between Peter (websocket++) and me. Will >>rock<<:

wsperf performance probe (can be multiple instances client/server) plus master/controller (Autobahn) .. I post on Autobahn G group .. think you are there so you will get that! stay tuned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 5, 2012
  1. @oberstet
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 11 deletions.
  1. +13 −11 test/echo-server.js
View
24 test/echo-server.js
@@ -1,13 +1,13 @@
#!/usr/bin/env node
/************************************************************************
* Copyright 2010-2011 Worlize Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,7 +21,8 @@ var url = require('url');
var fs = require('fs');
var args = { /* defaults */
- port: '8080'
+ port: '8080',
+ debug: 'true'
};
/* Parse command line options */
@@ -34,12 +35,13 @@ process.argv.forEach(function(value) {
});
var port = parseInt(args.port, 10);
+var debug = (args.debug == 'true');
console.log("WebSocket-Node: echo-server");
-console.log("Usage: ./echo-server.js [--port=8080]");
+console.log("Usage: ./echo-server.js [--port=8080 --debug=true|false]");
var server = http.createServer(function(request, response) {
- console.log((new Date()) + " Received request for " + request.url);
+ if (debug) console.log((new Date()) + " Received request for " + request.url);
response.writeHead(404);
response.end();
});
@@ -58,19 +60,19 @@ wsServer = new WebSocketServer({
});
wsServer.on('connect', function(connection) {
- console.log((new Date()) + " Connection accepted" +
- " - Protocol Version " + connection.webSocketVersion);
+ if (debug) console.log((new Date()) + " Connection accepted" +
+ " - Protocol Version " + connection.webSocketVersion);
connection.on('message', function(message) {
if (message.type === 'utf8') {
- console.log("Received utf-8 message of " + message.utf8Data.length + " characters.");
+ if (debug) console.log("Received utf-8 message of " + message.utf8Data.length + " characters.");
connection.sendUTF(message.utf8Data);
}
else if (message.type === 'binary') {
- console.log("Received Binary Message of " + message.binaryData.length + " bytes");
+ if (debug) console.log("Received Binary Message of " + message.binaryData.length + " bytes");
connection.sendBytes(message.binaryData);
}
});
connection.on('close', function(reasonCode, description) {
- console.log((new Date()) + " Peer " + connection.remoteAddress + " disconnected.");
+ if (debug) console.log((new Date()) + " Peer " + connection.remoteAddress + " disconnected.");
});
});
Something went wrong with that request. Please try again.