Multi worker app

I want aiohttp app running on number of processes.

Tornado has

server = HTTPServer(app)

for starting workers (0 - cpu cores). I know about gunicorn. But i want server embeded into application.

Please take a look at my library: aiotools and its server component which hides many boilerplates for building multi-process asyncio applications.
You may also take some parts of its implementation and use it in your app.

Basically, you need to replicate the same initialization and tearing-down steps of your app in every worker process. All states must be stored in a separate database (e.g., Redis, MongoDB, PostgreSQL, etc.) and it’s better to keep each worker process independent and isolated to each other for scalability.
aiotools provides lifecycle coordination of those worker processes (e.g., spawning them and terminating them gracefully upon specific signal reception).