SproutStackSproutStack home
IntermediateHazelcast

Embedded members in an autoscaling app

Sessions live in embedded Hazelcast inside pods that scale every few minutes.

The setup today

A web application stores user sessions in an IMap. Hazelcast runs embedded, so every application pod is also a data member. Kubernetes scales the pods between 4 and 20 on CPU usage.

Current configuration

topology: embedded (member in every app pod)
map: sessions   backup-count: 1
autoscaler: 4 to 20 pods, scales every few minutes at peak

What you know

  • Latency spikes line up with scale-up and scale-down events.
  • After large scale-downs, some users lose their sessions.

The new requirement

Traffic is getting spikier, so autoscaling will happen more often. Sessions must not be lost, and scaling must stop causing latency spikes.

Make the call

2 questions · first-try answers earn the most XP

1. What is the most effective change?
2. Why are sessions lost during large scale-downs?
What a strong answer also covers
  • If embedded mode must stay, scale down one pod at a time and wait for migrations (a graceful shutdown hook plus a slow scale-down policy).
  • Run the data cluster as a StatefulSet across zones, with zone-aware backups.
  • Ask whether sessions need to be shared at all: signed cookies or tokens can remove the store entirely.
  • Watch migration counts and partition safety in monitoring, not just pod CPU.

The background

More drills