Re: ZODB eating CPU but RAM is free
Vlad Oles <[email protected]> Sun, 16 Dec 2018 16:11:38 -0800 (PST)
| Newsgroups | gmane.comp.web.zope.zodb |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_1308_1523592417.1545005498530 Content-Type: multipart/alternative; boundary="----=_Part_1309_1699992965.1545005498531" ------=_Part_1309_1699992965.1545005498531 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Saturday, December 15, 2018 at 8:30:16 AM UTC-8, Jim Fulton wrote: > > > > On Fri, Dec 14, 2018 at 9:54 PM Vlad Oles <[email protected]=20 > <javascript:>> wrote: > >> On Wednesday, July 19, 2017 at 9:54:05 AM UTC-7, Jim Fulton wrote: >>> >>> >>> One thing to understand is that ZODB doesn't limit memory usage. =20 >>> Ghostifies objects to meet memory settings at certain times like=20 >>> transaction boundaries and when asked to explicitly. So a transaction = that=20 >>> loads a lot of objects can grow ram without bound. This is why=20 >>> applications that load *lots* of objects should explicitly reduce cache= =20 >>> size by calling _p_jar.cacheGC() occasionally.=20 >>> >> >> Does it mean that after a database is finalized (no more writing and thu= s=20 >> transactions), there is no way to bound its RAM cache size other than=20 >> manually resetting cache (via cacheGC() or cacheMinimize()) after every = N=20 >> reads? >> > > Define finalized. > > When a transaction is committed or a connection closed, the connection's= =20 > cache is reduced to it's target size. When a database is closed, the=20 > connections and their memory is freed. (If there are cycles, the Python= =20 > garbage collection may take some time to deal with them.) > By "finalized" I meant the connection is still open but no more=20 transactions are being commited, so the database is used only for reads. I think I can confirm my initial assumption from your answer though =E2=80= =94 the=20 target cache size configuration is not going to be applied automatically in= =20 this scenario, and I'll have to free database cache manually by caling=20 cacheMinimize(). --=20 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 e= mail to [email protected]. For more options, visit https://groups.google.com/d/optout. ------=_Part_1309_1699992965.1545005498531 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">On Saturday, December 15, 2018 at 8:30:16 AM UTC-8, Jim Fu= lton wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left= : 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><b= r><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Fri, Dec 14, 2018 at 9= :54 PM Vlad Oles <<a href=3D"javascript:" target=3D"_blank" gdf-obfuscat= ed-mailto=3D"5QFpmg4jCQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'= ;javascript:';return true;" onclick=3D"this.href=3D'javascript:'= ;;return true;">[email protected]</a>> wrote:<br></div><blockquote cl= ass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid= rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">On Wednesday, July 19,= 2017 at 9:54:05 AM UTC-7, Jim Fulton wrote:<blockquote class=3D"gmail_quot= e" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204)= ;padding-left:1ex"><div dir=3D"ltr"><br><div><div class=3D"gmail_quote"><di= v>One thing to understand is that ZODB doesn't limit memory usage.=C2= =A0 Ghostifies objects to meet memory settings at certain times like transa= ction boundaries and when asked to explicitly.=C2=A0 So a transaction that = loads a lot of objects can grow ram without bound.=C2=A0 This is why applic= ations that load <b>lots</b> of objects should explicitly reduce cache size= by calling <font face=3D"monospace, monospace">_p_jar.cacheGC()</font> occ= asionally. <br></div></div></div></div></blockquote><div><br></div><div>Doe= s it mean that after a database is finalized (no more writing and thus tran= sactions), there is no way to bound its RAM cache size other than manually = resetting cache (via cacheGC() or cacheMinimize()) after every N reads?</di= v></div></blockquote><div><br></div><div>Define finalized.</div><div><br></= div><div>When a transaction is committed or a connection closed, the connec= tion's cache is reduced to it's target size. When a database is clo= sed, the connections and their memory is freed. (If there are cycles, the P= ython garbage collection may take some time to deal with them.)</div></div>= </div></blockquote><div><br></div><div>By "finalized" I meant the= connection is still open but no more transactions are being commited, so t= he database is used only for reads.</div><div><br></div><div>I think I can = confirm my initial assumption from your answer though =E2=80=94 the target = cache size configuration is not going to be applied automatically in this s= cenario, and I'll have to free database cache manually by caling cacheM= inimize().<br></div></div> <p></p> -- <br /> You received this message because you are subscribed to the Google Groups &= quot;zodb" group.<br /> To unsubscribe from this group and stop receiving emails from it, send an e= mail to <a href=3D"mailto:[email protected]">zodb+unsubscri= [email protected]</a>.<br /> For more options, visit <a href=3D"https://groups.google.com/d/optout">http= s://groups.google.com/d/optout</a>.<br /> ------=_Part_1309_1699992965.1545005498531-- ------=_Part_1308_1523592417.1545005498530--