There is a pretty big multithreaded python2 web-application. In main thread works business logic, in sub-threads mostly database operations running. No TreadPoolExecutor is used now, and it cannot be implemented in the nearest future. I want to add another thread which is supposed to process certain amount of data (fast) and store the result into the DataBase (io-operation). This operation won't be executed very often.
So, the question is: should I run mostly sleeping thread and wait for an event to process data or maybe it's better to spawn new thread from the main when there is enough data and close it when processing were completed? Note, that there are already pretty large amount of threads running for GIL to switch between them.
Thanks.