How can I create a long GIL lock

83 views Asked by At

I'm building a REST API in Python using Python 2.6, Flask on 64 Bit Linux.

I've been asked to determine how the GIL could affect the performance of this service. What if something happened that caused the interpreter to lock for a few seconds? Intuitively it would hinder the performance but I need to be able to demonstrate the impact.

The specific concern is, if somebody introduces code (e.g. a C extension) that causes a large amount of additional locking, could it make the whole API completely useless?

What I'd like is something like time.sleep() which basically locks up the interpreter for a period of time. I could build a model API in which queries trigger locks of various lengths and then demonstrate the extent to which concurrency is reduced as a function of the amount of time spent in the lock.

0

There are 0 answers