Profiling Go Programs using Pprof and k6
pears.one·12h·
Discuss: r/golang
Flag this post

TLDR

I tested the effectiveness of a cache implementation for a Go API using k6, cgroups and pprof, which helped to find the path to a 100x performance improvement.

Aims

I am writing a simple replica of the old Reddit project r/place - created by Josh Wardle of Wordle.

Place Example Image

The data for each pixel is stored in a sqlite3 database. When a request is made, currently the backend gets all pixel data from the database, and generates the PNG which is written to the response object.

The frontend polls the backend every 1 second for the latest version of the grid, as a PNG. Because of this frequency - there is no reason the image needs to be rebuilt more frequently than once every second.

Furt…

Similar Posts

Loading similar posts...