Re: ZODB and asyncio interaction

Jim Fulton <[email protected]>
Newsgroups gmane.comp.web.zope.zodb
Message-ID <CAPDm-FhSfDDZmFCtjN5HShRdzUHY=xYi0aN2k508y=s0gpTXyQ@mail.gmail.com>
On Fri, Apr 22, 2016 at 9:24 AM, Jason Madden
<[email protected]> wrote:
>
...
>
> While not strictly "asyncio" in the standard-library sense, gevent and greenlets easily accomplish this (suspending attribute access while data is being fetched and allowing other activity to progress in the same thread---just in a different greenlet).
>
> Of course, this only happens if attribute access is a point at which control can yield to the gevent loop and transfer to another greenlet. In practice that means that it hits the network (e.g., a ZEO or RelStorage server) and *not*, for example, a local cache (in memory or on disk). This means that the most concurrency is achieved at when caches are cold, such as at startup, or if the working set of the application exceeds the available cache size (to Jim's point about tuning).
>
> Now greenlets are basically just extremely lightweight threads, and python threads release the GIL when they do socket IO, so the same principles apply to using a thread pool. And all of Jim's remarks remain true. I will say that we've had good results applying gevent+ZODB in an environment where large numbers of threads would make for different tradeoffs (large numbers of persistent WebSocket connections).

Yup. I thought of mentioning gevent, but  gevent uses synchronous APIs
at the application level, which as you mention, is similar to using
threads in many ways.

Jim

-- 
Jim Fulton
http://jimfulton.info

-- 
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.