Comprehensive k6 Load Testing – Stress, Performance & Scalability

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1358
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1250
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    956
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1188
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    929
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    947

You launch a new release, and the site crashes at the first traffic spike. Or your API starts lagging at 1000 concurrent requests, though you promised 5000. Sound familiar? We encounter these situations regularly. Our engineers with 10+ years of experience in load testing help identify bottlenecks before they become problems. Over 5 years, we have delivered more than 50 load testing projects for websites, APIs, and microservices. We develop fully customized load tests using k6 – the modern tool from Grafana Labs. Get a consultation for website performance testing – we evaluate your project in 2 days. Our clients typically see a 30–50% reduction in support costs, translating to thousands of dollars saved monthly.

Why is load testing important for your business?

Load Testing Challenges and Why k6 Solves Them

  • N+1 queries in the API – common when an ORM generates hundreds of database calls. k6 highlights response time growth under load.
  • Suboptimal caching – Redis or Memcached may saturate the network if misconfigured. Tests pinpoint the issue.
  • Slow frontend builds – poor bundle splitting leads to large downloads. k6 emulates real users.

Load testing saves up to 50% on support budget and reduces bottleneck detection time by 3x.

k6 is 2x faster to set up than JMeter and requires no GUI. Scenarios are written in JavaScript, making them easy to integrate into your CI/CD pipeline. Built-in metrics and thresholds provide objective performance evaluation. Learn more about k6 thresholds. We specialize in k6 CI/CD testing, enabling automated performance checks in your pipeline.

How do we approach load testing?

Our engineers configure the environment for your project. We use:

  • k6 v0.49 (stable)
  • Node.js 20 for test data generation
  • Docker for isolated test execution
  • InfluxDB 2 for metrics storage
  • Grafana 10 for real-time dashboards

Example GitLab CI integration:

load-test:
  script:
    - docker run --rm -v $CI_PROJECT_DIR:/tests grafana/k6 run /tests/script.js

This demonstrates how to integrate k6 CI/CD testing into your workflow.

After execution, k6 outputs a summary:

✓ http_req_duration.............: avg=132ms min=45ms med=112ms max=1.2s p(90)=245ms p(95)=380ms
✓ http_req_failed...............: 0.12%  ✓ 4 / ✗ 3312
✗ http_req_duration{p(99)}......: avg=980ms min=780ms — exceeded 2000ms threshold

Key indicators:

  • p(95) – 95% of requests faster than this value. If your threshold is 500ms and p(95)=380ms – all good.
  • http_req_failed – error rate. Should be <1% (or <0.1% for high-load systems).
  • Thresholds – if exceeded, the test is considered failed. We configure them to match your SLA.

Which metrics are important for load testing?

Metric Description Typical Threshold Critical When Exceeding
http_req_duration p(95) 95% of requests faster than <500 ms User-facing scenarios
http_req_failed Fraction of failed requests <1% Any test
http_req_waiting Time spent waiting for response <400 ms API
iteration_duration Time of one iteration <2 s Complex scenarios

Deliverables: What’s Included in Our Service

  • Architecture analysis and SLA target definition
  • Scenario development: smoke, load, stress, soak
  • Integration with Grafana/InfluxDB for visualization
  • Documentation with results and recommendations
  • Team training on running and modifying tests
  • 30-day post-delivery support

Test Types Comparison

Type Purpose Duration Load
Smoke Verify basic functionality 30-60 sec 1-5 VUs
Load Typical expected load 10-30 min 50-100% of expected
Stress Peak load 5-10 min 150-200% of expected
Soak Long-term stability 1-24 hours 80% of expected

Example Scenarios

Basic scenario (smoke)

Basic Smoke Test Script
// scripts/smoke-test.js
import http from 'k6/http';
import { check, sleep } from 'k6';
import { Rate } from 'k6/metrics';

const errorRate = new Rate('error_rate');

export const options = {
    vus: 10,
    duration: '30s',
    thresholds: {
        http_req_duration: ['p(95)<500'],
        http_req_failed:   ['rate<0.01'],
        error_rate:        ['rate<0.05'],
    },
};

export default function () {
    const res = http.get('http://localhost:8080/api/products');
    const ok = check(res, {
        'status is 200':        r => r.status === 200,
        'response time < 500ms': r => r.timings.duration < 500,
        'has data array':        r => r.json('data') !== undefined,
    });
    errorRate.add(!ok);
    sleep(1);
}

