Benchmarks icon indicating copy to clipboard operation
Benchmarks copied to clipboard

[WIP] Add Go impl of todos api

Open tg123 opened this issue 2 years ago • 5 comments

#1868

:8080 Go :5054 Asp.net

Testing on Standard D16s v5 (16 vcpus, 64 GiB memory) Linux (ubuntu 22.04)

Go

./bombardier-linux-amd64 http://localhost:8080/api/todos/ -d 5s -c 100
Bombarding http://localhost:8080/api/todos/ for 5s using 100 connection(s)
[============================================================================================================================================================================================================] 5s
Done!
Statistics        Avg      Stdev        Max
  Reqs/sec      3575.14    1249.95    8972.64
  Latency       27.86ms    23.82ms   178.46ms
  HTTP codes:
    1xx - 0, 2xx - 18009, 3xx - 0, 4xx - 0, 5xx - 2
    others - 0
  Throughput:     2.14MB/s

Aspnet

./bombardier-linux-amd64 http://localhost:5054/api/todos/ -d 5s -c 100
Bombarding http://localhost:5054/api/todos/ for 5s using 100 connection(s)
[============================================================================================================================================================================================================] 5s
Done!
Statistics        Avg      Stdev        Max
  Reqs/sec      7576.38    6675.62   25974.91
  Latency       13.19ms    15.56ms   263.96ms
  HTTP codes:
    1xx - 0, 2xx - 37962, 3xx - 0, 4xx - 0, 5xx - 100
    others - 0
  Throughput:     4.21MB/s

Screenshot

set DATABASE_CONNECTION=host=localhost user=postgres password=mysecretpassword dbname=postgres sslmode=disable

TodosApi.exe
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.

[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env:   export GIN_MODE=release
 - using code:  gin.SetMode(gin.ReleaseMode)

[GIN-debug] GET    /favicon.ico              --> main.main.func1 (3 handlers)
[GIN-debug] GET    /api/todos/               --> main.(*todoapi).MapTodoApi.func1 (3 handlers)
[GIN-debug] GET    /api/todos/complete       --> main.(*todoapi).MapTodoApi.func2 (3 handlers)
[GIN-debug] GET    /api/todos/incomplete     --> main.(*todoapi).MapTodoApi.func3 (3 handlers)
[GIN-debug] GET    /api/todos/:id            --> main.(*todoapi).MapTodoApi.func4 (3 handlers)
[GIN-debug] GET    /api/todos/find           --> main.(*todoapi).MapTodoApi.func5 (3 handlers)
[GIN-debug] POST   /api/todos/               --> main.(*todoapi).MapTodoApi.func6 (3 handlers)
[GIN-debug] PUT    /api/todos/:id            --> main.(*todoapi).MapTodoApi.func7 (3 handlers)
[GIN-debug] PUT    /api/todos/:id/mark-complete --> main.(*todoapi).MapTodoApi.func8 (3 handlers)
[GIN-debug] PUT    /api/todos/:id/mark-incomplete --> main.(*todoapi).MapTodoApi.func9 (3 handlers)
[GIN-debug] DELETE /api/todos/:id            --> main.(*todoapi).MapTodoApi.func10 (3 handlers)
[GIN-debug] DELETE /api/todos/delete-all     --> main.(*todoapi).MapTodoApi.func11 (3 handlers)
[GIN-debug] [WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.
Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.
[GIN-debug] Listening and serving HTTP on :8080

image

Todo

  • [ ] JWT admin auth
  • [ ] E2E comparation

tg123 avatar Jun 22 '23 22:06 tg123

@DamianEdwards any comments on the folder?

i put it into src\BenchmarksApps\TechEmpower\go-gin\TodosApi as we discussed, but i do not it has something to do with TechEmpower

tg123 avatar Jun 22 '23 22:06 tg123

@tg123 oh yeah you're totally right, I misspoke when I said that. Just put it in ./src/BenchmarksApps/go-gin/TodosApi

DamianEdwards avatar Jun 22 '23 22:06 DamianEdwards

Does this app have:

  • Validation
  • Health Checks

?

eerhardt avatar Aug 10 '23 18:08 eerhardt

@eerhardt I see the validator package added but not any code that uses it, but I'm just comparing to random Go Gin tutorials I found online :smile:

DamianEdwards avatar Aug 11 '23 00:08 DamianEdwards

no validation or healthcheck i found go is far slower, trying to catch up .net8

tg123 avatar Aug 11 '23 01:08 tg123