canarytrace / documentation

Plug’n'Play stack for testing and monitoring web applications from user perspective.
http://canarytrace.com
6 stars 0 forks source link

Performance test for 500req/s #119

Closed rdpanek closed 2 years ago

rdpanek commented 2 years ago
rdpanek commented 2 years ago

500 VU / Performance test

k6 run test/sendRumData.js --insecure-skip-tls-verify

Configuration

stages: [
        { duration: '60s', target: 500 },
        { duration: '600s', target: 500 }
 ],

Payload used by K6 - small payload

let transactionId = Date.now().toString(36) + Math.random().toString(36).substring(2)

const chromePayloadRUM = {
    "transactionId": `${transactionId}`,
    "spanId": `${transactionId}77`,
    "origin": "https://webperf.canarytrace.com",
    "pathname": "/",
    "deviceMemory": 8,
    "hardwareConcurrency": 10,
    "connection": {
        "effectiveType": "4g",
        "rtt": 50,
        "downlink": 10
    },
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36",
    "isMobile": false,
    "browserName": "Chrome",
    "language": "cs-CZ",
    "entries": [{
            "name": "https://webperf.canarytrace.com/?debug=1",
            "entryType": "navigation",
            "startTime": 0,
            "duration": 316.90000000596046,
            "initiatorType": "navigation",
            "nextHopProtocol": "h2",
            "workerStart": 0,
            "redirectStart": 0,
            "redirectEnd": 0,
            "fetchStart": 1,
            "domainLookupStart": 1,
            "domainLookupEnd": 1,
            "connectStart": 1,
            "connectEnd": 1,
            "secureConnectionStart": 1,
            "requestStart": 9.100000008940697,
            "responseStart": 48,
            "responseEnd": 71,
            "transferSize": 69718,
            "encodedBodySize": 69418,
            "decodedBodySize": 69418,
            "serverTiming": [],
            "workerTiming": [],
            "unloadEventStart": 54.70000000298023,
            "unloadEventEnd": 54.70000000298023,
            "domInteractive": 309.20000000298023,
            "domContentLoadedEventStart": 309.20000000298023,
            "domContentLoadedEventEnd": 309.20000000298023,
            "domComplete": 316,
            "loadEventStart": 316,
            "loadEventEnd": 316.90000000596046,
            "type": "reload",
            "redirectCount": 0
        },
        {
            "name": "https://webperf.canarytrace.com/css/main.css",
            "entryType": "resource",
            "startTime": 59.1000000089407,
            "duration": 33.099999994039536,
            "initiatorType": "link",
            "nextHopProtocol": "h2",
            "workerStart": 0,
            "redirectStart": 0,
            "redirectEnd": 0,
            "fetchStart": 59.1000000089407,
            "domainLookupStart": 59.1000000089407,
            "domainLookupEnd": 59.1000000089407,
            "connectStart": 59.1000000089407,
            "connectEnd": 59.1000000089407,
            "secureConnectionStart": 59.1000000089407,
            "requestStart": 69.30000001192093,
            "responseStart": 91.90000000596046,
            "responseEnd": 92.20000000298023,
            "transferSize": 5870,
            "encodedBodySize": 5570,
            "decodedBodySize": 5570,
            "serverTiming": [],
            "workerTiming": []
        },
        {
            "name": "https://cdn.tailwindcss.com/",
            "entryType": "resource",
            "startTime": 59.400000005960464,
            "duration": 109.09999999403954,
            "initiatorType": "script",
            "nextHopProtocol": "",
            "workerStart": 0,
            "redirectStart": 0,
            "redirectEnd": 0,
            "fetchStart": 59.400000005960464,
            "domainLookupStart": 0,
            "domainLookupEnd": 0,
            "connectStart": 0,
            "connectEnd": 0,
            "secureConnectionStart": 0,
            "requestStart": 0,
            "responseStart": 0,
            "responseEnd": 168.5,
            "transferSize": 0,
            "encodedBodySize": 0,
            "decodedBodySize": 0,
            "serverTiming": [],
            "workerTiming": []
        },
        {
            "name": "https://webperf.canarytrace.com/img/webperf.webp",
            "entryType": "resource",
            "startTime": 59.6000000089407,
            "duration": 89.59999999403954,
            "initiatorType": "img",
            "nextHopProtocol": "h2",
            "workerStart": 0,
            "redirectStart": 0,
            "redirectEnd": 0,
            "fetchStart": 59.6000000089407,
            "domainLookupStart": 59.6000000089407,
            "domainLookupEnd": 59.6000000089407,
            "connectStart": 59.6000000089407,
            "connectEnd": 59.6000000089407,
            "secureConnectionStart": 59.6000000089407,
            "requestStart": 127.90000000596046,
            "responseStart": 147.5,
            "responseEnd": 149.20000000298023,
            "transferSize": 41328,
            "encodedBodySize": 41028,
            "decodedBodySize": 41028,
            "serverTiming": [],
            "workerTiming": []
        },
        {
            "name": "https://rum.canarytrace.com/rum",
            "entryType": "resource",
            "startTime": 71.30000001192093,
            "duration": 54.8999999910593,
            "initiatorType": "script",
            "nextHopProtocol": "",
            "workerStart": 0,
            "redirectStart": 0,
            "redirectEnd": 0,
            "fetchStart": 71.30000001192093,
            "domainLookupStart": 0,
            "domainLookupEnd": 0,
            "connectStart": 0,
            "connectEnd": 0,
            "secureConnectionStart": 0,
            "requestStart": 0,
            "responseStart": 0,
            "responseEnd": 126.20000000298023,
            "transferSize": 0,
            "encodedBodySize": 0,
            "decodedBodySize": 0,
            "serverTiming": [],
            "workerTiming": []
        },
        {
            "name": "first-paint",
            "entryType": "paint",
            "startTime": 253.1000000089407,
            "duration": 0
        },
        {
            "name": "first-contentful-paint",
            "entryType": "paint",
            "startTime": 253.1000000089407,
            "duration": 0
        }
    ],
    "resources": 4,
    "resourceTypes": {
        "link": 1,
        "script": 2,
        "img": 1
    },
    "jsHeapSizeLimit": 4294705152,
    "totalJSHeapSize": 37571378,
    "usedJSHeapSize": 22862118,
    "decodedBodySize": 69418,
    "encodedBodySize": 69418,
    "duration": 316.90000000596046,
    "domContentLoadedEventEnd": 309.20000000298023,
    "domComplete": 316,
    "FCP": 253.1000000089407,
    "TTFB": 48,
    "LCP": 253.2,
  "labels": "rum, test, k6, desktop"
}

