feat: add readme

This commit is contained in:
Urko 2023-04-10 19:49:43 +02:00
parent 4956815ec6
commit 7ad3a9969f
2 changed files with 68 additions and 7 deletions

View File

@ -20,7 +20,7 @@ pprof:
pprof_url:# top 40 -cum pprof_url:# top 40 -cum
go tool pprof -alloc_space http://localhost:5000/debug/pprof/allocs go tool pprof -alloc_space http://localhost:5000/debug/pprof/allocs
benchmark_server: benchmark_server:
go test -gcflags "-m -m" -run none -bench . -benchtime 30s -benchmem -memprofile profile.out ./benchmark go test -gcflags "-m -m" -run none -bench . -benchtime 30s -benchmem -memprofile profile.out ./benchmark
benchmark_etl: benchmark_etl:
go test -gcflags "-m -m" -run none -bench . -benchtime 15s -benchmem -memprofile profile.out ./internal/etl/ > t.out go test -gcflags "-m -m" -run none -bench . -benchtime 15s -benchmem -memprofile profile.out ./internal/etl/ > t.out
trace_etl: build_etl# go tool trace t.out trace_etl: build_etl# go tool trace t.out
@ -28,8 +28,17 @@ trace_etl: build_etl# go tool trace t.out
time ./etl -trace > t.out time ./etl -trace > t.out
build_etl: build_etl:
env GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -v -o etl ./cmd/etl/main.go env GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -v -o etl ./cmd/etl/main.go
run_etl: build_etl
./etl
build_server: build_server:
env GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -o server ./cmd/server/main.go env GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -o server ./cmd/server/main.go
run_server: build_server run_server: build_server
./server ./server
benchmark_go_1000req:
go test -run TestGoRequests ./benchmark
benchmark_go_1000req_15s:
go test -run TestGoRequestsPerSecondFor15s ./benchmark
benchmark_nest_1000req:
go test -run TestNestRequests ./benchmark
benchmark_nest_1000req_15s:
go test -run TestNestRequestsPerSecondFor15s ./benchmark

View File

@ -1,11 +1,63 @@
## Requirements
run `docker-compose --env-file ./.env up` to init your container
## Tests
### ETL
To see results you only have to run
```bash
make run_etl
```
### http server
To see results you only have to run
```bash
make run_etl
```
## Benchmark ## Benchmark
### go benchmark ### http comparision
Start your server #### Start your go http server
`go run cmd/server/main.go` ```bash
go run cmd/server/main.go
```
#### Start your nest server
```bash
cd ~/nest-project-path
```
```bash
npm start
```
Run your tests Then run benchmark
`go test -race -v --bench ./. --benchmem ./benchmark ` ```bash
make benchmark_server
```
### other tests
To test different tests done on http server response you can do this way:
First start your http server
```bash
make run_server
```
Then play running different tests:
**IMPORTANT** Please do mantain your machine without extra running processes
```bash
make benchmark_go_1000req_15s
```
then try
```bash
make benchmark_go_1000req
```
Now try nest server, remember to first [startup your nest](#start-your-nest-server)
```bash
make benchmark_nest_1000req_15s
```
```bash
make benchmark_nest_1000req
```