Presentation is loading. Please wait.

Presentation is loading. Please wait.

IBM T. J. Watson Research Center © 2006 IBM Corporation 24 May 2006 XML Screamer: Integrated, High-Performance XML Parsing, Validation and Deserialization.

Similar presentations


Presentation on theme: "IBM T. J. Watson Research Center © 2006 IBM Corporation 24 May 2006 XML Screamer: Integrated, High-Performance XML Parsing, Validation and Deserialization."— Presentation transcript:

1 IBM T. J. Watson Research Center © 2006 IBM Corporation 24 May 2006 XML Screamer: Integrated, High-Performance XML Parsing, Validation and Deserialization Margaret Kostoulas, Morris Matsa, Noah Mendelsohn, Eric Perkins, Abraham Heifets, Martha Mercaldi

2 IBM T. J. Watson Research Center © 2006 IBM Corporation 2XML Screamer24 May 2006 Outline Introduction Why is XML Parsing Slow XML Screamer: Design XML Screamer: Performance Conclusion

3 IBM T. J. Watson Research Center © 2006 IBM Corporation 3XML Screamer24 May 2006 XML Performance XML is everywhere Increasingly, XML is being used in processes that demand high-performance XML is widely seen as underperforming Validation is even worse Often, though, XML is used for exactly the kinds of things you want to validate

4 IBM T. J. Watson Research Center © 2006 IBM Corporation 4XML Screamer24 May 2006 Why are traditional XML parsers slow?

5 IBM T. J. Watson Research Center © 2006 IBM Corporation 5XML Screamer24 May 2006 How fast is your computer? An XML Parser must read through its input (and update the bytes of its output) A 1 GHz Pentium can read through an input buffer at approximately 100 Mbytes/sec which is approximately 10 cycles/byte.

6 IBM T. J. Watson Research Center © 2006 IBM Corporation 6XML Screamer24 May 2006 How fast are traditional XML processors? Xerces-C 2.6, non-validating, using SAX: approximately 6 Mbytes/Sec/GHz, which is ~165 cycles/byte Expat version for Windows using its UTF-8 API is about 12 Mbytes/sec/GHz (~80 cycles/byte) Remember: processor character scan rate = 100 MByte/sec/GHz (10 cycles/byte) What in the world are these XML processors doing for cycles with each byte they pick up? That may be on the order of 300+ instructions per byte!

7 IBM T. J. Watson Research Center © 2006 IBM Corporation 7XML Screamer24 May 2006 Output struct inventoryItem { int quantity; }; Input: Schema (abbeviated syntax): An Example

8 IBM T. J. Watson Research Center © 2006 IBM Corporation 8XML Screamer24 May 2006 A traditional XML Parser/Deserializer

9 IBM T. J. Watson Research Center © 2006 IBM Corporation 9XML Screamer24 May 2006 Input: c e d 003e Convert to UTF-16 Validate against "inventoryItem" Match against "inventoryItem" in deserializer Throw Sax event Discard Sax event 3c 69 6e e 74 6f d 3e UTF-8 A traditional XML Parser/Deserializer

10 IBM T. J. Watson Research Center © 2006 IBM Corporation 10XML Screamer24 May 2006 Input: Convert to UTF c e c e e UTF-8 A traditional XML Parser/Deserializer Validate against quantity Throw Sax Event for quantity Match against quantity in deserializer Convert 10 to UTF-16 and integer Validate as 0 < quantity < Discard Integer Sax event for UTF Convert 10 to integer (deserializer) Discard Sax event Copy integer to quantity field in structure

11 IBM T. J. Watson Research Center © 2006 IBM Corporation 11XML Screamer24 May 2006 Traditional parsers: performance issues Lots of expensive UTF-8 to UTF-16 conversions String compares done in UTF-16 (typically larger) Work duplicated between validator and deserializer Repeated data conversions (e.g. string/integer) Data copying Possible object & memory management overhead for SAX events Incremental reporting even when documents are small

12 IBM T. J. Watson Research Center © 2006 IBM Corporation 12XML Screamer24 May 2006 XML Screamer An Integrated Approach to High Performance XML Parsing, Validation & Deserialization

13 IBM T. J. Watson Research Center © 2006 IBM Corporation 13XML Screamer24 May 2006 The XML Screamer Project Goal: show how fast XML and XML Schema Processing can be Approach: an XML Schema compiler that optimizes across layers that are traditionally separate -- scanning, parsing, validation & deserialization are integrated

14 IBM T. J. Watson Research Center © 2006 IBM Corporation 14XML Screamer24 May 2006 What XML Screamer is… A compiler for XML Schemas Given a schema and a desired output API, generates a parser that: –Parses and validates against the schema –Populates the desired API Screamer compiler is in Java, produces parsers in C or Java C output much better tuned…much easier to study. All results reported here are for C.

15 IBM T. J. Watson Research Center © 2006 IBM Corporation 15XML Screamer24 May 2006 Screamer Parser APIs NoAPI: –just reports well-formedness and root validity Business object –like gSOAP, or JAX-RPC, SDO, etc. SAX –knowledge of schema allows pre-computation of some SAX output

