Today I have observed that kite api websocket get's diconnected every few minutes. Apart from this time stamp field in ticks streamed through websocket & wall clock keeps increasing till about 70 to 120 seconds then web socket disconnects. I haven't experienced this kind of lag & disconnect combination before. Any solution would be appreciated if the issue is on my side. I am using node.js api as and not blocking the process. I have a dedicated process to receive ticks and just queue the ticks into message broker as soon as I get them and I don't do any additional computation in this process. I have only been watching banknifty march futures and missed the good trend from 12 PM while debugging this issue. Still experiencing the issue as I write this.
Lag seems to be proportional to number of instruments/tokens that I am listening to. At lower token count lag stabilises but as the number of tokens increase lag keeps going out of control. If it's stabilising at lower token count and keeps increasing at higher token count then it's either your server side issue (with probably recent update) or client library issue.
I don't have much time to debug your server side issues. Lag seems to slowly increase if token count crosses 100. .
At 75 instruments, I am getting smooth streaming with about 1 to 2 second lag. You should probably specify what are the maximum instruments that we can listen to without overloading your system.
I am now subscribed to around 220 instruments and seems to be working smooth now. You either fixed software issue (if any) or provisioned additional capacity.
You should probably enforce hard limits on streaming if you can't handle the load.
@sujith this is an issue and happens frequently as is mentioned in the original post. below keeps on repeating in every two three minutes. 03-Mar-21 15:36:03 - kiteconnect.ticker - ERROR - Connection error: 1006 - connection was closed uncleanly (None) 03-Mar-21 15:36:03 - ticker - INFO - Connection error: 1006 - connection was closed uncleanly (None) 03-Mar-21 15:36:03 - kiteconnect.ticker - ERROR - Connection closed: 1006 - connection was closed uncleanly (None) 03-Mar-21 15:36:03 - ticker - INFO - Connection closed: 1006 - connection was closed uncleanly (None) 03-Mar-21 15:36:06 - ticker - INFO - Successfully connected.
Same thing that I described in first comment again started around 12PM. Again reduced instruments listened to less than 100 and now the lag disappears. If it's going to be a dance that your servers do every day at 12PM from now on please let us know.
I don't have much time to debug your server side issues. Lag seems to slowly increase if token count crosses 100.
.
You should probably enforce hard limits on streaming if you can't handle the load.
03-Mar-21 15:36:03 - kiteconnect.ticker - ERROR - Connection error: 1006 - connection was closed uncleanly (None)
03-Mar-21 15:36:03 - ticker - INFO - Connection error: 1006 - connection was closed uncleanly (None)
03-Mar-21 15:36:03 - kiteconnect.ticker - ERROR - Connection closed: 1006 - connection was closed uncleanly (None)
03-Mar-21 15:36:03 - ticker - INFO - Connection closed: 1006 - connection was closed uncleanly (None)
03-Mar-21 15:36:06 - ticker - INFO - Successfully connected.