...

/

Starting Per-User Processes with a Dynamic Supervisor

Starting Per-User Processes with a Dynamic Supervisor

Let's learn how to use dynamic supervisors to handle variable processes and establish some policies using a child spec.

Now we need to start a process per user. There are two reasons for doing this:

  • We don’t have a fixed number of processes to start.

  • We’ll also need to be able to look them up based on a user’s attributes.

Hence, we will need a structure that is a little more sophisticated. We will use a dynamic supervisor.

Properties and requirements of dynamic supervisors

Most supervisors create processes when an application starts or restarts. That’s typically what you want, but not always. A dynamic supervisor is a supervisor that starts children dynamically. Since we have no way of knowing who will take quizzes and when, that sounds like exactly ...