Worker
Ejecuta tu código con tareas de una cola. Los usuarios nunca esperan por él. Enlázalo a los datos que lee una exportación.
Esta página aún no está traducida al español.
The Worker stands for a background job runner such as Sidekiq: your code, off the request path.
When to place it#
Place a Worker when you place a Queue, because without one tasks have nowhere to go.
Add copies when Queue depth keeps growing.
How it works#
It pulls tasks from a Queue and runs the async part of each kind. It sends read and write queries, object puts, push messages, and calls to customer servers. It runs the same runtimes and frameworks as an App Server, with an instance type and size. Users never wait for it, and its throughput decides whether the Queue drains or grows.
An export runs many read queries in its task, and an upload stores its file, so link the Worker to the data it reads and writes: the Database, a Cache, a Read Replica, and Object Storage. Link it to the Push Provider for notifications.
Options#
| Control | Valores | Cuándo |
|---|---|---|
| Runtime | 28 runtimes | Siempre |
| Framework | 30 frameworks | Siempre |
| Tamaño del pool | 1 worker o más | Runtimes con pool |
| Gestor de procesos | Estático / Dinámico / Bajo demanda | PHP-FPM |
| Reciclar workers | Desactivado / Cada pocas horas | Runtimes persistentes |
| Compresión | Desactivado / Gzip | Tras Compresión |
| Servicio | Cualquier Servicio | Dos o más Servicios |
| Prefetch | 1 / 10 / 100 | Siempre |
The Stack controls work as they do on an App Server. A Worker fills its pool with tasks instead of requests, and a task holds a worker for as long as it runs, including every backend call it waits on.
Pool size: how many tasks run at once. More workers drain the Queue faster, hold more memory, and cost more CPU when the tasks compete for it.
Process manager: PHP-FPM's rule for which workers stay running. Static keeps the whole pool resident, Dynamic keeps two spares, and On demand keeps only the busy workers. The trade is the same: idle RAM against a short wait for a fork.
Recycle workers: restarts each process now and then, which caps a leak and costs a cold start. A planned restart hands its prefetched tasks back first.
Prefetch: how many tasks each worker takes from the Queue ahead of time. A higher prefetch spends less time waiting on the broker, and a crash loses more.
How it fails#
Too slow, and the Queue backlog grows until its max length refuses new tasks.
A crash loses the tasks it had prefetched. A planned restart hands them back first.
Instance failure#
Signs: The Worker's card goes grey, its Inspector reads "The host under this VM died. It still bills.", and the requests sent to it are stranded.
Do now: Press Replace in its Inspector and pay the price. It comes back cold.
Prevent: Run a second copy: Load balancing puts the copies behind a Load Balancer, and Health checks skip the dead host. A copy inside a Cluster is rescheduled by itself.
Zone outage#
Signs: Every Node in one zone goes grey at once.
Do now: Nothing brings the zone back sooner. Fail over promotes a Standby, and this Component keeps none, so it ends on its own after at most 120 s.
Prevent: Research Multiple zones, then put copies in different zones with the Zone setting.
Region outage#
Signs: Every Node in one region goes grey at once, and that region's board goes grey with them.
Do now: Press Fail over on the banner. It needs Multiple zones and a second open region, and starts the Node again in the nearest other region, cold, for the price of a replacement. Otherwise it comes back when the incident ends: 180 sim seconds in the catalog, 60 once the error budget counts.
Prevent: Research Multiple regions and GeoDNS, then run a copy of it in a second region.
Poison message#
Signs: The Queue's depth climbs without end while Workers stay busy, and its Inspector reads "A task keeps failing. Workers retry it forever."
Do now: Select the Queue and press Delete message. With a dead-letter queue on, nothing is needed; it ends on its own after at most 120 s.
Prevent: Turn on the Dead-letter queue on the Queue and set max attempts. No Research is needed.
Spot reclaim#
Signs: Its Inspector reads "The provider reclaims this Spot Node in N s. Replace it with on-demand." After 10 s the Node goes grey.
Do now: Press Switch to on-demand before the warning runs out. Otherwise it comes back by itself once the incident ends.
Prevent: Keep Nodes on the request path on On-demand or Reserved pricing, and use Spot only on a fleet that can lose a Node.
Bad deploy#
Signs: The error rate jumps right after a deploy, and a "Bad deploy" banner appears with a Roll back button.
Do now: Press Roll back on the banner. It needs Continuous delivery; without it the incident ends on its own after at most 120 s.
Prevent: Research Continuous delivery and Automated tests. A Canary deploy strategy and Feature Flags cap how much a bad deploy breaks.
Bad config push#
Signs: App Servers and Workers crash together, and a "Bad config push" banner appears with a Roll back button.
Do now: Press Roll back on the banner. They restart on the old config.
Prevent: Research GitOps and stage the rollout, so a push reaches one region first.
Connection exhaustion#
Signs: The Database's card reads "Refusing N queries/s: too many connections."
Do now: Nothing on the App Servers ends it; it ends on its own after at most 40 s. A Connection Pooler between the App Servers and the Database caps the connections it holds.
Prevent: Research Connection pooling and place a Connection Pooler in front of the Database.
Tips#
Link Workers to an Autoscaler to follow the backlog.
Keep prefetch low on Workers that crash often.
Reglas#
- Cada copia adicional cuesta un 25% más que la anterior.
- Al venderlo se devuelve el 50% de lo que costó su última copia.
- Su tipo de instancia fija su tamaño y su Gasto. Cada paso de tamaño duplica sus recursos y su Gasto.
- Una copia nueva arranca en frío y va lenta hasta que se calienta.
Funciona con#
Servidor de aplicaciones, Base de datos, Pooler de conexiones, Caché, Réplica de lectura, Almacenamiento de objetos, Cola, Función serverless, Autoescalador, Proveedor de notificaciones push
Investigación siguiente#
Cuando tengas Trabajos en segundo plano, estas Investigaciones se apoyan en ella.
Seguridad#
Estas vulnerabilidades pueden afectarle. Aplica el parche antes de que acabe el plazo de gracia.
- CVE-2026-0042, CVSS 5.3
- CVE-2026-1024, CVSS 9.9