I’m using kubernetes and nginx ingress to load balance my meteor app. Nginx ingress supports only cookie approach for session affinity and in case of browser everything works fine. I also have a cordova application which communicates with meteor server over dpp with web sockets only but as far as I know both android and ios cordova webviews doesn’t support cookies. The question is what should I do to load balance traffic coming from my cordova application with sticky session?
I am sure that SockJS requires sticky sessions, in case of cordova I think DDP also requires sticky session even if the app uses native WebSockets. When your cordova app is being closed or backgrounded the web socket connection will be destroyed and next time you open then app it will create new DDP connection so your app could connect to different server if there is no sticky session support. This behavior leads to much higher load on server and client because from the point after reconnecting the server would know nothing about the client and it will send all the data the client is subscribed even if the client already has all the data.
So this is not about being load balanced or not. What you need first is for DDP to restore the same connection when the app reconnects even with the same server.
I am not sure but I think that meteor keeps some DDP cache for every user, so it shouldn’t be a problem that for every reconnect new connection is being established. The problem is that when client reconnects it should connect to the same server because other servers have zero information about previous DDP session.
I wonder why we’re the only ones who noticed this, it’s like there are no other Meteor/Cordova/iOS users who use load balancers with sticky sessions and cookies ?
thx, at some point we could fix it (i don’t remember how)… but it recently broke again. We have currently re-enabled websockets that do not require sticky session for this one meteor-cordova-project we have and we do not create new projects with meteor and/or cordova anymore.