Hi, I am trying to use faye nodejs server, to which multiple android devices connect, and publish and subscribe to messages. I am pretty much new to nodejs and faye, and had a few queries.
1) CPU
I am trying to use the 'cluster' package to run multiple instances of the app which share the same port. How many cores should I leave for other processes? On superficial thought, only forever monitoring agent, data monitoring agent and garbage collector of javascript are the only other processes that I need to run on th system. Initially I was running 2 instances (1 master js process whcih forks children processes, 2 children processes which do the actual work) on a 2 core machine, 4 GB ram. But it got stuck at one point where 1 cpu was being utilized 100% and the other 1 was around 20-30%, but everything was stuck. I restarted the app and things became fine.
2) Memory usage:
I see that memory of the system keeps on increasing for some hours, and at some point of time it drops down. A few times it has got stuck to a high value and never got down, and I had to restart the app to reset the memory usage.
On some searching, it looks like it is a feature of javascript V8 engine, that only when memory piles up, it runs a garbage collector and brings down the memory. Could it be that since I am running 2 instances on 2 cores, GC is not actually getting any cpu time?
3) Client trying to connect
2 clients, I don't know from where, are sending ' {"channel":"/meta/connect","clientId":"xmge7z3g8nxbiu1ocyu2mpfqxk2jb1f","connectionType":"websocket","id":"2az"}' to server continuously (every millisecond it seems)
These are the faye logs for the same:
[2014-10-13 20:20:17.093] [DEBUG] faye - [Faye.NodeAdapter] Received message via WebSocket[hybi-13]: "[{\"channel\":\"/meta/connect\",\"clientId\":\"xmge7z3g8nxbiu1ocyu2mpfqxk2jb1f\",\"connectionType\":\"websocket\",\"id\":\"2az\"}]"
[2014-10-13 20:20:17.093] [INFO] faye - [Faye.Server] Processing messages: [{"channel":"/meta/connect","clientId":"xmge7z3g8nxbiu1ocyu2mpfqxk2jb1f","connectionType":"websocket","id":"2az"}] (local: false)
[2014-10-13 20:20:17.093] [DEBUG] faye - [Faye.Server] Passing through "incoming" extensions: {"channel":"/meta/connect","clientId":"xmge7z3g8nxbiu1ocyu2mpfqxk2jb1f","connectionType":"websocket","id":"2az"}
[2014-10-13 20:20:17.094] [INFO] faye - [Faye.Server] Handling message: {"channel":"/meta/connect","clientId":"xmge7z3g8nxbiu1ocyu2mpfqxk2jb1f","connectionType":"websocket","id":"2az"} (local: false)
[2014-10-13 20:20:17.094] [DEBUG] faye - [Faye.Engine] Flushing connection for "xmge7z3g8nxbiu1ocyu2mpfqxk2jb1f"
[2014-10-13 20:20:17.094] [DEBUG] faye - [Faye.Engine] Closing connection for "xmge7z3g8nxbiu1ocyu2mpfqxk2jb1f"
[2014-10-13 20:20:17.094] [DEBUG] faye - [Faye.Server] Processing reply: {"id":"2az","channel":"/meta/connect","successful":false,"error":"401:xmge7z3g8nxbiu1ocyu2mpfqxk2jb1f:Unknown client","advice":{"reconnect":"handshake"}}
[2014-10-13 20:20:17.094] [DEBUG] faye - [Faye.Server] Passing through "outgoing" extensions: {"id":"2az","channel":"/meta/connect","successful":false,"error":"401:xmge7z3g8nxbiu1ocyu2mpfqxk2jb1f:Unknown client","advice":{"reconnect":"handshake"}}
[2014-10-13 20:20:17.095] [INFO] faye - [Faye.Server] Returning replies: [{"id":"2az","channel":"/meta/connect","successful":false,"error":"401:xmge7z3g8nxbiu1ocyu2mpfqxk2jb1f:Unknown client","advice":{"reconnect":"handshake"}}]
Can somebody tell me what it means? And can I identify the ip address from this client id somehow so that I can at least identify from where these messages are coming in?