On Sat, Jan 19, 2013 at 10:00 AM, Jim Fulton <span dir="ltr"><<a href="mailto:jim@zope.com" target="_blank">jim@zope.com</a>></span> wrote:<br><div class="gmail_quote"></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">- ZODB doesn't simply load your database into memory.</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> It loads objects when you try to access their state.</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> If you're using ZEO (or relstorage, or neo), each load requires a<br></span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> round-trip to the server. That's typically a millisecond or two,<br>
</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> depending on your network setup. (Your database is small, so disk<br></span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> access shouldn't be an issue as it is, presumably in your disk<br>
</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> cache.</span></blockquote><div>I understand. It seems to be able to unghost about 10000 catalog-related</div>
<div>objects/minute - does that sound about right?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">- You say it often takes you a couple of minutes to handle requests.<br></span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> This is obviously very long. It sounds like there's an issue<br>
</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> with the way you're using the catalog. It's not that hard get this<br></span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> wrong. I suggest either hiring someone with experience in this<br>
</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> area to help you or consider using another tool, like solr.</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> (You could put more details of your application here, but I doubt<br></span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> people will be willing to put in the time to really analyze it and<br>
</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> tell you how to fix it. I know I can't.)</span></blockquote><div><br></div><div>That's alright, I won't ask for such a time investment. As it is I greatly</div>
<div>appreciate everyone for replying and helping out already - thanks guys!</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">- solr is so fast it almost makes me want to cry. At ZC, we're<br></span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> increasingly using solr instead of the catalog. As the original<br>
</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> author of the catalog, this makes me sad, but we just don't have the<br></span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> time to put in the effort to equal solr/lucene.</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">- A common mistake when using ZODB is to use it like a relational<br></span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> database, puting most data in catalog-like data structures and<br>
</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> querying to get most of your data. The strength of a OODB is that<br></span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> you don't have to query to get data from a well-designed object<br>
</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> model.</span></blockquote><div><br></div><div>My use case is basically this: I have 400,000 'documents' with 17 attributes</div>
<div>that I want to search on. One of them is the date of the document. This index</div><div>I could easily do away with as the documents are organized roughly by date.</div><div>However, if I want to get a 'document' made at any date but with a certain attribute</div>
<div>in a certain range, I don't have a good way to do it based on how they are stored,</div><div>now. I could try making my own indexing scheme but I figured ZCatalog would</div><div>be well-suited for this...</div><div>
<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Jan 17, 2013 at 12:31 PM, Claudiu Saftoiu <<a href="mailto:csaftoiu@gmail.com" target="_blank">csaftoiu@gmail.com</a>> wrote:<br>
...<br>
<div>> One potential thing is this: after a zeopack the index database .fs file is<br>
> about 400 megabytes, so I figure a cache of 3000 megabytes should more than<br>
> cover it. Before a zeopack, though - I do one every 3 hours - the file grows<br>
> to 7.6 gigabytes.<br>
<br>
</div>In scanning over this thread while writing my last message, I noticed<br>
this.<br>
<br>
This is a ridiculous amount of churn. There is likely something<br>
seriously out of whack with your application. Every application is<br>
different, but we typically see *weekly* packs reduce database size by<br>
at most 50%.<br></blockquote><div><br></div><div>All that database contains is: a catalog with 17 indices of 400,000 objects,</div><div>the root object, a document map, and an object to hold the catalog. The</div><div>document map itself I put as a 'document_map' attribute of the catalog. Because</div>
<div>of the nature of my app I have to add and re-index those objects quite often (they</div><div>change a lot). This seems to cause the index .fs file to grow by a ridiculous</div><div>amount... is there anything obviously wrong with the above picture?</div>
<div><br></div><div>The main database does not have quite so much churn. Right after a pack just now, it</div><div>was 5715MB, and it gets to at most 6000MB or so after 3 hours (often just up to 5800MB). </div><div>I don't have to run the pack quite so often - is there a significant downside to packing often? </div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>> Shouldn't the relevant objects - the entire set of latest<br>
> versions of the objects - be the ones in the cache, thus it doesn't matter<br>
> that the .fs file is 7.6gb as the actual used bits of it are only 400mb or<br>
> so?<br>
<br>
</div>Every object update invalidates cached versions of the obejct in all<br>
caches except the writer's. (Even the writer's cached value is<br>
invalidated of conflict-resolution was performed.)<br>
<div><br>
> Another question is, does zeopacking destroy the cache?<br>
<br>
</div>No, but lots of writing does.<br></blockquote><div><br></div><div>I see. After all the above it really sounds like if I want fast indexing I should</div><div>just drop zcatalog and go ahead and use solr. It doesn't seem zcatalog + zodb,</div>
<div>the way they are now, are really made to handle many objects with many indices</div><div>that get updated often...</div><div><br></div><div>Thanks for all the help,</div><div>- Claudiu</div><div><br></div><div><br></div>
</div>