Results

Passed vs Failed

     █ Chrome Rum Save

       ✗ POST /rum response code was 200
        ↳  99% — ✓ 59899 / ✗ 36
       ✗ POST /rum response contains `true`
        ↳  99% — ✓ 59899 / ✗ 36

Metrics

     checks..........................: 99.90% ✓ 118584 ✗ 116  
     data_received...................: 73 MB  110 kB/s
     data_sent.......................: 268 MB 401 kB/s

✗ { group:::Chrome Rum Save }...: avg=335.71ms min=21.01ms med=41.33ms max=20s     p(90)=331.12ms p(95)=1.89s  

K8S

CPU Usage Image

Memory Usage Image

Network Usage Image


Results 1h duration

     █ Chrome Rum Save

       ✗ POST /rum response code was 200
        ↳  99% — ✓ 338735 / ✗ 242
       ✗ POST /rum response contains `true`
        ↳  99% — ✓ 338735 / ✗ 242
...
     ✗ { group:::Chrome Rum Save }...: avg=361.81ms min=18.92ms med=50.99ms max=20s    p(90)=400.62ms p(95)=2.11s  
rdpanek commented 2 years ago

How to run performance tests with k6.io

Install K6.io Instalation is a very easy https://k6.io/docs/getting-started/installation/

Download performance test docker run --rm -it --entrypoint /bin/mv -v $(pwd):/test quay.io/canarytrace/rum:1.10 /opt/canary-rum/test/ /test/ This command move directory with performance test on your localhost

Run your first performance smoke RUM_SERVER_API=https://your.server.com/rum k6 run test/sendRumData.js --insecure-skip-tls-verify -i 1

Run your first performance test RUM_SERVER_API=https://your.server.com/rum k6 run test/sendRumData.js --insecure-skip-tls-verify