ÂÂÂLately Iâ€™ve been working with a client using Tridion in an interesting way. This client manages websites for hundreds of customers, each site being virtually identical. Of course, information such as the customer name, contact info and store hours, along with dozens of other bits has to be customized for each site. One of the ways they manage this unique information led me to a useful discovery on how Template Builder handles large packages. Hopefully by sharing here I can save someone else going on the same wild goose chase I did.
In order to populate the rendered pages of each site, my client places all the pertinent information on the package when publishing a page. This way they can centralize all of the fields that need to be updated for a customer to a single component. Then a Template Building Block (TBB) grabs the information and fills in the blanks on the page, like a robotic Mad Lib.
This leads to the package for each page getting relatively large as it can have hundreds of items, which means hundreds of entries in the XML that makes up the package. When this page is run in Template Builder we see something I didnâ€™t expected:
As you can see, each TBB in â€œLoad Code Snippetsâ€ runs quite quickly, much less than a second generally. But when viewed as a whole, â€œLoad Code Snippetsâ€ takes much longer. Multiplied across a few compound templates per page, a few dozen pages per customer, and a few hundred customers, this unaccounted for time could become quite a problem when publishing our site, right?
Before answering that question, let me explain whatâ€™s causing this gap. As you may have guessed, itâ€™s the large publishing package thatâ€™s moving through Template Builder. The larger the package, the longer it takes for Template Builder to pass it around between TBBs. The quickest way to get a huge package (publishing package that is, for other types check your spam folder) is to have many items. This is because each item, even if itâ€™s only a single character adds a few lines of XML to the package. A thousand items, each a single character long is significantly larger than a single item with a thousand characters.
With this in mind and eager to save my client hours and hours of publishing time, I set out to do two things:
- Reduce the number of TBBs on each Page Template â€“ by cutting down the number of TBBs our large package had to be handed between weâ€™d cut down on tonnes of time
- Consider adding our items as long, comma-separated strings â€“ even with the extra time it would take to parse our giant string, given the time it was taking to pass around our large package, I figured weâ€™d still come out ahead
After spending some time getting together a proof of concept for these two modifications I ran my page through Template Builder and saw a huge improvement, on the scale of 40% reduction of publishing time!
However, I was in for a surprise when I went to publish my test pages in Tridion. You see, Tridion publishing had always been much faster than in Template Builder, but I still expected a proportional improvement to publishing time. Imagine my disappointment when my changes barely put a measurable dent in publishing time. In fact, the publishing time in Tridion very closely correlated to the sum of each individual TBBâ€™s time measurement in Template Builder, both before and after I made my modifications, meaning no matter what I did, â€œLoad Code Snippetsâ€ in my image above took about 8s to publish in Tridion, rather than 24s.
What does this mean? It means that Template Builderâ€™s time estimates start to break down as the size of your publishing package increases and we shouldnâ€™t be too concerned if we see large publishing times in Template Builder until we make sure Tridion is taking the same amount of time. And it means, at least for this case, the size of your package really doesnâ€™t matter.