Ramp-up scenario (gradual load increase)

export const options = {
    stages: [
        { duration: '2m', target: 10 },
        { duration: '5m', target: 10 },
        { duration: '2m', target: 50 },
        { duration: '5m', target: 50 },
        { duration: '2m', target: 100 },
        { duration: '5m', target: 100 },
        { duration: '2m', target: 0 },
    ],
    thresholds: {
        http_req_duration: ['p(99)<2000'],
        http_req_failed:   ['rate<0.02'],
    },
};

Scenario with authorization

import http from 'k6/http';
import { check, group, sleep } from 'k6';
import { SharedArray } from 'k6/data';

const users = new SharedArray('users', () =>
    JSON.parse(open('./data/users.json'))
);

export default function () {
    const user = users[Math.floor(Math.random() * users.length)];

    let loginRes;
    group('Login', () => {
        loginRes = http.post('http://localhost:8080/api/auth/login',
            JSON.stringify({ email: user.email, password: user.password }),
            { headers: { 'Content-Type': 'application/json' } });
        check(loginRes, {
            'login successful': r => r.status === 200,
            'token received':   r => r.json('access_token') !== undefined,
        });
    });

    const token = loginRes.json('access_token');
    const headers = { Authorization: `Bearer ${token}` };
    sleep(1);

    group('Browse Products', () => {
        const res = http.get('http://localhost:8080/api/products?page=1', { headers });
        check(res, { 'products loaded': r => r.status === 200 });
        sleep(2);
    });

    group('Create Order', () => {
        const res = http.post('http://localhost:8080/api/orders',
            JSON.stringify({ product_id: 1, quantity: 1 }),
            { headers: { ...headers, 'Content-Type': 'application/json' } });
        check(res, { 'order created': r => r.status === 201 });
    });
    sleep(1);
}

How to Get Started: Steps, Timeframes, and Cost

  1. Define user scenarios and target metrics (SLA).
  2. Write k6 scripts emulating user behavior.
  3. Run a smoke test to verify correctness.
  4. Execute load and stress tests in a production-like environment.
  5. Analyze results, identify bottlenecks, and guide performance optimization.

Basic set of load scenarios (smoke, load, stress, soak): 3–5 days. Cost starts from $1,500 and is calculated individually after a project audit. A comprehensive project includes:

  • 5 typical scenarios
  • Integration with Grafana/InfluxDB
  • Documentation and training
  • 30-day support

Typical savings from load testing amount to $5,000–$20,000 by preventing downtime and optimizing infrastructure. For example, preventing a single outage during peak season can save over $20,000 in lost revenue.

Contact us for a consultation. We analyze your project, define SLAs, and develop turnkey load tests. Your tests will be ready within a week. We guarantee reliability and full documentation. Your system will be ready for any peak load.

Why are unit tests important but not a panacea?

A bug found by a unit test costs minutes to fix. The same bug in production costs hours of incident response, compensations, and lost trust. In an online store project, a discount calculation error passed manual testing, went to production, and processed 37 orders at zero price in 4 hours. An automated test for edge cases would have caught it on the first push. With 7+ years in web application testing and over 200 projects delivered, we’ve seen this pattern repeat across industries.

Jest is the standard for JavaScript/TypeScript, but unit tests are justified only where there is isolated logic: transformation functions, validators, business rules, utilities. Testing React components with Jest + Testing Library is correct for behavioral tests: "button appears after loading", "form shows error on empty email". Snapshot tests (toMatchSnapshot) are a trap: they break on any layout change and become noise that developers update without looking. Code coverage is a poor quality metric: 80% coverage can be achieved with tests that check nothing. Coverage shows that code executed, not that it works correctly.

Criteria Jest Vitest
Speed for large projects Medium (Babel transformation) 10–20x faster (ES modules)
Integration with Vite Via plugin Native
Monorepos Requires configuration Out of the box

Vitest as an alternative to Jest for Vite projects: 10–20x faster due to native ES modules without Babel transformation. For monorepos with thousands of tests, the speed difference is noticeable. Wikipedia on unit testing describes the theoretical foundation — we apply it with real CI pipelines.

How to set up E2E tests that are not flaky?

Playwright outperforms Cypress on key parameters: native multi-tab, multi-origin, iframe support; parallel execution at test level; WebKit, Firefox, Chromium out of the box; no iframe for the app — tests run in a real browser.

