Tyk Gateway Profiling
In some cases, to identify tricky issues like concurrency or memory related issues, it may be required to get information about the Gateway process runtime. For example, memory or CPU usage details. The Tyk Gateway is built using Go, and inherits its powerful profiling tools, specifically Google’s <code>pprof</code>.
The Tyk Gateway can generate various profiles in the pprof supported format, which you can analyse by yourself, using the go tool pprof command, or you can send the profiles to our support team for analysis.
There are two way to get profiles:
-
Running the process with flags mentioned below which will gather information about the running process for the first 30 seconds, and will generate files containing profiling info:
--memprofile- memory profile, generatestyk.mproffile--cpuprofile- CPU usage profile, generatestyk.proffile--blockprofile- Blocking profile, generatestyk.blockproffile--mutexprofile- Mutex profile, generatestyk.mutexproffile
-
Running with the
--httpprofileflag, or setenable_http_profilertotruein tyk.conf, which will run a special/debug/pprof/public web page, containing dynamic information about the running process, and where you can download various profiles:- goroutine - stack traces of all current goroutines
- heap - a sampling of all heap allocations
- threadcreate - stack traces that led to the creation of new OS threads
- block - stack traces that led to blocking on synchronisation primitives
- mutex - stack traces of holders of contended mutexes