···1515 "beam",
1616 "performance"
1717]
1818+1919+[[extra.thanks]]
2020+name = "Angry Clippy (@ze.du on Discord)"
2121+why = "Redaction"
1822+++
19232024In my last larger gig I worked on fascinating project - [Postgres connection
···3741I can. This project now lives as [Ultravisor][] - it is still nowhere near being
3842done in a way that I like, but I still go back to work on it from time to time
3943to find potential performance improvements.
4444+4545+[Ultravisor]: https://github.com/Ultravisor/ultravisor
40464147This is a story of things that I have done and learned during that journey.
4248···7480times and then running `cat *.bggg` to concatenate all files into larger trace.
7581That has disadvantages, but at least it was workable within [Speedoscope][]
7682which I also highly recommend to anyone who needs to work on such optimisation.
8383+8484+[Speedoscope]: https://speedoscope.app
77857886While flame graphs are awesome, there is cost to gathering them with eFlambè -
7987it greatly affects performance. Fortunately Erlang has some built in tools that
···171179[Telemetry]: https://github.com/beam-telemetry/telemetry
172180173181In this project the metrics are exposed in Prometheus/OpenMetrics format, which
174174-mean that there need to be collection system within application. In BEAM
182182+means that there needs to be collection system within the application. In BEAM
175183applications the standard way to implement that is to use ETS tables to store
176184recorded values. Fortunately there are libraries to handle that for you, and for
177185the longest time "gold standard" for it was `telemetry_prometheus_core` library
···285293286294## Lesson: Calling your `GenServer`s is fast, but not 90k times per second fast
287295288288-One of the interesting observations is that I have spotted is that if there are
289289-longer running queries, one that send more data over the network than just
290290-simple short response, then the difference between Ultravisor and "state of the
296296+One of the interesting observations that I have spotted is that if there are
297297+longer running queries, ones that send more data over the network than just
298298+simple short responses, then the difference between Ultravisor and "state of the
291299art" tools like [PgBouncer][] or [PgDog][] (that are written in non-managed
292300languages like C and Rust) is much smaller (obviously it is still there, but it
293301is on par, not substantially off).