What are GenServer reductions?

What exactly are GenServer reductions? What does it measure?

I am looking in the docs and on the internet but can’t find an explanation.

If someone could enlighten me or point me to an article or documentation, much appreciated :slight_smile:


Reduction is what the BEAM uses as “currency” to give a process a share of the CPU, one reduction is roughly equivalent to a function call.

After 2k (IIRC) reductions the scheduler will switch the process to another one.

This is not necessarily related to GenServers but processes in general.



Hello @blablablerg and welcome !

@NobbZ is correct and as usual quite precise!

So now you may be thinking, “What can I use these knowledge for? Why do I even need to know what a reduction is?”

Well, the main use for this is to spot processes that are in a pickle!

If you have a GenServer and you realize it has a ton of reductions and it never seems to go away, it may just very well be it is stuck in a loop or it has an incredibly heavy task to do.

You can check the number of reductions each process has by using the observer or if you are logged in a IEX console by using Process.info.

Using this information you will be able to spot troubling functions and processes in no time!

Hope it helps !