0

I am running a Golang project in a container environment which has two pods.

  1. Pod1: user-interaction and data-access layer.
  2. 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.)

  1. Redis db (data access layer implemented with redis package).
  2. 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

Harish Reddy
  • 65
  • 1
  • 6
  • 1
    for similar operations, redis will generally be faster than a rdbms, so debugging wont help much in reducing pgx version times to redis version times. –  Dec 09 '22 at 05:26
  • 1
    Instead profiling both clients separately, would be a better way to approach this. e.g. for bringing pgx from 9m20s to lower. –  Dec 09 '22 at 05:29

0 Answers0