The nginx documentation says
max_clients = worker_processes * worker_connections
but how does the keepalive factor into this? I have my configuration setup with 2 worker_processes and 8192 worker_connections; that means I can theoretically handle a maximum of 16384 concurrent connections. Pushing out 16384 streams of data concurrently is ginormous, but if I have a 60s keepalive_timeout then with each client hogging a connection for 1 minute that number has a completely different meaning. Which is it?
Connected to all this is the $connection variable that can be used with the log_format directive. I defined the following log format so I could analyze the server's performance:
log_format perf '$request_time $time_local $body_bytes_sent*$gzip_ratio $connection $pipe $status $request_uri';
That $connection variable is reporting around 11-12 million connections! I'm no math major, but obviously that number is way higher than worker_processes * worker_connections. So what is it supposed to represent?
In short, I'm trying to figure out how to determine a good value for worker_connection.