Push causing too many reloads only in production enviroment

Hi my my vaadin application with Push in automatic mode enabled is reloading very frequently in production. it is making the app almost unusable. This only happens sometimes around 40% of the time. It doesnt happen in the local test environement and also is caused by the @Push annotation as I didnt observe it when i removed Push. However I need to use Push for some live update functionality in my application so need a solution.

What’s the difference between the production environment and the test environment?

its a Google Coud App Engine application. While production is a localhost

For Google App Engine, you might want to turn on Session Affinity, see more here: How to deploy a Vaadin application to Google Cloud App Engine

1 Like

it doesnt seem to work still

What do you mean by reloading?
Restarting the app? Then you need a bigger instance. FĂĽr example

instance_class: F2

That’s also contained in the linked article

2024-09-09T10:39:19.254+02:00 WARN 69578 — [nio-8081-exec-2] c.v.f.server.communication.PushHandler : Invalid identifier in new connection received from 0:0:0:0:0:0:0:1 When I run it locally I get many of these warnings.

Looks very much like the lack of session affinity. That message happens when the client sends a push id that is not already registered in the session. This is the case if the same client talks with multiple servers and each server has its own (different) copy of the session for that client.

The only session management I do is, @VaadinSessionScope @Service public class GameService { private final WebClient webClient; private static final Logger logger = LoggerFactory.getLogger(GameService.class); private Game currentGame private User currentUser;
}. ` I set the currentUser based on the browser cookie value of username which i setup when a user visits my website for the first time.

Hi I read it could this be happening because since my application consumes too much memory new user session are connected to seperate app engine instances and thus push fails and it needs to reload a lot.

Might help but it won’t solve the fundamental issue that if there are multiple instances, then every request has a chance of causing issues unless you have session affinity configured.

I have session afinity set to true in my app.yaml config file. Also :PS my simple app uses almost 2 GB of memory for some reason with @Push enabled I know im doing somethig wrong but dont know what the underlying problem is?