drewww / socket.io-benchmarking

A framework for testing high concurrency behavior in socket.io
221 stars 40 forks source link

Client concurrences connect but do not send messages #3

Open davidfooks opened 12 years ago

davidfooks commented 12 years ago

My server logs:

25 Jan 16:37:26 - info: users: 102 messagesPerSecond: 0 25 Jan 16:37:27 - info: users: 102 messagesPerSecond: 0 25 Jan 16:37:28 - info: users: 102 messagesPerSecond: 0 25 Jan 16:37:29 - info: users: 102 messagesPerSecond: 0 25 Jan 16:37:30 - info: users: 102 messagesPerSecond: 0 25 Jan 16:37:31 - info: users: 102 messagesPerSecond: 0 25 Jan 16:37:32 - info: users: 102 messagesPerSecond: 0 25 Jan 16:37:33 - info: users: 102 messagesPerSecond: 0 25 Jan 16:37:34 - info: users: 102 messagesPerSecond: 0 25 Jan 16:37:35 - info: users: 102 messagesPerSecond: 0

For 100 concurrences (they dont seem to close properly but I don't mind restarting). But it doesn't appear to be sending anything. Do I need to do something on the client in order to get it to send messages?

drewww commented 12 years ago

Hmm. Running on the master branch, it seems okay for me. What's in the java client's logs? It looks like this for me

---------------- CONCURRENCY 100 ----------------
All 100 clients connected successfully.
Woken up - time to start load test!
100 connections at 1:  rate: 0.999  n:    10 min:        1  mean:        2   max:        3   stdev:        1
100 connections at 2:  rate: 2.097  n:    20 min:        1  mean:        5   max:        9   stdev:        3
100 connections at 3:  rate: 3.204  n:    30 min:        1  mean:        5   max:       16   stdev:        4
100 connections at 4:  rate: 4.308  n:    40 min:        1  mean:        5   max:       22   stdev:        4
davidfooks commented 12 years ago

Hmm, I'm running:

c:\workspace\socket.io-benchmarking\client\src>java -cp .;WebSocket.jar;commons-math-2.2.jar SocketIOLoadTester 100

SocketIOLoadTesterUsing custom concurrency levels: 100 ---------------- CONCURRENCY 100 ----------------

But the clients are all showing as connected on the server so I would expect to see the "All 100 clients connected successfully." message. I'll add so more println's and find out whats going on.

Thanks for your help!

drewww commented 12 years ago

Yeah, presumably it's not getting the right callback on connections. It needs onOpen to fire on each SocketIOClient before they'll start sending.

This is a stupid OS-X centrist thing to say, but there may be something with windows that's weird. I've never really done windows dev in a serious way. Also, for what it's worth, I run it via Eclipse with no arguments and let it default to its internal concurrencyLevels list. I honestly haven't tested the argument-based startup so you may have more luck running without arguments.

davidfooks commented 12 years ago

Ok.

So the client connections are all created and then all the threads hit wait(). But notifyAll() is never called in onOpen in-fact onOpen is never called at all.

This is odd seeing as the connection is registered as open on the server. Opening wireshark shows me that the node.js socket.io server is not sending a response to the WebSocket handshake started by the Java client:

GET /socket.io/1/websocket/2157041091073822846 HTTP/1.1 Sec-WebSocket-Version: 8 Upgrade: websocket Host: 192.168.187.128:8080 Origin: Connection: Upgrade

Not sure if socket.io actually supports WebSocket-Version: 8

davidfooks commented 12 years ago

Ah, figured out how to turn on logging by changing:

io.set("log level", 3);

I'm getting the message:

26 Jan 12:27:57 - info: users: 0 messagesPerSecond: 0 debug - client authorized info - handshake authorized 1952042454290820979 debug - setting request GET /socket.io/1/websocket/1952042454290820979 debug - set heartbeat interval for client 1952042454290820979 warn - websocket connection invalid: received no key info - transport end debug - set close timeout for client 1952042454290820979 debug - cleared close timeout for client 1952042454290820979 debug - cleared heartbeat interval for client 1952042454290820979 debug - client authorized for 26 Jan 12:27:58 - info: users: 1 messagesPerSecond: 0

So the request is missing: sec-websocket-key

This is probably a bug in the request logic in Java-WebSocket library. Ill raise it with them.

drewww commented 12 years ago

It might well be, although it must be something platform-specific because everything looks good on my end. Maybe some sort of line termination issue in the requests? It's worked for me with every combination of OS X + Ubuntu as client and server, but I don't have a windows machine handy.

davidfooks commented 12 years ago

Ah, ok so its an issue with the draft that the client is using which is unsupported by socket.IO. Adding:

import net.tootallnate.websocket.drafts.Draft_17;

public SocketIOClient(URI server, SocketIOClientEventListener listener) {
    super(server, new Draft_17());

To SocketIOClient.java fixes this