Profiling / Optimising
zanuka opened this issue · 0 comments
zanuka commented
The Go app should leverage the built-in profiler that supports CPU, memory, goroutine and block (contention) profiling.
easily enabled:
import (
"net/http"
_ "net/http/pprof"
)
advantages:
- low overhead
- can be used in a production environment
- can be used with live traffic without any noticeable performance penalties
dev tasks (issues):
- report the number of incoming requests
- report how long every request takes.
- report request details - (URL, IP address and user-agent)
- send all stats to metric aggregator (e.g. StatsD) In addition, the service needs to
- measure how many requests per second the API can handle (Apache Benchmark tool)
- profile the CPU to determine which functions spend most time
- run heap profiler for in-use memory and number of allocated objects
- block profiling to show function calls that lead to blocking on sync primitives like mutexes and channels