Optimal gunicorn-worker configuration (number and class) for Python REST APIs
<p>Lets say I have two conceptually different REST APIs developed in Python through a framework like <a href="http://flask.pocoo.org/" rel="noreferrer">Flask</a> or <a href="http://falconframework.org/" rel="noreferrer">Falcon</a> which I need to deploy through <a href="http://gunicorn.org/" rel="noreferrer">Gunicorn</a> on a server with 4GB of RAM and 2 vCPUs.</p>

<h2>API #1: CPU-bound</h2>

<p>The requests to this API involve little to no IO but are rather CPU-bound. Nonetheless, the operations are very quick and require little memory, e.g., simple mathematical operations.</p>

<h2>API #2: IO-bound</h2>

<p>The requests to this API involve a series of HTTP requests, e.g., to another API or fetching pages through GET requests. Thus, the majority of the 'work' involves waiting for other requests to resolve.</p>

<p>My question is: What would the optimal Gunicorn worker configurations (worker numbers and classes) be so that one would get optimal performance (preferably in terms of concurrency and requests-per-second) out of these APIs deployed on the aforementioned servers?</p>

<p>Reflexively I'd opt for a number of gevent-class workers but I've been scouring docs to verify said decision to no avail.</p>

<p>Any input would be appreciated :)</p>