[ZODB-Dev] [Enhancement Proposal] Memory size limited Cache

Jim Fulton jim at zope.com
Fri Oct 6 16:18:02 EDT 2006


Dieter Maurer wrote:
...
>> The only benefit of multiple threads is that it is somewhat
>> less likely that expensive requests will block inexpensive ones.
> 
> Multiple threads can share resources such as main memory and
> a common cache (proposed by the original poster).

If there is only one thread, the resources are completely
shared among all threads.

I don't understand how sharing resources among multiple threads
is somehow a benefit of multiple threads.


> While this does not give more throughput, it uses memory more
> efficiently.

No, it doesn't.

Even if *all* objects in the cache are shared, using multiple
threads doesn't reduce memory.  It just doesn't use more memory.
Of course, if any objects can't me shared, then using
multiple threads will surely use more memory, not less.

...

>   We abused Zope a bit and have build a desktop application with it.
> 
>   One of the main critiques of our customers is too high memory
>   consumption. Many have computers with 256 MB memory and
>   they do not like at all that our application uses roughly a third
>   of it...
> 
>   They would even less like it when there were several processes
>   with each of them taking about 60 MB (many of our caches
>   are on module level and are shared indeed).

OK, so, for a desktop application responsiveness is a big
issue.  There the benefit of multiple threads is that you can
keep the UI responsive while you do background processing
in other threads.  The benefit is responsiveness.

So, in an application like this where there *is* a benefit
to having multiple threads *and* you have a lot of read-only
data, then I agree that there would be a benefit to sharing
the data. Of course, then you have to deal with thread-safety
issues that you don't normally have in a ZODB application.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the ZODB-Dev mailing list