Lab 4: Load Profiles
Learning Objectives
By the end of this lab, you'll understand:
- ✅ What load profiles are and why they matter
- ✅ How to implement smoke tests (minimal load)
- ✅ How to implement ramp tests (gradual increase)
- ✅ How to implement step tests (staircase increases)
- ✅ How to implement spike tests (sudden jumps)
- ✅ How to analyze results for each profile
Real-World Scenario
Your product team asks: "How does our system behave under different loads?"
You need to answer: - Smoke test: Can the system handle 1 user? (sanity check) - Ramp test: What happens as load gradually increases to 100 users? - Step test: At what point does performance degrade? (50 users → 100 → 200?) - Spike test: Can we handle a sudden viral moment (100 → 10,000 users instantly)?
Each load profile reveals different bottlenecks.
Concept: Load Profiles
Smoke Test
Purpose: "Is the system running?"
Ramp Test
Purpose: "Where does it start struggling?"
Step Test
.injectOpen(
constantUsersPerSec(50).during(60),
rampUsersPerSec(50).to(100).during(60),
constantUsersPerSec(100).during(60),
rampUsersPerSec(100).to(150).during(60)
)
Purpose: "At which step does latency jump?"
Spike Test
.injectOpen(
constantUsersPerSec(10).during(60),
rampUsersPerSec(10).to(500).during(30),
constantUsersPerSec(500).during(60),
rampUsersPerSec(500).to(10).during(30)
)
Purpose: "Can we recover from sudden load?"
Running the Lab
cd /Users/sgovinda/Learn/GatlingLearning
# Smoke Test
mvn gatling:test -Dgatling.simulationClass=io.learn.gatling.simulations.http.Sim04_LoadProfileSmoke
# Ramp Test (5+ minutes)
mvn gatling:test -Dgatling.simulationClass=io.learn.gatling.simulations.http.Sim04_LoadProfileRamp
# Step Test (4+ minutes)
mvn gatling:test -Dgatling.simulationClass=io.learn.gatling.simulations.http.Sim04_LoadProfileStep
# Spike Test (3+ minutes)
mvn gatling:test -Dgatling.simulationClass=io.learn.gatling.simulations.http.Sim04_LoadProfileSpike
Expected Results
| Test | Requests | Success | p95 Latency |
|---|---|---|---|
| Smoke | 60+ | 100% | <1000ms |
| Ramp | 600+ | >99% | increases with load |
| Step | 400+ | >99% | shows steps |
| Spike | 1000+ | >95% | high during spike |
Key Takeaways
- Smoke test = sanity check
- Ramp test = performance curve
- Step test = threshold identification
- Spike test = resilience testing
- Each profile reveals different insights
Navigation
← Previous: Lab 3: Checks & Validation
→ Next: Lab 5: CRUD Operations
↑ Up: Lab Overview