16 IBM T. J. Watson Research Center © 2006 IBM Corporation 16XML Screamer24 May 2006 An XML Screamer Parser/Deserializer

17 IBM T. J. Watson Research Center © 2006 IBM Corporation 17XML Screamer24 May 2006 Input: c e e Validate UTF-8 against "quantity" Convert "1" "0" from UTF-8 to integer Make sure 0

18 IBM T. J. Watson Research Center © 2006 IBM Corporation 18XML Screamer24 May 2006 What makes XML Screamer fast? Optimizing across layers Avoid intermediate forms –Dont use SAX if you dont need it Avoid format conversions –Work in input encoding wherever possible Attention to detail In short: think like a compiler writer!

19 IBM T. J. Watson Research Center © 2006 IBM Corporation 19XML Screamer24 May 2006 How fast is XML Screamer?

20 IBM T. J. Watson Research Center © 2006 IBM Corporation 20XML Screamer24 May 2006 Benchmark Reporting Test environment –IBM eServer xSeries Model 235, 3.2 GHz Intel Xeon, 2 GB RAM, Microsoft Windows Server 2003 Service Pack 1. Microsoft (R) 32-bit C/C++ Optimizing Compiler Version –Other machines checked for consistency – see paper Results normalized to 1 GHz Pentium Processor –Therefore: throughput of 3.2 Mbytes/sec would be reported as 1 MByte/sec/GHz –Scales well across Pentiums, Xeons, etc. of various clock speeds (Centrino is bit faster per cycle)

21 IBM T. J. Watson Research Center © 2006 IBM Corporation 21XML Screamer24 May 2006 Test cases Report on 10 separate tests over 6 schemas All UTF-8 instances, single buffer, fits in memory. Sizes range from 990 bytes through 116.5KBytes.

22 IBM T. J. Watson Research Center © 2006 IBM Corporation 22XML Screamer24 May 2006 Screamer is validating, and report SAX events Median Performance improvement: 1.9x Expat 3.8x Xerces Comparison to Non-validating Parsers

23 IBM T. J. Watson Research Center © 2006 IBM Corporation 23XML Screamer24 May 2006 Business Object Creation Xerces and Expat included for reference Median Performance improvement: 2.9x Expat 5.9x Xerces * Business Objects not supported for tests 6 & 7

24 IBM T. J. Watson Research Center © 2006 IBM Corporation 24XML Screamer24 May 2006 Validation Comparison Median Performance improvement: 5.5x for Sax, 11.6x for Business Objects * Business Objects not supported for tests 6 & 7

25 IBM T. J. Watson Research Center © 2006 IBM Corporation 25XML Screamer24 May 2006 XML Performance Summary XML can be parsed, validated, and deserialized into high performance API at median throughput of about 35MBytes/sec. on a 1 GHz Pentium. –That is 35% of the speed of raw character scan rate. On modern 4GHz processor, thats 140MBytes/sec, or 14,000 10K Byte msgs/sec. –If you want to devote only 10% of CPU to parsing, you can still do 14 Mbytes/sec, or 1,400 10Kbyte messages per second

26 IBM T. J. Watson Research Center © 2006 IBM Corporation 26XML Screamer24 May 2006 Conclusions Parsing, validation, and deserialization can run at speeds within 20-40% of raw character scan rate. –Probably close to the true limits of XML performance. Validation can mean a net gain in performance, if you have the option to compile in advance. XML Stack is designed in layers, but in implementations, layers disrupt performance. –This has implications beyond just parsing and validation. API Choice can make a significant difference in performance.

27 IBM T. J. Watson Research Center © 2006 IBM Corporation 27XML Screamer24 May 2006 Related publications Perkins, E., Kostoulas, M., Heifets, A., Matsa, M., Mendelsohn, N. Performance Analysis of XML APIs, XML 2005 Conference (http://www.idealliance.org/proceedings/xml05/abstracts/paper246.HTML)http://www.idealliance.org/proceedings/xml05/abstracts/paper246.HTML Perkins, E., Matsa, M., Kostoulas, M., Heifets, A., Mendelsohn, N. Generation of Efficient Parsers through Direct Compilation of XML Schema. IBM Systems Journal, 45, No. 2, (May 2006).

28 IBM T. J. Watson Research Center © 2006 IBM Corporation 28XML Screamer24 May 2006 END

29 IBM T. J. Watson Research Center © 2006 IBM Corporation 29XML Screamer24 May 2006 Backup 1: Performance Measurements

30 IBM T. J. Watson Research Center © 2006 IBM Corporation 30XML Screamer24 May 2006 Backup 2: SAX Pre-computation


Download ppt "IBM T. J. Watson Research Center © 2006 IBM Corporation 24 May 2006 XML Screamer: Integrated, High-Performance XML Parsing, Validation and Deserialization."

Similar presentations


Ads by Google