PortfolioFahad Habib
Case study 02Celery queue redesign

SendFlow

Reorganized Celery workloads around task characteristics instead of client groups, cutting overall cloud cost by 34% and latency by more than 63%.

PythonCeleryECSSQSConcurrencyAutoscalingGoHighLevel
34%

lower cloud cost

63%+

lower latency

5,000+

buyers in a single deal flow

Context

System context.

Background

SendFlow filters buyer buy boxes, generates personalized deal messages, delivers them through GHL, and schedules optional SMS, email, and follow-ups. A single deal may need to reach more than 5,000 buyers quickly.

Challenge

The previous architecture assigned one Celery queue to every five clients. Supporting only 115 clients already required 23 worker tasks, and worker count would continue to grow linearly. GHL rate limits and large SendFlow bursts made simple consolidation unsafe.

Architecture

Architecture and implementation.

Before

Client-grouped workers

Legacy

Queues and workers scaled with client groups instead of workload type, mixing SendFlow, CPU-bound, and I/O-bound tasks within the same partitions.

115 clients23 client groups
Celery queuesone per 5 clients
ECS workers23 worker tasks
Mixed tasksSendFlow + CPU + I/O
GoHighLevelrate-limited delivery
After

Workload-specific routing

Current

Routing moved from client identity to workload type, allowing each worker pool to scale and tune concurrency independently.

SendFlow

All clientsshared routing
SendFlow queuededicated
ECS workers8–10, autoscaled
GoHighLevelup to 5,000+ buyers

I/O-bound

I/O tasksnetwork + integrations
I/O queueisolated
ECS workers12–16 concurrency

CPU-bound

CPU taskscompute-heavy
CPU queueisolated
ECS workers4 concurrency
01

Dedicated SendFlow queue

Routed every client's SendFlow request to one purpose-built queue instead of maintaining client-specific queue groups.

02

Autoscaled delivery workers

Used 8-10 consumers for the shared queue, providing enough throughput for large buyer lists while retaining room to autoscale.

03

Workload-based segregation

Separated CPU-bound and I/O-bound jobs into dedicated queues to prevent different workload profiles from competing for the same worker capacity.

04

Concurrency tuned by workload

Ran I/O-bound workers at 12-16 concurrent jobs and CPU-bound workers at four, matching resource allocation to the real execution profile.

Outcome

Results.

  • Reduced overall cloud expenditure by 34%, not only ECS worker cost.
  • Decreased asynchronous workload latency by more than 63%.
  • Removed linear queue growth tied directly to client count.