Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K6 API Benchmarks - Part 1/3 #163

Open
35C4n0r opened this issue Aug 20, 2024 · 3 comments
Open

K6 API Benchmarks - Part 1/3 #163

35C4n0r opened this issue Aug 20, 2024 · 3 comments

Comments

@35C4n0r
Copy link
Collaborator

35C4n0r commented Aug 20, 2024

Description

This issue tracks the implementation of benchmarking GET endpoints using K6 for the application.

Implementation Details

  • Task: Benchmark API endpoints using K6.

  • Endpoints:

    • GET / - should return the index.html page.
    • GET /city/:ip - should return geolocation data for a valid IP.
    • GET /city/:ip - should return an error for an invalid IP.
  • Expected Outcome: A performance benchmark for the GET endpoints with the ability to analyze response times and load-bearing capacity.

Product Name

GeoIP

Project Name

GeoIP

Organization Name

SamagraX

Domain

NA

Tech Skills Needed

K6, Node JS

Category

Benchmarking

Mentor(s)

@dhruv-1001
@35C4n0r

Complexity

High

@35C4n0r
Copy link
Collaborator Author

35C4n0r commented Aug 30, 2024

Before Migrations

image

$ k6 run --out=cloud benchmark.js 

          /\      |‾‾| /‾‾/   /‾‾/
     /\  /  \     |  |/  /   /  /
    /  \/    \    |     (   /   ‾‾\
   /          \   |  |\  \ |  (‾)  |
  / __________ \  |__| \__\ \_____/ .io

     execution: local
        script: benchmark.js
        output: cloud (https://jaykumar2021.grafana.net/a/k6-app/runs/3175657)

     scenarios: (100.00%) 1 scenario, 10 max VUs, 1m0s max duration (incl. graceful stop):
              * default: 10 looping VUs for 30s (gracefulStop: 30s)


     ✓ status is 200
     ✓ response text is correct
     ✓ response contains lat
     ✓ first response is success
     ✓ second response is fail
     ✓ response contains district

     checks.........................: 100.00% ✓ 336      ✗ 0
     data_received..................: 69 kB   2.0 kB/s
     data_sent......................: 18 kB   516 B/s
     http_req_blocked...............: avg=85.13µs  min=0s   med=0s      max=6.45ms p(90)=0s    p(95)=0s
     http_req_connecting............: avg=43.88µs  min=0s   med=0s      max=6.45ms p(90)=0s    p(95)=0s
     http_req_duration..............: avg=2.09s    min=0s   med=56.94ms max=13.72s p(90)=6.61s p(95)=8.83s
       { expected_response:true }...: avg=2.09s    min=0s   med=56.94ms max=13.72s p(90)=6.61s p(95)=8.83s
     http_req_failed................: 0.00%   ✓ 0        ✗ 147
     http_req_receiving.............: avg=176.5µs  min=0s   med=0s      max=7.66ms p(90)=0s    p(95)=798.67µs
     http_req_sending...............: avg=461.59µs min=0s   med=0s      max=6.45ms p(90)=0s    p(95)=6.45ms
     http_req_tls_handshaking.......: avg=0s       min=0s   med=0s      max=0s     p(90)=0s    p(95)=0s
     http_req_waiting...............: avg=2.09s    min=0s   med=54.51ms max=13.72s p(90)=6.61s p(95)=8.83s
     http_reqs......................: 147     4.255701/s
     iteration_duration.............: avg=15.69s   min=3.1s med=16.4s   max=16.71s p(90)=16.7s p(95)=16.71s
     iterations.....................: 21      0.607957/s
     vus............................: 1       min=1      max=10
     vus_max........................: 10      min=10     max=10

                                                                                                                                                                                                                                                  
running (0m34.5s), 00/10 VUs, 21 complete and 0 interrupted iterations                                                                                                                                                                            
default ✓ [======================================] 10 VUs  30s                                                  

@35C4n0r
Copy link
Collaborator Author

35C4n0r commented Aug 30, 2024

After Migrations

image

$ k6 run --out=cloud benchmark.js 

          /\      |‾‾| /‾‾/   /‾‾/
     /\  /  \     |  |/  /   /  /
    /  \/    \    |     (   /   ‾‾\
   /          \   |  |\  \ |  (‾)  |
  / __________ \  |__| \__\ \_____/ .io

     execution: local
        script: benchmark.js
        output: cloud (https://jaykumar2021.grafana.net/a/k6-app/runs/3175716)

     scenarios: (100.00%) 1 scenario, 10 max VUs, 1m0s max duration (incl. graceful stop):
              * default: 10 looping VUs for 30s (gracefulStop: 30s)


     ✓ status is 200
     ✓ response text is correct
     ✓ response contains lat
     ✓ first response is success
     ✓ second response is fail
     ✓ response contains district

     checks.........................: 100.00% ✓ 4256     ✗ 0
     data_received..................: 865 kB  28 kB/s
     data_sent......................: 226 kB  7.3 kB/s
     http_req_blocked...............: avg=11.63µs min=0s    med=0s     max=2.75ms   p(90)=0s      p(95)=0s
     http_req_connecting............: avg=3.93µs  min=0s    med=0s     max=1.1ms    p(90)=0s      p(95)=0s
     http_req_duration..............: avg=18.91ms min=0s    med=4.92ms max=623.18ms p(90)=46.47ms p(95)=79.71ms
       { expected_response:true }...: avg=18.91ms min=0s    med=4.92ms max=623.18ms p(90)=46.47ms p(95)=79.71ms
     http_req_failed................: 0.00%   ✓ 0        ✗ 1862
     http_req_receiving.............: avg=162.6µs min=0s    med=0s     max=14.57ms  p(90)=0s      p(95)=829.48µs
     http_req_sending...............: avg=40.76µs min=0s    med=0s     max=19.56ms  p(90)=0s      p(95)=0s
     http_req_tls_handshaking.......: avg=0s      min=0s    med=0s     max=0s       p(90)=0s      p(95)=0s
     http_req_waiting...............: avg=18.7ms  min=0s    med=4.57ms max=623.18ms p(90)=46.15ms p(95)=79.71ms
     http_reqs......................: 1862    59.87969/s
     iteration_duration.............: avg=1.15s   min=1.04s med=1.1s   max=1.79s    p(90)=1.27s   p(95)=1.4s
     iterations.....................: 266     8.554241/s
     vus............................: 4       min=4      max=10
     vus_max........................: 10      min=10     max=10

                                                                                                                                                                                                                                                  
running (0m31.1s), 00/10 VUs, 266 complete and 0 interrupted iterations                                                                                                                                                                           
default ✓ [======================================] 10 VUs  30s  

@zenc0derr
Copy link

Hi @35C4n0r, I would like to contribute on this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants