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

[WIP] Add Go impl of todos api #1873

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

[WIP] Add Go impl of todos api #1873

wants to merge 2 commits into from

Conversation

tg123
Copy link

@tg123 tg123 commented Jun 22, 2023

#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
Copy link
Author

tg123 commented Jun 22, 2023

@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

@DamianEdwards
Copy link
Member

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

@eerhardt
Copy link
Contributor

Does this app have:

  • Validation
  • Health Checks

?

@DamianEdwards
Copy link
Member

@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 😄

@tg123
Copy link
Author

tg123 commented Aug 11, 2023

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

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

Successfully merging this pull request may close these issues.

3 participants