Parallelism in python isn't working right

前端 未结 3 701
渐次进展
渐次进展 2021-01-02 17:47

I was developing an app on gae using python 2.7, an ajax call requests some data from an API, a single request could take ~200 ms, however when I open two browsers and make

3条回答
  •  自闭症患者
    2021-01-02 18:44

    the CPython interpreter will not allow more then one thread to run. read about GIL http://wiki.python.org/moin/GlobalInterpreterLock

    So certain tasks cannot be done concurrently in an efficient way in the CPython with threads.

    If you want to do things parallel in GAE, then start them parallel with separate requests.

    Also, you may want to consult to the Python parallel wiki http://wiki.python.org/moin/ParallelProcessing

提交回复
热议问题