Comparing XML processing performance in middleware and database: a case study

Marcus Paradies, Susan Malaika, Matthias Nicola, Kevin XieMiddleware (Industry Track) 2010 · DOI

TL;DR

This paper investigates the performance trade-offs between processing XML data in middleware versus within a database system. It finds that leveraging database-native XML capabilities (SQL/XML and XQuery) significantly outperforms middleware-based processing for common XML operations, while also drastically reducing development effort.

What Problem Does This Paper Address?

As XML has become a ubiquitous data format, organizations face a crucial decision: where should XML manipulation and processing occur? Should it be handled by application code running in middleware (like application servers), or should it be pushed down into the database system itself, utilizing its growing XML capabilities? This choice impacts performance, development complexity, and overall system efficiency. The paper aims to provide empirical evidence to guide this decision by comparing the performance and development cost of three common XML use cases implemented in both middleware and database environments.

Methods

The authors designed a case study comparing two implementation approaches for three distinct XML processing use cases:

  • Middleware Implementation: This approach involves reading XML data (often as a BLOB) from the database, parsing it using standard Java XML parsers like SAX or DOM in the application server, performing the necessary manipulation, and then writing the results back.
  • Database Implementation: This approach leverages SQL/XML and XQuery extensions within a database system (specifically DB2 9.7). XML manipulation is performed directly within SQL statements, either during data retrieval (extracting values) or as part of insert/update operations.

The three use cases are:

  1. Extract: Retrieving specific values from XML documents.
  2. Split: Breaking down large, concatenated XML documents into individual ones.
  3. Modify: Inserting, updating, or deleting elements within existing XML documents.

Performance was measured in terms of throughput (transactions per second) and CPU utilization. Development cost was estimated by counting lines of code.

Datasets

The study utilized a subset of the TPOX (Transaction Processing over XML) benchmark [6]. Specifically, it worked with 50,000 "custacc" documents, each representing a customer and their investment accounts. The TPOX benchmark provides an XML data generator and a workload driver to simulate concurrent user activity. The paper did not introduce a new benchmark but rather reused and adapted existing components from TPOX.

Key Insights and Ideas

  • Database is King for Performance: For all tested use cases, pushing XML processing into the database using SQL/XML and XQuery yielded significantly better performance than middleware-based processing. This is attributed to the database's ability to store XML in a parsed format, avoiding repeated parsing overhead.
  • Development Effort Skyrockets in Middleware: The lines of code required for middleware implementations were dramatically higher (10x to 13x) compared to the database implementations. This is because middleware code often involves procedural traversal and manipulation, whereas SQL/XML and XQuery offer declarative, more powerful constructs.
  • "Parse Once, Read Many" Advantage: Databases with native XML support offer a significant advantage when XML documents are stored for audit or archiving. Once parsed upon insertion, subsequent queries and updates can access the data without re-parsing, leading to substantial performance gains.
  • Transient XML is Middleware's Domain: If XML data is transient and only processed "on the fly" without persistent storage, middleware processing might be more appropriate.

Key Results

  • Extract Use Case: SQL/XML achieved up to 3x higher throughput than SAX-based middleware processing, especially for extracting small amounts of data.
  • Split Use Case: For splitting large XML batches, SQL/XML was up to 3x faster than DOM-based middleware processing, with significantly lower CPU consumption.
  • Modify Use Case: Database-based XML modification was 2.2x to 2.6x faster than DOM-based middleware modification, with performance scaling positively with the number of concurrent users.
  • Development Cost: Middleware implementations required 10x to 13x more lines of code than their SQL/XML counterparts.

Limitations and Future Work

  • Single Database System: The study was conducted using only DB2 9.7. The authors acknowledge that different XML databases might exhibit varying performance characteristics and suggest evaluating other database systems.
  • Single Machine Environment: All tests were run on a single machine, simplifying CPU monitoring but not fully simulating distributed environments.
  • Concurrent Multi-User Testing: While Use Case 3 included multi-user testing, Use Cases 1 and 2 were tested with a single user. The authors intend to run these use cases in a concurrent multi-user context.
  • Other XML Processing Techniques: The paper suggests exploring other XML processing techniques, such as StaX parsers in middleware or newer XQuery/XPath capabilities in application servers (like the WebSphere XML Feature Pack), as well as XML transformations using XQuery.

Summary updated

BibTeX
@inproceedings{paradies2010comparing,
  author = {Marcus Paradies and Susan Malaika and Matthias Nicola and Kevin Xie},
  title = {{Comparing XML processing performance in middleware and database: a case study}},
  booktitle = {Middleware (Industry Track)},
  year = {2010},
  doi = {10.1145/1891719.1891725},
}

Loading related content...

Figure