SQLServerCentral Article

XML - Good and Bad



XML!!! It has brought advantages for the applications which we are creating. Using it, it is possible to create flexible and expandable applications. Because of the small size of files, the data transfer speed has also increased considerably, especially for web applications.

This text will not discuss about what XML is and how it is used. For that, you can go through XML simplified.

The process...

Few months back, as my team started using XML in one of our application, we were surprised by the ease with which the tasks were completed. XML was used mainly for database interactions as we need to do multiple updates, which were around thousands in number (by using the OPENXML feature of SQL Server 2000).

Now, going forward XML became the backbone of our applications and was used extensively.


Now comes the OVERUSE part which really made us work twice as the performance degraded because of XML. One of the features of our application was to build the windows explorer like structure for some set of directories i.e., displaying all the directories and files under a particular directory. All the required details were available in the database.

First, we retrieved the list of all the directories and the files for each directory. As, a tree-like structure was to be created, parent and child relation was required (this was stored in the database). With the complete result set, an XML file was created which stored the directory and its files details and also following the parent-child relation. By looking at the XML file, you can figure out the actual directory structure.

Now, the tree was to be displayed. So it was decided to use flex-grid and the XML file. It worked very nicely and fast, but the performance started degrading as the number of directories increased.

By really debugging hard, the bottleneck for this degradation was found, and to our surprise, it was the intermediate step of XML file creation. The recursion process for creating the parent-child relation in the XML file was repeated again for creating the actual tree-like structure in the flex-grid.


The result of this was weeks of re-work and a lesson learnt. Not every good thing can give you performance, unless all the pros and cons are taken care of before the actual implementation.


You rated this post out of 5. Change rating




You rated this post out of 5. Change rating