Symfony 8.2 Messenger Concurrency: What Breaks in Multi-Tenant Applications
Parts one and two of this series put many tenant databases behind one Symfony deployment: each request and each queued message names its tenant, a DBAL connection wrapper follows it, and a shared worker handles messages of every tenant placed on the deployment. Then Symfony 8.2 shipped messenger:consume --concurrency, and the two shared workers of the demo became one worker with four children.
The first run retried every message. The handlers saw no tenant, because the listener that sets it runs in the parent process, and the handlers now run in children. That was the easy one. The harder ones came with the numbers: on a cold worker, tenant A's twenty-second job held tenant B's one-second job for 21 seconds while three children idled, and a batch handler marked rows in tenant B's database with the ids of tenant A's notes.
This article walks through what --concurrency moved where, what...
Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE