feat: add readme
This commit is contained in:
parent
4956815ec6
commit
7ad3a9969f
13
Makefile
13
Makefile
|
@ -20,7 +20,7 @@ pprof:
|
|||
pprof_url:# top 40 -cum
|
||||
go tool pprof -alloc_space http://localhost:5000/debug/pprof/allocs
|
||||
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:
|
||||
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
|
||||
|
@ -28,8 +28,17 @@ trace_etl: build_etl# go tool trace t.out
|
|||
time ./etl -trace > t.out
|
||||
build_etl:
|
||||
env GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -v -o etl ./cmd/etl/main.go
|
||||
run_etl: build_etl
|
||||
./etl
|
||||
build_server:
|
||||
env GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -o server ./cmd/server/main.go
|
||||
run_server: build_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
|
62
README.md
62
README.md
|
@ -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
|
||||
|
||||
### go benchmark
|
||||
Start your server
|
||||
`go run cmd/server/main.go`
|
||||
### http comparision
|
||||
#### Start your go http server
|
||||
```bash
|
||||
go run cmd/server/main.go
|
||||
```
|
||||
#### Start your nest server
|
||||
```bash
|
||||
cd ~/nest-project-path
|
||||
```
|
||||
```bash
|
||||
npm start
|
||||
```
|
||||
|
||||
Run your tests
|
||||
`go test -race -v --bench ./. --benchmem ./benchmark `
|
||||
Then run 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
|
||||
```
|
Loading…
Reference in New Issue