My app is built using ExpressJS, AngularJS and socket.io on heroku's server.
Initially, my client kept getting disconnected with heroku's H12 error code. I believed that my processes are running for too long, but I followed it's advice and reduced socket.io's ping interval to 10 seconds and ping timeout to 25 seconds. My disconnections occur less often after making this change.
Even though the server is only supporting as little as 4-5 clients, disconnections still happen. My app is a simple poker card game that I believe do not require intense computation. At the same time, disconnection is highly undesirable because it is a real-time game. I've also handled most static assets using CDN with AWS cloudfront. Hence, Im wondering whether I should upgrade the CPU of my heroku Dyno or whether it is also necessary to increase the number of Dynos.
Is there any more configurations tweaks that I have to make on my socket.io such as pingintervals and pingtimeouts. Or should I upscale/outscale my Dynos on Heroku? Sorry for my little understanding on server optimisation. Thank you so much in advance for your help!
Below are the LOGs for normal pings intervals, in which there’s no event going on. In this case, there shouldn’t any deep processing going on at all, but as shown in the logs, the GET method took approximately 12s (Heroku will break the connection when it's 30 seconds).
2015-02-05T09:08:59.637350+00:00 heroku[router]: at=info method=POST path="/socket.io/?EIO=3&transport=polling&t=1423127340014-73&sid=MOLTkQP1knsflhZ3AAAB" host=daidi.herokuapp.com request_id=8faf8459-dfb3-4c3b-a7e2-6528c0ab9850 fwd="42.60.78.220" dyno=web.1 connect=2ms service=3ms status=200 bytes=255
2015-02-05T09:09:12.074210+00:00 heroku[router]: at=info method=GET path="/socket.io/?EIO=3&transport=polling&t=1423127340438-25&sid=_5fURAV8_Gn5736HAAAC" host=daidi.herokuapp.com request_id=b54dedb6-1733-414a-8fd3-b8d8fd1f4516 fwd="42.60.78.220" dyno=web.1 connect=1ms service=12008ms status=200 bytes=207