tcgdex / cards-database

Pokémon Trading Card Game Card (TCG) Database for the TCGdex API. ⭐ Leave a star if the project interest you !
https://www.tcgdex.net
MIT License
131 stars 31 forks source link

feat: setup clustering #530

Closed Aviortheking closed 3 weeks ago

Aviortheking commented 3 weeks ago

Tests using k6 confirm that clustering is way better to handle more traffic on the server

http_req_duration goes from 6s to 438ms (when ~1000 connections are being done at the same time) allowing the server to handle from ~300req/s to ~1500req/s

Before

metricavgmaxmedminp90p95p99
http_req_blocked11µs59ms2µs1µs4µs6µs174µs
http_req_connecting7µs59ms0ms0ms0ms0ms126µs
http_req_duration2s9s2s2ms3s6s6s
http_req_receiving40µs1ms38µs14µs55µs63µs88µs
http_req_sending12µs716µs11µs3µs18µs23µs36µs
http_req_tls_handshaking0ms0ms0ms0ms0ms0ms0ms
http_req_waiting2s9s2s2ms3s6s6s
iteration_duration2s9s3s503ms4s6s6s

After

metricavgmaxmedminp90p95p99
http_req_blocked7µs113ms2µs920ns4µs5µs15µs
http_req_connecting3µs113ms0ms0ms0ms0ms0ms
http_req_duration112ms960ms79ms4ms269ms327ms438ms
http_req_receiving55µs60ms39µs9µs68µs120µs340µs
http_req_sending14µs24ms10µs3µs17µs22µs81µs
http_req_tls_handshaking0ms0ms0ms0ms0ms0ms0ms
http_req_waiting112ms960ms79ms4ms269ms327ms438ms
iteration_duration613ms1s581ms505ms770ms828ms939ms

k6 config

0s 0vu 1m 1000vu 2m 1000vu 3m 0vu