Each document in MODx has metadata that is loaded on every request. So, if you make every product a document, that will decrease your performance based on the quantity of those documents. If you use an external table and present them through a single document (or a couple for different views), then there is no metadata, no loss of performance, and your SQL queries are again king. Your search would have to be custom of course, but you have to weigh the pro’s and con’s of both approaches and decide which is best for your implementation.
I hear a lot of users say that storing a lot of products in the documents table would make the site slow, but why is that? Is it because of how the manager is built? It’s still the same amount of data when storing in another table no?
Thanks Opengeek for your answer. But does this also count for my approach?
Each document in MODx has metadata that is loaded on every request. So, if you make every product a document, that will decrease your performance based on the quantity of those documents.
It absolutely applies to your approach. If you have 1000 products and each product is represented by a MODx document, then on every request to any MODx page, you will be loading the metadata (alias, id, content-type, etc.) for all 1000 documents; that’s 1000 entries in multiple arrays. You can see this manifested in the assets/cache/siteCache.idx.php file. So there is a curve of performance based on the number of total documents you have published in your site definition.
Quote from: OpenGeek at Jun 26, 2008, 10:16 AMThanks Opengeek for your answer. But does this also count for my approach?
Each document in MODx has metadata that is loaded on every request. So, if you make every product a document, that will decrease your performance based on the quantity of those documents.
Each product(=document) is allowed to be a separate page that can be accessed directly (the product detail page). In that document I use regular TVs (price, weight,...) and a couple of snippets, for instance to display related products.
All the snippets contain API calls like getDocument or getTemplateVarOutput to collect data from different documents (I use my own snippets but I could use Ditto for this I guess). The data layout is shaped with chunks.
So when is the metadata loaded then? Not I hope right? Lately I’ve been dazzled by the ease of use of Modx and all the things the designers have thought of that make this CMS a true toolbox to build anything you want. Yet I’ve never tested performance, since it hasn’t been an issue before, but then again I don’t have +1000 or so documents heavily mashed up.
Can you give me a typical example of when the metadata is loaded multiple times?
Yes, I’ve been investigating that file. So to make sure I understand this correctly: siteCache.idx.php is generated at each change on the manager end and loaded once at each request on the front end. Since all docs metadata, chunks, snippets etc. is stored in that file, the document parser gets its data from there to minimize database requests? Yet, the more data stored in Modx (directly), the bigger siteCache.idx.php, so there is a turning point where this type of caching no longer benefits performance. (And this issue has been addressed as the +5000 doc limit and will be solved in 0.9.7 ?)
You can see this manifested in the assets/cache/siteCache.idx.php file.
Thanks for freshing up!