Forum Moderators: coopster

Message Too Old, No Replies

XML + XSLT/Sablotron versus MySQL + PHP?

Which is faster, more scalable?

         

jedlie

2:00 pm on Mar 20, 2003 (gmt 0)

10+ Year Member



Hello folks,

I run a site that has a good deal of dynamically generated content. each time a page is hit, PHP connects to a MySQL database and performs 40-50 queries (the data is relational) before returning a page.

The thing is, the data isn't really dynamic: it's more or less a dictionary of terms that only gets updated so often.

I was thinking of switching to an XML/XSLT system, in which the XML is static (generated from the database and cached), but the pages are dynamically generated using XSLT, depending on what the user wants to see.

My question is: given the relatively large number of queries per page, would a static XML/XSLT using Sablotron on PHP system be faster than a MySQL + PHP setup? In other words, which requires more overhead: multiple redundant queries to the database, or XSLT parsing?

(XSLT parsing on the client not an option.)

Any help would be appreciated.

Alternative Future

2:36 pm on Mar 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello and Welcome to WebMasterWorld jedlie,

I currently work with xsl/xslt/xsl-fo we use castor as our parser.
We use this to create PDF documents on the fly, and some can be quite large, but the time difference between them being displayed on the client-side has never struck us as major!
I think XML/XSL is the way forward ;)

HTH,

-gs

Gibble

2:43 pm on Mar 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd have to agree, I currently run queries to a mySQL DB, convert the results to XML immediately and then use sablotron (from PHP) to transform the documents with XSL into HTML and it doesn't seem any slower than before.

Your setup would be similar only you will be caching the info as XML and not going to the database all the time, therefor it should be quicker.

jedlie

2:56 pm on Mar 20, 2003 (gmt 0)

10+ Year Member



Interesting, thanks for the tips, Alternative_Future and Gibble.

This should make maintenance a lot easier too. Only one PHP page with 5 lines of code...

Alternative Future

3:08 pm on Mar 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



XSL/XSLT and the FOP packages can be quite intense to pick up at first <xsl:for-each select=""/> and the variable usage is again painful *BUT* once you have played around with it for a little while its quite easy :)

-gs

Gibble

3:08 pm on Mar 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeah, that's pretty much it, I cut my site down from a several dozen PHP pages to just a dozen when I started using XML. And there is only ONE XSL file that takes whatever XML I give it and displays it properly :)

I love XML.