Playwright codegen records actions and generates a test — a good starting point, but generated code needs refactoring. Locators by text content are fragile: getByRole('button', { name: 'Place order' }) is more robust than locator('.btn-primary').

Page Object Model is the standard for organizing E2E tests. Each page is a separate class with methods instead of direct locators. When a button moves from header to sidebar — change in one place, not across all tests.

Flaky tests typically arise from race conditions between request and render, animations without wait, and dependency on external APIs. Solution: page.waitForResponse() instead of page.waitForTimeout(), mocking external APIs via page.route().

// Bad
await page.click('#submit');
await page.waitForTimeout(2000);
await expect(page.locator('.success')).toBeVisible();

// Good
await page.click('#submit');
await page.waitForResponse(resp =>
  resp.url().includes('/api/orders') && resp.status() === 201
);
await expect(page.getByRole('alert', { name: /order created/i })).toBeVisible();

Our engineers guarantee test stability in CI. Playwright’s official documentation covers all API details — we use it daily on projects with millions of users.

How do Core Web Vitals affect ranking?

Google uses Core Web Vitals in ranking. Lighthouse CLI in CI pipeline: on every deploy we check that LCP < 2.5s, CLS < 0.1, INP < 200ms. Google Chrome study: 53% of users leave a site if it takes longer than 3 seconds to load — our tests prevent such losses.

Real problems that Lighthouse finds:

  • Hero image without width/height attributes: CLS 0.35 on load.
  • JavaScript bundle 2.1MB synchronously blocking parsing: INP 450ms.
  • Fonts without font-display: swap: invisible text until font loads (FOIT).
  • Unoptimized hero image 4MB: LCP 8.2s.

Lighthouse CI (lhci) saves metric history and posts a comment to PR with degradation. For one e‑commerce client, optimizing these metrics improved conversion by 18% and reduced server costs by $12k annually.

What does load testing solve?

k6 is a load testing tool with a JavaScript API. Scenarios are written as code, versioned in git, run in CI. Three main scenarios:

  • Spike test — sharp load increase: 0 → 1000 users in 30 seconds. Simulates a campaign launch. Shows system's ability to handle spikes.
  • Soak test — stable load for 2–4 hours. Detects memory leaks, connection pool exhaustion, performance degradation.
  • Stress test — load above expected (150–200% of peak). Shows breaking point and graceful degradation.

Thresholds:

thresholds: {
  http_req_duration: ['p95<500', 'p99<1000'],
  http_req_failed: ['rate<0.01'],
}

p95 < 500ms means 95% of requests respond faster than half a second. If threshold is not met, k6 exits with error code, CI pipeline fails.

In one online store project, we detected API degradation at the 4th hour of the test: p95 increased from 200ms to 2s due to connection leaks. After optimization, the client saved $15k per year on incident response and extra infrastructure.

Testing pyramid in a project

Level Tool Quantity Speed
Unit Vitest/Jest Many (thousands) <5 min
Integration Vitest + supertest Medium 5–15 min
E2E Playwright Few (happy path) 10–30 min
Load k6 On schedule 30–60 min
Performance Lighthouse CI On every deploy 5 min

What does the work include?

  • Audit of current coverage and identification of critical user flows.
  • Writing unit tests for key business logic, integration tests for API, E2E for user scenarios.
  • Setting up parallel execution in CI (sharded workers for Playwright).
  • Load testing with report and recommendations.
  • Test case documentation, training your team on test practices.
  • 1-month warranty support after implementation.
  • Delivery of all test artefacts (code, CI configs, run histories).

How do we work?

  1. Analysis — audit of current testing, identification of weak spots, priority setting.
  2. Design — tool selection, test plan writing, approval.
  3. Implementation — writing tests, CI integration.
  4. Testing — running all levels, result analysis, bug fixing.
  5. Deployment — going live, metric monitoring, team training.

Timeline

Setting up a full test pipeline (Jest + Playwright + k6 + Lighthouse CI) from scratch: 2–4 weeks. E2E test coverage of an existing project (20–30 scenarios): 3–6 weeks. Load testing with report and recommendations: 1–2 weeks. Cost calculated individually after audit.

Ready to discuss your project? Leave a request — we will audit your current web application testing for free and propose a plan that can save up to 60% on incident costs. Get a consultation on web application testing — contact us today.