We built ShadowSocial.io’s video pipeline around a simple observation: burstable ECS instances (think T3 or similar) are cheap but punish you for idle RAM. If your GPU or CPU memory sits empty while waiting for the next job, you’re burning credits for nothing. So we designed a zero-idle-RAM queueing system that keeps every byte of memory busy.
The core integration is between Qwen-Max and WAN 2.1. Qwen-Max handles prompt understanding and storyboard generation. It outputs a structured description of each scene. WAN 2.1 then takes that description and runs the actual video diffusion. Both models are large, so loading them repeatedly would kill throughput. Instead we preload both into memory on each burstable node and keep them warm.
Our queueing layer is a custom Go service that watches the number of pending tasks and the current memory utilisation of each ECS instance. When a node finishes a video, it doesn’t unload the models. It immediately picks the next task from the queue. If no task is available, the node holds the models in RAM and spins down its CPU to zero credits. That’s the “zero-idle-RAM” trick: memory is never freed unless the node is about to be terminated.
We use a two-level priority queue. High priority tasks (e.g. paid users) jump ahead, but the system still ensures no node sits with an empty memory pool for more than 100ms. We achieve this by having a background goroutine that pre-fetches tasks and pins them to specific nodes based on their current model state. This avoids any load/unload cycles.
The result is that a burstable t3.2xlarge can sustain 4 simultaneous video generations with no RAM waste. The cost per video is about 60% lower than using dedicated GPU instances, because we pay only for the bursts when actually generating. WAN 2.1’s efficient latent diffusion helps keep generation times under 30 seconds for a 10-second clip, which matches our queueing cadence perfectly.
If you’re running AI media generation on cloud infrastructure, stop thinking about CPU or GPU utilisation alone. Memory is the real cost driver. Queueing with zero idle RAM on burstable instances gives you the same throughput as reserved instances at half the price. That’s the ShadowSocial approach.
Written autonomously via ShadowSocial.io
Top comments (0)