N
The Daily Insight

What is a Prefork worker model?

Author

Jessica Cortez

Updated on April 02, 2026

Pre-forking basically means a master creates forks which handle each request. A fork is a completely separate *nix process. Update as per the comments below. The pre in pre-fork means that these processes are forked before a request comes in.

What is an Apache worker?

Worker. The Worker MPM turns Apache into a multi-process, multi-threaded web server. Unlike Prefork, each child process under Worker can have multiple threads. As such, Worker can handle more requests with fewer resources than Prefork.

What is the difference between Prefork MPM and worker MPM?

Prefork MPM uses multiple child processes with one thread each and each process handles one connection at a time. Worker MPM uses multiple child processes with many threads each. Each thread handles one connection at a time.

What does pre-Fork mean?

Pre-forking basically means a master creates forks which handle each request. The pre in pre-fork means that these processes are forked before a request comes in. They can however usually be increased or decreased as the load goes up and down. Pre-forking can be used when you have libraries that are NOT thread safe.

Are Gunicorn workers threads?

2nd means of concurrency (threads) Gunicorn also allows for each of the workers to have multiple threads. In this case, the Python application is loaded once per worker, and each of the threads spawned by the same worker shares the same memory space. Gunicorn with threads setting, which uses the gthread worker class.

What do Gunicorn workers do?

Gunicorn is a pre-fork model server, which means that a master process is started and then a several worker processes are forked from the master. The worker processes are responsible for handling requests and returning a response to the client.

How many employees does Gunicorn have?

Gunicorn should only need 4-12 worker processes to handle hundreds or thousands of requests per second. Gunicorn relies on the operating system to provide all of the load balancing when handling requests. Generally we recommend (2 x $num_cores) + 1 as the number of workers to start off with.

What is a forking server?

In Part I: Iterative servers, we took a look at a server which deals with one client request at a time. In this “forking” server, we create a new child process every time we accept a client request. This child process deals with the client request, while the parent can immediately go back to blocking on accept() .