python 2.7 - Running an async background task on Tornado -


i'm using tornado async framework implementation of rest web-server.

i need run high-cpu-load periodic task on background of same server.

it low-priority periodic task. should run time on idle cores, don't want affect performance of web-server (under heavy http-request load, should take lower priority).

can tornado ioloop api?

i know can use tornado.ioloop.periodiccallback call periodic background task. if task computational-heavy may cause performance issues web service.

tornado (or asyncio in python 3) or other single-process-event-loop based solution is not meant used cpu intensive tasks. should use io intensive tasks.

the word "background" means, you're not waiting result (i call unattended task). more over, if background task blocks, rest of application have wait, same way request handler blocks, other parts, including background, blocked.

you might thinking of use of threads, in python not solution either, due gil.

the right solutions are:


Comments