Recommended Default for Vaadin 24
There is no single "correct" default for all applications, but for most standard CRUD-style applications, PushMode.AUTOMATIC is the preferred choice for developer productivity. However, for high-concurrency systems or applications with high-frequency background updates, PushMode.MANUAL remains the safer architectural choice to prevent server-side CPU spikes and client-side DOM congestion.
Performance and Resource Impact
Switching to PushMode.AUTOMATIC does not increase the number of WebSocket connections, as the connection is established regardless of the push mode. Instead, it increases the frequency of data transmission. The primary impacts are:
- Server CPU: Higher utilization during peak activity because the framework automatically triggers synchronization frames whenever state changes are detected.
- Network Traffic: An increase in the volume of small WebSocket frames. While negligible for a few users, this can scale linearly with the number of active sessions.
- Client-Side Lag: Excessive automatic pushes can lead to browser main-thread congestion if the UI is forced to re-render too frequently.
Multi-tenancy and Connection Exhaustion
WebSocket connection pool exhaustion is typically a function of session timeouts and load balancer limits, not the PushMode setting. In a multi-tenant environment, the bottleneck is usually the memory footprint per session rather than the activity level of the push mode. PushMode.AUTOMATIC does not inherently accelerate connection exhaustion, though it may expose existing stability issues in the underlying WebSocket implementation under heavy load.
Compatibility and Implementation
Changing the default mode does not break existing push-enabled components, but it changes how they behave. Components relying on ui.access() will find that changes are reflected immediately in AUTOMATIC mode, whereas MANUAL mode requires an explicit ui.push() call.
Verification Steps
To determine the impact on your specific workload, use these scoped verification methods:
- Traffic Analysis: Open Browser DevTools > Network > WS. Compare the number of frames sent during a typical user flow in both modes.
- Logging: Enable DEBUG logging for
com.vaadin.flow.server.communication to monitor the frequency of push messages.
- Load Testing: Use a tool like Gatling to measure the CPU delta on the server when shifting from
MANUAL to AUTOMATIC under a simulated concurrent user load.
Diagnostic Detail Needed: To provide a more specific recommendation, please specify the average frequency of server-initiated updates per session (e.g., once per minute vs. multiple times per second).