Wednesday, October 24, 2007

Relational Data as XML

Everything is fodder for argument with XML. Note these 50 pages of point-counterpoint that discuss nearly every aspect of XML's use and usability - it's a pretty quick read [http://www.zapthink.com/report.html?id=ZT-XMLPROCON].

The short of this entry is that storing data on the server-side as XML documents is a very flexible, readable, maintainable, and most importantly scalable option for a Web application. Document size issues that tend to accompany XML-based storage can be avoided by leveraging the size of documents vs. external contextual data (i.e. indexing information). Performance and scalability for even the most demanded applications can be as outstanding as any highly-trafficked Web site, if the metaphor of serving your data in XML documents as Web pages can be kept in mind.

The traditional rule of thumb is to put "data" in a database and store documents on a file system. But breaking up a document's worth of data to shove into a database is not a difficult task, and composing a table or two into a document of information is also not difficult. Where things become complicated is when mounds of contextual metadata is generated to cope with relational data. Separating contextual data from content can give you immense power over what you serve, when you serve it, and how you manage it.

-----

There are many time-sinks and concerns when using XML to describe your data, a few of which are engineering the documents' structures, handling data serialization, performance issues, and information bloat. Before you can massage your data into XML, you need to know what structure the document should be - sometimes this is not trivial, especially if representing relational data, and will take time. Taking into account the hitch that binary serialization is brittle and not always platform/hardware independent, having to massage your data so it can be serialized as String representations may also take time; complex objects need to be broken up into primitives to be represented nicely.

Once this is finished, immediately one might notice that some XML representations are thousands of lines long (I made this wonderful mistake more than once), slowing your parser and increasing the transfer time towards O(eternity); the more complex the object, the more contextual descriptions and metadata will be needed to describe the object. Ugh.

Since there is (obviously) a connection between the size of your XML document and the time it takes to parse its content, a good way to increase performance is to break your data into finer levels of granularity. For instance, if you have a document representing the furniture in your house by room, you can easily break the document up into many documents, each representing one room.

With each room separated out, a natural idea would be to add an additional tag under the "room" parent node (or as an attribute) that identifies which house it belongs to. If we break things down even farther, and separate out each piece of furniture into its own document, we would need to add a tag that identifies which room each piece of furniture belongs in.

This method of "contextualizing" XML documents has a problem. Since the information is internal to the document, each time the context of a document needs to be determined it must be parsed and searched. Additionally, this method only allows the "child" document to know who its "parent" is - a house would not know what furniture it has, only the furniture would know which house it belongs to. There are at least two ways to solve this, and the first is obvious - after breaking up a large document, build a "virtual" document that has references to its pieces and parts. This is not a terrible way of doing things - it can, however, lead to an enormous amount of files.

The alternative is to externalize all "virtual resources" into one document, namely a large indexing file. So if multiple house documents - "FooHouse" and "BarHouse" - have each of its rooms stored as separate files, a master document will subsume the identifiers for both room documents under their particular identifiers. When a user requests the resource "FooHouse", the master document (which is assumedly kept in memory for quick traversal) will either assemble the document, or - assuming a screen could not handle showing every room's contents all at once - simply serve each room document when requested.

This solution can scale well, requires no particular storage model (the master document could refer to tables in a database, files on a disk or even a URL) and allows a conceptual resource to be as complex as needed. It also allows for performance tuning, as the client can receive only the portions of the resource pertinent to their particular task.

8 comments:

Anonymous said...

INSERT

Website designing India said...

Thanks for sharing your incredible thoughts on Web application development services. it is valuable.

Anonymous said...

[b][url=http://www.shoesonlinesales.co.uk/]louis vuitton outlet[/url][/b] It may be very disheartening once your laptop performs up. Fortunately, a lot of these problems might be sorted out fairly rapidly with Intel Root i5 CPU Driver updates. The expression driver is employed right here for describing the software package, which would allow your laptop or computer to commune with the hardware gadget such as printer.

[b][url=http://www.salelouisvuittonbagsus.com/]louis vuitton handbags[/url][/b] Nonetheless you originally fulfill a prospect, soon after that introduction, you still should take every one of the required methods to build a romantic relationship. With each individual prospect that you just face, on the other hand you initially encounter them, at some time you'll need to pick up the telephone and get in touch with them. If at that position you do not depict yourself correctly and articulately, you won't shift to the next move.
Flat informal espadrilles are becoming quite popular and are the new fad. Even so, there are plenty of individuals who even want putting on heeled sandals. For them, the best alternative could well be the wedge espadrille shoes. You can even verify on-line for the latest Juicy Couture purses. For all your on the net purchases you may shell out using PayPal, the important thing credit score cards, or perhaps by loan provider transfers. To get to the safe and sound facet you may have to deal with a licensed retail retail outlet to make sure that you may stay clear of the danger of surrendering your very difficult-earned income to rogue traders..

[b][url=http://www.bestlouisvuittonukstore.co.uk/]louis vuitton uk[/url][/b] Check out the city of Intrigue with Flights to Abuja The city of Abuja is christened given that the 'Second London' of the world and is the newest funds of Nigeria. It really is and sprawling metropolis with thoroughly clean streets that has a handful of points of interest to invest a calm escape inside the lap of tranquility and serenity. It really is and sprawling town with cleanse roads which has a handful of attractions to spend a relaxed escape while in the lap of tranquility and serenity.
Principal Burberry Bags to not mention hand bags commonly are high-priced and also you simply may possibly ought to commit atmosphere explode selling charges. You personal these reproductions of these chanel purses therefore you would not usually still provide the aptitude produce out your big distinction. You will not have to shell out viewpoints throwing away fees furthermore to high-quality needn't be severely sacrificed.

[b][url=http://www.uggsbootsoutletnow.com/]ugg boots outlet[/url][/b] They go with each other well. Women like rings, earnings, necklace, and bracelet. Diamond is incredibly better. These types of Hermes bags or any Hermes bags are certainly not offered on the web. Often, a customer can discover a second-hand or utilised Hermes Birkin at a couture-consignment store. These Hermes Birkin bag normally commences in a cost of 7500USD, not which includes the income tax.

Anonymous said...

[b][url=http://www.louisvuittonoutletmart.co.uk/]louis vuitton handbags[/url][/b] If you practical experience self-consciousness with regard to the look of the vagina and labia then vaginal rejuvenation could be some thing you might contemplate. Vaginoplasty is often a cosmetic surgery that may change the overall look with the vaginal opening - or labia. If you really feel that your labia is simply too huge, leading to bulging in clothing, difficulty putting in or getting out tampons or creating distress or humiliation through sexual intercourse the dimensions and look is usually altered by significant experienced physicians trained in vaginal rejuvenation.

[b][url=http://www.cheapuggsstore.com/]www.cheapuggsstore.com[/url][/b] L . a . convergenza reale del mondo di Quando nel dell globale di villaggio;, che l emergenti elizabeth dei NEI Paesi di redditi di dei di aumento within calo my partner and i tassi di povert vicino occidentale di vita popular allo, del alcune del cose preoccupano di quindi di elizabeth di si lower..

[b][url=http://www.uggsclearancebusiness.com/]uggs[/url][/b] But Seoul just isn't Tokyo or Hong Kong. And because the Korean luxurious sector easily matures, ladies like Oh want a lot more from their brands. Gene Krell, style director for Vogue Nippon, states when he first went to Seoul fourteen several years ago, the have an effect on of overseas fashion was nil.

[b][url=http://www.louisvuittonoutletmart.co.uk/]www.louisvuittonoutletmart.co.uk[/url][/b] Im not the sort of individual, even so, who likes to sit there and point out that certainly, you'll want to have a handbag, with out presenting a good cause for it. So to the weekend I decided to go without employing my Louis Vuitton bag or even a wallet. Here is precisely what took place. If clean and steady charge of all incoming and outgoing calls is vital in your firm's achievements, chances are you'll do very well to incorporate the ADIX voice and details conversation technique. It may possibly cope with an enormous selection of digital data knowledge and is particularly designed to increase, not swap, enlargement modules if a company wishes to have excess ports. This voice messaging program is excellent for small-room inns and motels, mattress and breakfasts plus a quantity of modest small business styles..

[b][url=http://www.onlinesaleswebsite.com/]www.onlinesaleswebsite.com[/url][/b] As attractive and fabulous as Louis Vuitton, it realizes that fashion cannot exist significantly absent from culture. For that reason, it attempted to examine the Chinese cultural vogue things and also the substantial Chinese sector. As I see it, Chinese are reserved in luxurious intake, specially when it can be less than a overseas model.

Anonymous said...

They spent quite a bit of time together from time to time (in Tesla's laboratory, among other places). [url=http://www.mulberryhandbagssale.co.uk]Mulberry Alexa Bags[/url] The "holdback device" is the part that breaks. [url=http://www.goosecoatsale.ca]canada goose down coat[/url] Qrwtjqhpa
[url=http://www.pandorajewelryvip.co.uk]pandora store[/url] Jfxlldkqg [url=http://www.officialcanadagooseparkae.com]canada goose chilliwack[/url] svygeaiqb

Anonymous said...

top [url=http://www.001casino.com/]online casino[/url] brake the latest [url=http://www.casinolasvegass.com/]las vegas casino[/url] free no consign hand-out at the leading [url=http://www.baywatchcasino.com/]online casinos
[/url].

Anonymous said...

Hello. [url=http://ph-pills.com/item/generic_propecia.html]online propecia[/url] hold this deals

Anonymous said...

http://hermeskelly.citationguide.net hermes handbags hermes bag styles