Understanding of GIL

Barry barry at barrys-emacs.org
Sat Dec 21 05:05:22 EST 2019



> On 19 Dec 2019, at 14:19, onlinejudge95 <onlinejudge95 at gmail.com> wrote:
> 
> Hi Devs,
> 
> I am currently writing some custom Django commands for data updation, my
> workflow is like
> 
> Fetch data from *PostgreSQL*.
> Call *Elasticsearch* for searching based on the data fetched from
> *PostgreSQL*.
> Query *PostgreSQL* and do an upsert behavior.
> I am using pandas data frame to hold my data during processing.
> 
> The host we are using to run this jobs has a *CPython* interpreter as given
> by
> 
> `platform.python_implementation()`
> 
> I want to confirm whether *multithreading* would be a better choice here,
> given the fact that GIL is the biggest blocker(I agree it has to be there)
> for the same in CPython interpreters.

You mean multi process vs. Threaded?

The GIL is only a problem if you are executing pure python compute bound code on multiple threads. When your code does lots of I/O and uses extensions it’s not the limiting factor. I guess you app will spent if time waiting of PostgreSQL etc.

Barry

> 
> In case further information is required do let me know.
> 
> Thanks
> onlinejudge95
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 



More information about the Python-list mailing list