Deep dive · Qalqul Engine · shipped
Qalqul: stateless migration, real-time systems and task dispatching
Moving Qalqul's services to stateless, horizontally scaled processes with real-time messaging, a task dispatcher, and the infrastructure behind them.
Problem
Qalqul’s services kept sessions and connections in memory, which tied each user to one process: scaling meant bigger servers, and a restart dropped live conversations. As clients grew, the contact centre also needed to dispatch work (conversations, calls, tickets) to the right agent in real time, and the infrastructure had to keep up.
Constraints
- No dropped conversations: deployments and restarts must not cut agents or customers off.
- Real time: messages, ticket changes and agent states appear instantly across many agents.
- Fair dispatching: tasks go to available, skilled agents, with no task lost or assigned twice.
- Small team: infrastructure has to be simple to run and repeat for each client.
Architecture


Key decisions
- State out of the process. Sessions, presence and connection routing moved to shared stores, so any process can serve any user.
- Fan out through pub/sub. A WebSocket gateway publishes once, and every gateway with a subscriber delivers.
- One dispatcher, explicit queues. Assignment is centralised so a task is never given to two agents.
- Repeatable infrastructure. Each client deployment is the same set of services, configured, not hand-built.
Results
Numbers to come.