Static vs Dynamic Agent Provisioning
What you'll learn: How to choose between always-on permanent agents and on-demand temporary agents in Jenkins.
When Jenkins needs to run builds, it can use two fundamentally different approaches to provide compute resources: static agents that are always available, or dynamic agents that are created on-demand.
Static Agent Provisioning
Static agents are permanently configured machines that stay connected to the Jenkins master continuously. Think of them like full-time employees—they're always clocked in, waiting for work to arrive. You configure them once with specific labels, tools, and capabilities, and they remain available indefinitely.
When to use static agents:
- Builds require specialized hardware (GPUs, specific architectures)
- Long-running or scheduled jobs that need consistent environments
- Security requirements demand fixed, audited machines
- Your infrastructure already has dedicated build servers
Trade-offs: You pay for idle time. If builds are infrequent, static agents sit unused but still consume resources and costs.
Dynamic Agent Provisioning
Dynamic agents are created on-the-fly when builds start and destroyed when complete. Picture them as gig workers—they only exist when there's work to do. Jenkins can spawn agents in Docker containers, Kubernetes pods, or cloud VMs, then tear them down automatically.
When to use dynamic agents:
- Variable or bursty build workloads
- Cost optimization is critical (pay only for active build time)
- Clean environments needed for each build
- Scalability is a priority (handle sudden load spikes)
Trade-offs: Startup time delays builds slightly. Requires infrastructure that supports programmatic provisioning (Docker, Kubernetes, AWS, etc.).
Making the Choice
Most modern Jenkins deployments use a hybrid approach: static agents for specialized workloads or critical jobs, dynamic agents for standard builds that benefit from elasticity and cost efficiency.
Key Takeaway: Static agents provide consistent, always-available capacity for specialized needs, while dynamic agents offer cost-effective scalability by provisioning compute resources only when builds actually run.