worker_connections allocates a lot of memory

Marcin Wanat marcin.wanat at
Tue Jun 16 08:33:31 UTC 2020

> Hi,
> I noticed that worker_connections while is defined as the maximum number of
> connections per worker, nginx pre-allocated enough memory to handle all
> possible worker_connections, even before they are actually needed.
> For example, setting worker_connections to 10485760 causes nginx to take
> 4.3GB of memory upon init.
> Is this how its supposed to be?
> Is there a way to tell nginx to only allocate memory as needed?

I think you do not need to worry about it.
You will run out of available ports, file descriptors or system memory
needed to allocate
these resources way before you will notice this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list