Skip to main content

Tizra gets faster

Non-technical summary: things are lots faster at Tizra sites and admin tools. There's certainly more to do, but we've got more tricks up our sleeves! Because the big current speed boost is related to one cause, and it took me a while to track down, the geek appendage to this post describes what we found and how we fixed it.

Geekly details

I spent a bunch of time last week looking at system performance. As we've been adding customers and usage, we were beginning to feel the pinch. Performance always varies, but the range of response times was getting wider as things slowed, leading me to think that there might be some systemic issues that would give us a quick improvement (and indeed there was some Linux tuning that helped a bit). But data access seemed to be the real issue, so I spent a bunch of time looking into hibernate, and our caching and querying, and then wound up spending a day or so basically watching all the queries go through Postgres. And you know what? most of them seemed much slower than they should be, even though they are pretty hairy.

Of course, the next step was to check for database indexes, and how the query plans were using them. But in hand testing the plans looked good, and the indexes were sensible. But when run by hand the queries were also significantly faster than when hibernate ran them! This was much easier to see now that we have a live load, which is inevitably different from a test setup. So why the difference? Postgres was ignoring our indexes only when Tizra publisher made the queries.

Turns out that there's an old bug in Postgres where it would ignore indexes on bigint fields in prepared statements unless there was an explicit data type cast. (That type confusion was an obscure result of skew between Postgresql and the SQL standard.) And that was the behavior I was seeing, even though we were using a much more recent vintage of all the software. This was terrible for us, because we have a multi-tenant publishing system for large document collections and we use bigints as primary object identifiers!

So, why the old problem if the bug is gone, and we are not using postgres 7? It turns out that we dynamically build those hairy queries, in HQL (hibernate query language), using the String trick. But nowadays instead of making your indexes work, it breaks them! The differences are invisible in the SQL. It turned out that we were in a version "donut hole." Our database was recent enough so the String trick worked the opposite way (preventing fast queries for our prepared statements), but the JDBC driver wasn't making the calls in the right way to make the old trick work. End result: we're now running the latest JDBC driver with compatibility options set while we update our hairy query generator. And now we can really start tuning our setup!

If the web had not provided the history of the old bug, I would have had a much worse time even knowing where to look to find our somewhat subtle configuration issue. So enjoy the speedup, I sure am!

Comments

Anonymous said…
This is pretty wierd, any chance you can post the exact version numbers of Postgres, Hibernate, and JDBC involved?

Popular posts from this blog

Yum! Tizra Eats Its Dogfood

We keep talking about how Agile PDF makes it easy for nontechnical users to do sophisticated online publishing. Well, tell a story like that long enough and people start to wonder why you're not doing it yourself. Besides, any product benefits when its designers and builders are also users. Software developers call it eating your own dogfood . So a few nontechnical members of the Tizra team dug in (with Joya, pictured above, as menu advisor). We did it just they way any publisher would, applying our company branding with the Agile PDF control panel and basic CSS skills, then uploading PDFs . The only difference is we're not actually publishers, so we used files freely available on the web, and of course, we're giving them away rather than selling them. Voila! The New Agile PDF Demo Site Take a look . Then drop us a note , and we'll show how you can do the same—and a lot more—with your content. All of us, except maybe Joya, found it quite the best dogfood we...

Behind the Screens, Pt. 2--Customizing Site Design in Tizra Publisher

If you’ve seen some of the sites created with Tizra Publisher, you know how different they can look. But how does this happen? In this second in our series on the Tizra Publisher web based control panel ( first post here ), we’ll show how easy it is to completely re-skin and restructure an Tizra Publisher site in a matter of hours. First, a little slideshow of some recent results: As in the first post, we’ll use the eat.shop guides from Cabazon Books as our example. Founded by a graphic designer, Cabazon has a strong visual identity and has done a great job reinforcing it across its print and online properties. Step 1: Pick a design While Tizra Publisher does provide pre-made templates for publishers to customize, Cabazon already had a site design they were happy with, and wanted to carry it over to the new online books site they were building on Tizra Publisher. Screens from the preexisting design they wanted to match: Cabazon’s original eat.shop homepage. Origin...

Using XML to Create a Better Online Reading Experience for the American Payroll Association

Congrats to the American Payroll Association on their recent launch of XML-based publications on Tizra!  Thanks to this collaboration, APA's authoritative books for payroll professionals are now available in crisp, reflowable HTML, creating a user experience that feels like a truly digital native product, rather than a conversion from print. XML-based publishing also creates a better mobile reading experience, supports more precise search and navigation, and opens the door to better accessibility for users with low vision and other disabilities. Our partners at  Scribe  did a great job supporting APA through the process of producing the XML for loading into Tizra, and we’d definitely recommend them to anyone interested in such a transition. It’s hard to overstate what a big step forward this is for Tizra as a platform and a company. XML has long been planned for in the product's architecture, but now for the first time, we have a working example that demonstrates t...