I am running a Golang project in a container environment which has two pods.
- Pod1: user-interaction and data-access layer.
- Pod2: Database server.
The data-access layer involves functions like data validation, do get on db to check if data already exist, insert data, and many more data manipulation tasks...
I have two versions of the project with two differnt databases. (Database APIs in data-access layers are abstracted so that I can replace the redis with postgres or any other databases.)
- Redis db (data access layer implemented with redis package).
- Postgresql db (data access layer implemented with pgx package).
Now to compare the two versions I ran a command at pod1 to create 100000 records in each, and observed huge difference in command execution time.
- Redis: 2m30s
- Postgres: 9m20s
I need to debug which part of the code is taking more time, so what is the correct way to use Pprof tool? (should I run pprof for entire time of the command execution and compare? or should I run both for a minute and compare?, which pprof profiling should I use?).
Thanks