Article

Easy Load Testing and Page Warming with k6, InfluxDB, and Grafana

At Sengo, we believe performance starts with preparation. Whether you’re launching a marketing campaign or expecting a spike in traffic, it’s crucial to know how your site performs under pressure—and ensure key pages are already cached and warmed up.

This guide walks through our lightweight and reproducible setup using:

  • k6 for scripting and executing HTTP load tests
  • InfluxDB to collect performance metrics
  • Grafana to visualize trends like response time, errors, and RPS
  • Docker Compose to tie everything together
Sengo Article Default Thumbnail

Why This Setup?

  • Developer-friendly: Fully containerized—no local install pain.
  • Realistic testing: Reproduce real-world traffic stages.
  • Visual feedback: Grafana updates in real-time.
  • Bonus: Warms up caches and infrastructure before go-live.

 

The Architecture

  [ k6 script ] ─▶ [ InfluxDB ]
         │             ▲
         ▼             │
     Traffic     [ Grafana Dashboard ]
       ▼
    Your Website

Docker Compose Overview

Here’s a simplified version of our docker-compose.yml:

services:
  influxdb:
    image: influxdb:1.8
    ports:
      - "8086:8086"
    environment:
      - INFLUXDB_DB=k6

  grafana:
    image: grafana/grafana:latest
    ports:
      - "3000:3000"
    environment:
      - GF_AUTH_ANONYMOUS_ENABLED=true
    volumes:
      - ./dashboards:/var/lib/grafana/dashboards
      - ./grafana-dashboard.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml
      - ./grafana-datasource.yaml:/etc/grafana/provisioning/datasources/datasource.yaml

  k6:
    image: loadimpact/k6:latest
    environment:
      - K6_OUT=influxdb=http://influxdb:8086/k6
    volumes:
      - ./scripts:/scripts

The Dashboard

Our Grafana dashboard includes:

  • Virtual users
  • Requests per second
  • Error rates
  • Latency (avg, p90, p95)
  • Response time heatmaps

All powered by InfluxDB, pre-provisioned and refreshable in real-time.

 

The k6 Load Script

This script targets all key pages of Sengo.com to simulate load and warm up caches:

import http from 'k6/http';

export let options = {
  stages: [
    { duration: '15s', target: 25 },
    { duration: '5m', target: 85 },
    { duration: '3m', target: 105 },
    { duration: '3m', target: 75 },
    { duration: '15m', target: 155 },
    { duration: '3m', target: 100 },
    { duration: '1m', target: 0 }
  ]
};

export default function () {
  http.get('https://sengo.com/');
  http.get('https://sengo.com/fr/');
  // ...more endpoints
}

Monitor in Real Time

Open http://localhost:3000 to access your Grafana dashboard. You’ll see:

  • RPS and error spikes
  • Active users over time
  • Latency distribution (p90, p95)

 

Page Warming Bonus

This script also acts as a page warmer—ensuring all your CDN and backend caches are populated ahead of critical events or traffic surges.

 

Pro Tips

  • Use Grafana variables to toggle environments
  • Embed this in your CI/CD pipeline
  • Alert on slow pages or error spikes

 

TL;DR

ToolPurpose
k6Load testing & warm-up
InfluxDBMetrics storage
GrafanaReal-time dashboard
DockerSimple local setup

Need help setting this up? Reach out to the Sengo team. We specialize in performance engineering for composable, headless, and modern web platforms.

Sengo Robot  Nikko