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

Slides:



Advertisements
Similar presentations
TWO STEP EQUATIONS 1. SOLVE FOR X 2. DO THE ADDITION STEP FIRST
Advertisements

EcoTherm Plus WGB-K 20 E 4,5 – 20 kW.
Números.
PID Control Loops Guy Zebrick.
PDAs Accept Context-Free Languages
ALAK ROY. Assistant Professor Dept. of CSE NIT Agartala
Fill in missing numbers or operations
EuroCondens SGB E.
Copyright © 2002 Pearson Education, Inc. Slide 1.
Copyright © 2003 Pearson Education, Inc. Slide 8-1 Created by Cheryl M. Hughes, Harvard University Extension School Cambridge, MA The Web Wizards Guide.
Chapter 4 Parameters and Overloading. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 4-2 Learning Objectives Parameters Call-by-value Call-by-reference.
Chapter 1 C++ Basics. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 1-2 Learning Objectives Introduction to C++ Origins, Object-Oriented.
Copyright © 2013 Elsevier Inc. All rights reserved.
Power of Evidence Review
and 6.855J Cycle Canceling Algorithm. 2 A minimum cost flow problem , $4 20, $1 20, $2 25, $2 25, $5 20, $6 30, $
© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 11: Structure and Union Types Problem Solving & Program Design.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
CALENDAR.
Making a Line Plot Collect data and put in chronological order
0 - 0.
CHAPTER 18 The Ankle and Lower Leg
2 pt 3 pt 4 pt 5 pt 1 pt 2 pt 3 pt 4 pt 5 pt 1 pt 2 pt 3 pt 4 pt 5 pt 1 pt 2 pt 3 pt 4 pt 5 pt 1 pt 2 pt 3 pt 4 pt 5 pt 1 pt Time Money AdditionSubtraction.
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
ADDING INTEGERS 1. POS. + POS. = POS. 2. NEG. + NEG. = NEG. 3. POS. + NEG. OR NEG. + POS. SUBTRACT TAKE SIGN OF BIGGER ABSOLUTE VALUE.
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
MULT. INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Addition Facts
Year 6 mental test 10 second questions
Year 6 mental test 15 second questions Numbers and number system Numbers and the number system, Measures and Shape.
£1 Million £500,000 £250,000 £125,000 £64,000 £32,000 £16,000 £8,000 £4,000 £2,000 £1,000 £500 £300 £200 £100 Welcome.
1.Click Reports>Request>Financial 2.Select Individual Reports 3.Click OK Running Report CU1010 Analysis Balance Report.
ZMQS ZMQS
The 5S numbers game..
A Fractional Order (Proportional and Derivative) Motion Controller Design for A Class of Second-order Systems Center for Self-Organizing Intelligent.
$100 $200 $300 $400 $100 $200 $300 $400 $100 $200 $300 $400 $100 $200 $300 $400 $100 $200 $300 $400.
The basics for simulations
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
ABC Technology Project
Yong Choi School of Business CSU, Bakersfield
Figure 3–1 Standard logic symbols for the inverter (ANSI/IEEE Std
TCCI Barometer March “Establishing a reliable tool for monitoring the financial, business and social activity in the Prefecture of Thessaloniki”
Progressive Aerobic Cardiovascular Endurance Run
Squares and Square Root WALK. Solve each problem REVIEW:
© 2012 National Heart Foundation of Australia. Slide 2.
1 Review Quisioner Kendala: Kurang paham materi. Praktikum Pengaruh teman.
1 Overview of Testing Methodology Obtain generic Test Scripts Populate Self Testing Work Paper Template Prepare actual test scripts Determine sample Combine.
2011 WINNISQUAM COMMUNITY SURVEY YOUTH RISK BEHAVIOR GRADES 9-12 STUDENTS=1021.
Before Between After.
2011 FRANKLIN COMMUNITY SURVEY YOUTH RISK BEHAVIOR GRADES 9-12 STUDENTS=332.
ST/PRM3-EU | | © Robert Bosch GmbH reserves all rights even in the event of industrial property rights. We reserve all rights of disposal such as copying.
Addition 1’s to 20.
25 seconds left…...
2.10% more children born Die 0.2 years sooner Spend 95.53% less money on health care No class divide 60.84% less electricity 84.40% less oil.
Subtraction: Adding UP
Test B, 100 Subtraction Facts
Numeracy Resources for KS2
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
Week 1.
Number bonds to 10,
Figure 10–1 A 64-cell memory array organized in three different ways.
We will resume in: 25 Minutes.
Static Equilibrium; Elasticity and Fracture
Lial/Hungerford/Holcomb/Mullins: Mathematics with Applications 11e Finite Mathematics with Applications 11e Copyright ©2015 Pearson Education, Inc. All.
1 COMP 206: Computer Architecture and Implementation Montek Singh Wed., Oct. 23, 2002 Topic: Memory Hierarchy Design (HP3 Ch. 5) (Caches, Main Memory and.
A Data Warehouse Mining Tool Stephen Turner Chris Frala
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
12-Apr-15 Analysis of Algorithms. 2 Time and space To analyze an algorithm means: developing a formula for predicting how fast an algorithm is, based.
Presentation transcript:

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

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

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

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

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.

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!

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

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

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

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

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

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

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

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.

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

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

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<integer<10000 Copy integer to deserialized structure Validate UTF-8 against "inventoryItem" 3c 69 6e e 74 6f d 3e An XML Screamer Parser/Deserializer UTF-8

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!

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

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)

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.

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

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

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

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

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.

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 ( 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).

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

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

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