Skip to content

Database Load Simulation

Use this when you want to observe app behavior under sustained DB pressure before committing to integration tests or staging runs.

FlowLayer brings up the data stack and the load-generating services from one config, with explicit ordering so the pressure starts only after the API and database are ready.

{
"session": {
"bind": "127.0.0.1:6999",
"token": "dev-token-db-load"
},
"services": {
"postgres": {
"cmd": ["postgres", "-D", "./var/postgres"],
"port": 5432,
"ready": {
"type": "tcp"
}
},
"redis": {
"cmd": ["redis-server", "./infra/redis.conf"],
"port": 6379,
"ready": {
"type": "tcp"
}
},
"api": {
"cmd": ["pnpm", "--dir", "services/api", "dev"],
"dependsOn": ["postgres", "redis"],
"port": 3000,
"ready": {
"type": "http",
"url": "http://127.0.0.1:3000/health"
}
},
"worker": {
"cmd": ["pnpm", "--dir", "services/worker", "dev"],
"dependsOn": ["api", "postgres", "redis"]
},
"load-generator": {
"kind": "oneshot",
"cmd": [
"sh",
"-c",
"for i in $(seq 1 400); do curl -sS -X POST http://127.0.0.1:3000/orders -H 'content-type: application/json' -d '{\"customerId\":\"dev\",\"amount\":42}'; done"
],
"dependsOn": ["api"]
}
}
}
Terminal window
flowlayer-server -c ./flowlayer.jsonc
Terminal window
flowlayer-client-tui -addr 127.0.0.1:6999 -token dev-token-db-load

What to watch:

  • API logs for request bursts and failures
  • worker logs for queue or retry behavior
  • service status transitions when dependencies restart

For heavier runs, execute the server on a VM or shared machine and connect from your laptop:

Terminal window
flowlayer-client-tui -addr 10.42.0.50:6999 -token dev-token-db-load

If possible, prefer VPN or SSH tunnel access over direct exposure.

  • Use dedicated development data stores and credentials.
  • Never point this pattern at production databases.
  • Limit test volume to what your dev environment can handle.
  • Rotate tokens when running on shared hosts.
  • This pattern simulates runtime behavior for development.
  • FlowLayer is not a load-testing platform and not a production orchestrator.
  • It does not replace Kubernetes, Docker Compose, PM2, or systemd.