[ Pobierz całość w formacie PDF ] .Table 4-2 Contrasting JAX-RPC Performance Using Various XMLDatatypes8,585 bytes 334,933 bytesString 50 milliseconds 773 millisecondsSOAP Element 331 milliseconds 12,284 millisecondsSOAP Attachment 39 milliseconds 243 millisecondsThat leaves software developers who choose JAX-RPC to buildservice interfaces with few choices to efficiently handle moderate tohuge payloads.Even if SOAPElement performance were good in theJWSDP reference implementation, I still would not recommend itsDOM approach, which requires the entire document to be in memorybefore the service starts transmitting it across the wire.For thesemoderate to huge XML messages, a streaming solution appears themost likely candidate for FastSOA.A far superior choice in Java would be to stream an XML docu-ment into a SOAPElement (xsd:anyType) element; however, thatcould lead to badly formed SOAP documents and potential securityholes.For moderate and huge XML messages, String appears to bethe safe choice for security, interoperability, and performance.Unfortunately, this means that all of the SOAP stacks that adoptedthe JAX-RPC specification have the same problems handling moder-ate to huge XML messages.The JAX-RPC specification is widelyimplemented, both by open source projects for example, ApacheAxis and by commercial vendors such as Sun, IBM, and BEA.4.2 Mitigate Performance Problems with the FastSOA Architecture 91Finally, if the above discussion makes you think about writingyour own SOAP binding, then please stop.Consider these issuesbefore choosing to write your own SOAP binding.1.It will be up to you to maintain your SOAP binding codewhen the SOAP specification changes and/or softwaredevelopers begin to widely use different and incompatibleimplementation styles.2.You will need to publish and maintain a service interfacedevelopment kit (akin to a Software Development KitSDK) for your service.Many software developers needexample code they have previous experience using to reallyunderstand an SDK.3.When tools emerge to rapidly build service interfaces, youwill missout on their advantages while you maintain yourcustom code.While this section discussed the JAX-RPC APIs and datatypes, thenext shows how choosing the best parser that is appropriate to yourdata impacts performance and scalability.4.2.2 Use the XML Parser That Is Appropriate to Your DataOften SOA designs overlook the impact an XML parser has on theperformance and scalability of the finished system.Chapter 1 urged,among other things, a document-centric approach to building SOA-based information systems.Earlier in this chapter I showed the scal-ability and performance problems of using remote procedure call(RPC) patterns in SOA.Adopting these patterns does not automati-cally deliver good performance and scalability.Software developers have a variety of approaches to XML mes-sage parsing, including the Streaming API for XML (StAX), XMLbinding compiler, Java Architecture for XML Binding (JAXB andJIBX), and Document Object Model (DOM) techniques.Some pro-vided better performance than others.For instance, many StAX pars-ers deliver 2 to 10 times faster performance than DOM parsers.Muchof the performance difference came from matching the right XMLparser to the type of data being parsed.For instance, parsing a com-plex document that uses the automotive industry Business ObjectDocument (BOD) schema17 will highlight performance of some XML92 Chapter 4 Identifying And Avoiding SOA Performance Problemsparser implementations, while working with simple RSS feeds willshow other parsers in a favorable light.Testing XML parser implementations against three use casesdelivers useful performance and scalability knowledge:" Parsing moderate to huge XML documents.The documentsare typically 10 kilobytes to 5 megabytes for instance, anHL7 document or BOD.In this case, I recommend using anXML binding compiler such as JAXB, which addresses ele-ments directly." Parsing XML documents that contain many elements thatare not nested deeper than two or three elements deep.Think of a stream of data where skipping unwanted ele-ments yields a performance advantage.In this case, aStreaming XML (StAX) approach works best
[ Pobierz całość w formacie PDF ] zanotowane.pldoc.pisz.plpdf.pisz.plmikr.xlx.pl
|