...

/

Logging Statistics Using ETS

Logging Statistics Using ETS

Learn how to create a statistics server for tracking progress using GenServer and ETS.

Tracking statistics using GenServer and ETS

During an evolution, we may want to track statistics about fitness, age, or variation in your population over the course of the evolution. For example, perhaps we want to determine the distribution of a particular gene at different generations during evolution. In this lesson, we’ll create a statistics server using a GenServer and an ETS table.

A GenServer is an abstraction around a state that models client-server behavior. It allows us to spin up a long-running process and alter its state through message passing. “ETS” stands for “Erlang Term Storage” and offers a built-in storage API through Erlang interpolation.

The GenServer will allow us to supervise the ETS table which in ...