Skip to main content

API Load Testing and Performance Benchmarking

Create API load testing scripts and performance benchmarks — k6, Artillery, or Locust with realistic scenarios and performance budgets.

Vul de plaatshouders in

Edit the values, then copy your finished prompt.

Jouw Prompt
prompt.txt

                                

What this prompt does

This prompt builds a full API load-testing suite for [api_description] using [load_test_tool]. Instead of one generic "hammer the endpoint" script, it asks for five distinct test types: a smoke test, a load test at [concurrent_users] users for [duration], a stress test that ramps to the breaking point, a spike test that surges to [spike_users], and a soak test that sustains load for [soak_duration]. It layers in realistic scenarios with think time, an authentication flow, custom metrics ([custom_metrics]), performance budgets (p95 < [p95_target]ms, error rate < [error_target]%), and CI integration with pass/fail thresholds.

The structure works because each test type answers a different question. Smoke confirms the script works, load confirms normal traffic is fine, stress finds where it breaks, spike checks sudden surges, and soak exposes leaks that only show over hours. Wiring the budgets into CI is what turns a one-off benchmark into a regression guard, so performance can't quietly erode release to release.

When to use it

  • You're about to tell a stakeholder an API is "ready" and want evidence under realistic load.
  • You suspect a memory or connection leak that only appears under sustained traffic.
  • You're sizing infrastructure and need to know where the API actually breaks.
  • You're preparing for a launch, sale, or campaign with a predictable traffic spike.
  • You want CI to fail the build when p95 latency or error rate crosses a budget.
  • You're comparing two implementations or two deploy environments fairly.

Example output

Expect a set of test scripts in [load_test_tool] syntax — one per scenario — plus test-data generation, environment configuration, and a results-analysis template with graphs. Each script encodes its own load profile and asserts against the performance budgets, and the CI configuration shows how thresholds map to pass/fail. The custom metrics like checkout completion rate are defined alongside the standard latency and error-rate checks.

Pro tips

  • Make [api_description] concrete — list the real endpoints and flow (products, cart, checkout) so the scenarios mirror genuine user journeys, not isolated calls.
  • Set [p95_target] and [error_target] from data you can defend; arbitrary budgets either never fail or always fail, and both are useless in CI.
  • Match [concurrent_users] and [spike_users] to real or projected traffic — testing at numbers you'll never see wastes time and scares people.
  • Keep think time in the scenarios; without it you measure an unrealistic worst case that no real user produces.
  • Define [custom_metrics] that map to business outcomes (cart abandonment, checkout completion) so a passing test means the funnel works, not just that bytes moved.
  • Run the soak test for the full [soak_duration] in a staging environment, not your laptop, since leaks need time and stable resources to surface.

Frequently Asked Questions

Which load testing tool does this prompt use?
It uses whatever you set for `[load_test_tool]` — k6 by default, but Artillery or Locust work too. The five test types and the performance budgets are tool-agnostic, so the structure stays the same regardless of which one you pick.
What's the difference between the stress, spike, and soak tests it generates?
Stress ramps load until the API breaks to find its ceiling, spike sends a sudden surge to `[spike_users]` to test elasticity, and soak holds steady load for `[soak_duration]` to expose leaks and slow degradation that short tests miss.
Can the tests fail my CI build automatically?
Yes. The suite encodes performance budgets — p95 under `[p95_target]`ms and error rate under `[error_target]`% — as pass/fail thresholds, so CI can block a release when a change pushes latency or errors past your defined limits.
Does it handle authenticated endpoints?
It includes an authentication flow inside the test scripts so protected endpoints are exercised realistically. You'll still need to supply valid test credentials or a token-minting step suited to your auth setup.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

Meer in API Development Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support