0 votes
1 view
in AWS by (19.2k points)

I'm currently trying to figure out what the appropriate number of workers is for each Amazon Instance Type. I used to run one Gunicorn worker, however that proved to be quite slow.

Many developers are currently using this formula to gauge how many workers would be suitable:

NUM_WORKERS=3  #recommended formula here is 1 + 2 * NUM_CORES

The problem I'm having is that Amazon isn't quite clear as to the number of cores each instance is running. For example, an M1 Small Instance has 1 EC2 Compute Unit (1 virtual core with 1 EC2 Compute Unit)

What does that essentially mean? That it has one core? or that it has two cores?

1 Answer

0 votes
by (44.6k points)

A simple one-liner solution to return the number of CPU cores:

gunicorn --workers=$((2 * $(getconf _NPROCESSORS_ONLN) + 1)) wsgi:application

Welcome to Intellipaat Community. Get your technical queries answered by top developers !