Message Broker Performance management and monitoring



Similar documents
How to analyse your system to optimise performance and throughput in IIBv9

PERFORMANCE TIPS FOR BATCH JOBS

Load Testing and Monitoring Web Applications in a Windows Environment

Transport Layer Protocols

PART IV Performance oriented design, Performance testing, Performance tuning & Performance solutions. Outline. Performance oriented design

Agenda. Development, Test and Deployment Best Practices for WebSphere Message Broker. IBM Software Group. Some ways to make best use of the tools

The EMSX Platform. A Modular, Scalable, Efficient, Adaptable Platform to Manage Multi-technology Networks. A White Paper.

DeBruin Consulting. Key Concepts of IBM Integration Broker and Microsoft BizTalk

A standards-based approach to application integration

GETTING STARTED WITH ANDROID DEVELOPMENT FOR EMBEDDED SYSTEMS

EVALUATION. WA1844 WebSphere Process Server 7.0 Programming Using WebSphere Integration COPY. Developer

Enhanced Connector Applications SupportPac VP01 for IBM WebSphere Business Events 3.0.0

Rational Application Developer Performance Tips Introduction

CentOS Linux 5.2 and Apache 2.2 vs. Microsoft Windows Web Server 2008 and IIS 7.0 when Serving Static and PHP Content


Wait-Time Analysis Method: New Best Practice for Performance Management

IBM DataPower SOA Appliances & MQ Interoperability

Scaling out a SharePoint Farm and Configuring Network Load Balancing on the Web Servers. Steve Smith Combined Knowledge MVP SharePoint Server

Highly Available Mobile Services Infrastructure Using Oracle Berkeley DB

Performance Optimization Guide

Windows Server Performance Monitoring

Storing Measurement Data

High Availability Essentials

StreamServe Persuasion SP4 StreamServe Connect for SAP - Business Processes

The objective of WebSphere MQ clustering is to make this system as easy to administer and scale as the Single Queue Manager solution.

StreamServe Persuasion SP5 Microsoft SQL Server

Chapter 1 - Web Server Management and Cluster Topology

Java DB Performance. Olav Sandstå Sun Microsystems, Trondheim, Norway Submission ID: 860

Integrating with BarTender Integration Builder

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters

PC & EMBEDDED CONTROL TRENDS

MS SQL Performance (Tuning) Best Practices:

Tivoli IBM Tivoli Web Response Monitor and IBM Tivoli Web Segment Analyzer

Tune That SQL for Supercharged DB2 Performance! Craig S. Mullins, Corporate Technologist, NEON Enterprise Software, Inc.

Introduction to Metropolitan Area Networks and Wide Area Networks

Agenda. Enterprise Application Performance Factors. Current form of Enterprise Applications. Factors to Application Performance.

ODEX Enterprise. Introduction to ODEX Enterprise 3 for users of ODEX Enterprise 2

Recommended hardware system configurations for ANSYS users

ibolt V3.2 Release Notes

Quiz for Chapter 6 Storage and Other I/O Topics 3.10

EII - ETL - EAI What, Why, and How!

Enhancing SQL Server Performance

Contents. 2. cttctx Performance Test Utility Server Side Plug-In Index All Rights Reserved.

Performance Optimization Guide Version 2.0

SQL Server. SQL Server 100 Most Asked Questions: Best Practices guide to managing, mining, building and developing SQL Server databases

COMP5426 Parallel and Distributed Computing. Distributed Systems: Client/Server and Clusters

SOA Software: Troubleshooting Guide for Agents

Efficient database auditing

A Comparative Study on Vega-HTTP & Popular Open-source Web-servers

SPAMfighter Mail Gateway

SCA-based Enterprise Service Bus WebSphere ESB

(Refer Slide Time: 00:01:16 min)

Zend Platform TM. White Paper: Zend Download Server. By Zend Technologies, Inc. May Zend Technologies, Inc. All rights reserved.

Windows Server 2008 R2 Hyper-V Live Migration

Configuring Apache Derby for Performance and Durability Olav Sandstå

BIRT Document Transform

Domestic & General deliver a new IBM WebSphere Application Server Environment at speed using RapidDeploy for Application Deployment

ERserver. iseries. Work management

File Management. Chapter 12

Cache Configuration Reference

Inside the PostgreSQL Query Optimizer

iseries TCP/IP routing and workload balancing

TIBCO ActiveSpaces Use Cases How in-memory computing supercharges your infrastructure

How To Install An Aneka Cloud On A Windows 7 Computer (For Free)

EXTENDED FILE SYSTEM FOR F-SERIES PLC

Using Fuzzy Logic Control to Provide Intelligent Traffic Management Service for High-Speed Networks ABSTRACT:

IIB for Everyone: Affordable Integration

Quick Start for Network Agent. 5-Step Quick Start. What is Network Agent?

How to test and debug an ASP.NET application

IBM WebSphere Message Broker Message Monitoring, Auditing, Record and Replay. Tim Kimber WebSphere Message Broker Development IBM Hursley Park, UK

HP Storage Essentials Storage Resource Management Software end-to-end SAN Performance monitoring and analysis

SiteCelerate white paper

Windows Server 2008 R2 Hyper-V Live Migration

First Steps with IBM Integration Bus: Application Integration in the new world

Question: 3 When using Application Intelligence, Server Time may be defined as.

FileNet System Manager Dashboard Help

VEEAM ONE 8 RELEASE NOTES

WebSphere Architect (Performance and Monitoring) 2011 IBM Corporation

Firewall Builder Architecture Overview

Cisco NetFlow Reporting Instruction Manual Version 1.0

Using over FleetBroadband

SAN Conceptual and Design Basics

REMOTE DEVELOPMENT OPTION

AQA GCSE in Computer Science Computer Science Microsoft IT Academy Mapping

NFS File Sharing. Peter Lo. CP582 Peter Lo

Big Data, Fast Processing Speeds Kevin McGowan SAS Solutions on Demand, Cary NC

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture

C Number: C2180 Passing Score: 800 Time Limit: 120 min File Version: 4.0 C

It is the thinnest layer in the OSI model. At the time the model was formulated, it was not clear that a session layer was needed.

Capacity Planning Process Estimating the load Initial configuration

Managed File Transfer

PARALLELS CLOUD STORAGE

S y s t e m A r c h i t e c t u r e

Midterm Exam CMPSCI 453: Computer Networks Fall 2011 Prof. Jim Kurose

1 Download & Installation Usernames and... Passwords

Understanding Slow Start

Toad for Oracle 8.6 SQL Tuning

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

Data Integrator Performance Optimization Guide

with the ArchiveSync Add-On Evaluator s Guide 2015 Software Pursuits, Inc.

Transcription:

Message Broker Performance management and monitoring Tim Kimber Development kimbert@uk.ibm.com 1 2012 IBM Corporation

2 2012 IBM Corporation

Agenda Message Flow Performance Fundamentals Tree operations Message Flow Tuning Find and remove bottlenecks Message Flow Performance Monitoring Keep it turning over Download supportpac IP04 for a lot more detail. Notes slides are included! 3 2012 IBM Corporation

Why should you care about performance? Optimising your broker s performance can lead to real $ $ savings Time is Money! Lower hardware requirements, lower MIPS Maximised throughput improved response time Ensure your SLAs are met is a sophisticated product There are often several ways to do things which is the best? Understanding how the broker works allows you to write more efficient message flows and debug problems more quickly It s better to design your message flows to be as efficient as possible from day one Solving bad design later on costs much more Working around bad design can make the problem worse! 4 2012 IBM Corporation

What are the main CPU costs in message flows? Tree Creation A B C X Y Z Tree Serialisation b A B C X Y Z Tree Copying Tree Navigation Set OutputRoot = InputRoot; Root.Body.Level1.Level2. Level3.Description.Line[1]; 5 2012 IBM Corporation

This foils shows a simple message flow. When this or any other message flow processes messages costs arise. These costs are: Parsing. This has two parts. The processing of incoming messages and the creation of output messages. Before an incoming message can be processed by the nodes or ESQL it must transformed from the sequence of bytes, which is the input message, into a structured object, which is the message tree. Some parsing will take place immediately such as the parsing of the MQMD, some will take place, on demand, as fields in the message payload are referred to within the message flow. The amount of data which needs to be parsed is dependent on the organization of the message and the requirements of the message flow. Not all message flows may require access to all data in a message. When an output message is created the message tree needs to be converted into an actual message. This is a function of the parser. The process of creating the output message is referred to as serialization or flattening of the message tree. The creation of the output message is a simpler process than reading an incoming message. The whole message will be written at once when an output message is created. We will discuss the costs of parsing in more detail later in the presentation. Message/Business Processing. It is possible to code message manipulation or business processing in any one of a number of transformation technologies. These are ESQL, Java, PHP, Mapping node, XSL and WebSphere TX mappings. It is through these technologies that the input message is processed and the tree for the output message is produced. The cost of running this is dependent on the amount and complexity of the transformation processing that is coded. 6 2012 IBM Corporation

Navigation. This is the process of "walking" the message tree to access the elements which are referred to in the ESQL or Java. The cost of navigation is dependent on the complexity and size of the message tree which is in turn dependent on the size and complexity of the input messages and the complexity of the processing within the message flow. Tree Copying. This occurs in nodes which are able to change the message tree such as Compute nodes. A copy of the message tree is taken for recovery reasons so that if a compute node makes changes and processing in node incurs or generates an exception the message tree can be recovered to a point earlier in the message flow. Without this a failure in the message flow downstream could have implications for a different path in the message flow. The tree copy is a copy of a structured object and so is relatively expensive. It is not a copy of a sequence of bytes. For this reason it is best to minimize the number of such copies, hence the general recommendation to minimize the number of compute nodes in a message flow. Tree copying does not take place in a Filter node for example since ESQL only references the data in the message tree and does not update it. Resources. This is the cost of invoking resource requests such as reading or writing WebSphere MQ messages or making database requests. The extent of these costs is dependent on the number and type of the requests. The parsing, navigation and tree copying costs are all associated with the population, manipulation and flattening of the message tree and will be discussed together a little later on. Knowing how processing costs are encountered puts you in a better position to make design decisions which minimize those costs. This is what we will cover during the course of the presentation. 7 2012 IBM Corporation

Parsers Model F r e d Input Message Bit-stream S m i t h, G r a p h i c s C a r d Parser converts logical structure to bit-stream Model Parser converts bit-stream to logical structure < o r d e r > < n a m e > M r. S m i t h < / n Output Message Bit-stream 8 2012 IBM Corporation

Parsing creating the message tree from data The means of populating and serializing the tree Can occur whenever the message body is accessed Multiple Parsers available: XMLNSC, XMLNS, DFDL, MIME, JMSMap, JMSStream, BLOB, IDOC, RYO Message complexity varies significantly and so do costs! Several ways of minimizing parsing costs Use cheapest parser possible, e.g. XMLNSC for XML parsing Identify the message type quickly Use Parsing strategies Parsing avoidance Partial parsing Opaque parsing 9 2012 IBM Corporation

In order to be able to process a message or piece of data within Message Broker we need to be able to model that data and build a representation of it in memory. Once we have that representation we can transform the message to the required shape, format and protocol using transformation processing such as ESQL or Java. That representation of a sequence of bytes into a structured object is the message tree. It is populated though a process called parsing. There are two parts to parsing within Message Broker: The first is the most obvious. It is the reading and interpretation of the input message and recognition of tokens within the input stream. Parsing can be applied to message headers and message body. The extent to which it is applied will depend on the situation. As parsing is an expensive process in CPU terms it is not something that we want to automatically apply to every part of every message that is read by a message flow. In some situations it is not necessary to parse all of an incoming message in order to complete the processing within the message flow. A routing message flow may only need to read a header property such as user identifier or ApplIdentifyData in the MQMD for example. If the input message is very large parsing the whole message could result in a large amount of additional CPU being unnecessarily consumed if that data is not required in the logic of the message flow. The second, is the flattening, or serialisation of a message tree to produce a set of bytes which correspond to the wire protocol of a message in the required output format and protocol. 10 2012 IBM Corporation

Message Broker provides a range of parsers. The parsers are named on the foil. The parsers cover different message formats although there is some overlap. The choice of parser is an important design decision. Messages vary significantly in their format and their level of complexity. More complex data structures make parsing costs higher. The parsing costs of different data formats is different. You are recommended to refer to the performance reports in order to get information on the parsing costs for different data formats. Whatever the message format there are a number of techniques that can be employed to reduce the cost of parsing. We will now look at the most common ones. First though we will discuss the reasons for the different cost of parsing. 11 2012 IBM Corporation

Parser avoidance If possible, avoid the need to parse at all! WebSphere User Group UK - 2013 Consider only sending changed data Promote/copy key data structures to MQMD, MQRFH2 or JMS Properties May save having to parse the user data Particularly useful for message routing MQMD RFH2 A B C User data (bytes to Mb) X Y Z 12 2012 IBM Corporation

One very effective technique to reduce the cost of parsing is not to do it. A couple of ways of doing this are discussed in this foil. The first approach is to avoid having to parse some parts of the message. Suppose we have a message routing message flow which needs to look at a field in order to make a routing decision. If that field is in the body of the message the body of the incoming message will have to be parsed to get access to it. The processing cost will vary dependent on which field is needed. If it is field A that is OK as it is at the beginning of the body and would be found quickly. If it is field Z then the cost could be quite different, especially if the message is several megabytes in size. A technique to reduce this cost would be to have the application which creates this message copy the field that is needed for routing into a header within the message, say in an MQRFH2 header for an MQ message or as a JMS property if it is a JMS message. If you were to do this it would no longer be necessary to parse the message body so potentially saving a large amount of processing effort. The MQRFH2 heard or JMS Properties folder would still need to be parsed but this is going to be smaller amount of data. The parsers in this case are also more efficient then the general parser for a message body as the structure of the header is known. A second approach to not parsing data is to not send it in the first place. Where two applications communicate consider sending only the changed data rather than sending the full message. This requires additional complexity in the receiving application but could potentially save significant parsing processing dependent on the situation. This technique also has the benefit of reducing the amount of data to be transmitted across the network. 13 2012 IBM Corporation

Partial parsing All domains Typically, the Broker parses elements up to and including the required field Elements that are already parsed are not reparsed If possible, put important elements nearer the front of the user data Set MyVariable = <Message Element Z> vs. MQMD Message parsed A B C X Y Z RFH2 User data (bytes to Mb) Message parsed MQMD RFH2 Z B C User data (bytes to Mb) X Y A Typical Ratio of CPU Costs 1K msg 16K msg 256K msg Filter First 1 1 1 Filter Last 1.4 3.4 5.6 14 2012 IBM Corporation

If parsing of the body cannot be avoided then the next technique is to only parse what is needed rather than parse the whole message just in case. The parsers provided with Message Broker all support on-demand parsing. The amount of parsing which needs to be performed will depend on which fields in a message need to accessed and the position of those fields in the message. We have two example here. One with the fields ordered Z to A and the other with them ordered A to Z. Dependent on which field is needed one of the cases will be more efficient than the other. Say we need to access field Z then the first case is best. Where you have influence over message design ensure that information needed for routing for example is placed at the start of the message and not at the end of the message. As an illustration of the difference in processing costs consider the table in the foil. The table shows a comparison of processing costs for two versions of a routing message flow when processing several different message sizes. For the filter first test the message flow routes the message based on the first field in the message. For the filter last the routing decision is made based on the last field of the message. The CPU costs of running with each message size have been normalised so that the filter first test for each message represents a cost of 1. The cost of the filter last case is then given as a ratio to the filter first cost for that same message size. For the 1K message we can see that by using the last field in the message to route the CPU cost of the whole message flow was 1.4 times the cost of using the first field in the same message. This represents the additional parsing which needs to be performed to access the last field. For the 16K message, the cost of using the last field in the message had grown to 3.4 times that of the first field in the same message. That is we can only run at one third of the message that we can when looking at the first field of the message. These measurements were taken on a pseries 570 Power 5 with 8 * 1.5 GHZ processors, using V6. 15 2012 IBM Corporation

For the 256K message, the cost of using the last field in the message was 5.6 times that of the first field in the same message. That is we can only run at one fifth of the message rate that we can achieve when looking at the first field of the message. You can see how processing costs quickly start to grow and this was a simple test case. With larger messages the effect would be even more pronounced. Where the whole message is used in processing this is not an issue as all of the data will need to be parsed at some point. For simple routing cases though the ordering of fields can make a significant difference. When using ESQL, and Mapping nodes the field references are typically explicit. That is we have references such as InputRoot.Body.A. Message Broker will only parse as far as the required message field to satisfy that reference. It will stop at the first instance. When using XPath, which is a query language the situation is different. By default an XPath expression will search for all instances of an element in the message which implicitly means a full parse of the message. If you know there is only one element in a message there is the chance to optimise the XPath query to say only retrieve the first instance. See the ESQL and Java coding tips later in the presentation for more information. 16 2012 IBM Corporation

Opaque parsing - XMLNSC WebSphere User Group UK - 2013 Treat elements of an XML document as an unparsed BLOB Reduces message tree size and parsing costs Cannot reference the sub tree in message flow processing Configured on input nodes ( Parser Options tab) <order> <name> <first>john</first> <last>smith</last> </name> <item>graphics Card</item> <quantity>32</quantity> <price>200</price> <date>06/24/2010</date> </order> DON T PARSE THIS OR THIS 17 2012 IBM Corporation

Opaque parsing is a technique that allows the whole of an XML sub tree to placed in the message tree as a single element. The entry in the message tree is the bit stream of the original input message. This technique has two benefits: It reduces the size of the message tree since the XML sub tree is not expanded into the individual elements. The cost of parsing is reduced since less of the input message is expanded as individual elements and added to the message tree. Use opaque parsing where you do not need to access the elements of the sub tree, for example you need to copy a portion of the input tree to the output message but may not care about the contents in this particular message flow. You accept the content in the sub folder and have no need to validate or process it in any way. Opaque parsing is supported for the XMLNSC domain only. Some opaque parsing support for the XMLNS domain was introduced in Message Broker V6 fixpack 1. This should not be used in new message flows. Opaque parsing for the XMLNSC domain was added in Message Broker V6.1. This exploits special features in the IBM XML parser to optimise opaque parsing performance The following pages of notes explain how opaque parsing is performed for messages in the XMLNS and XMLNSC domains. 18 2012 IBM Corporation

The message domain must be set to XMLNSC. The elements in the message which are to be opaquely parsed are specified on the 'Parser Options' page of the input node of the message flow. See the picture below of the MQInput node. Enter those element names that you wish to opaquely parse in the 'Opaque Elements' table. Be sure not to enable message validation as it will automatically disable opaque parsing. Opaque parsing in this case does not make sense since for validation the whole message must be parsed and validated. Opaque parsing for the named elements will occur automatically when the message is parsed. It is not currently possible to use the CREATE statement to opaquely parse a message in the XMLNSC domain. 19 2012 IBM Corporation

Identifying the message type quickly Avoid multiple parses to find the message type VS 27 X 5 msgs/sec 138 msgs/sec 20 2012 IBM Corporation

It is important to be able to correctly recognise the correct message format and type as quickly as possible. In message flows which process multiple types of message this can be a problem. When often happens is that the message needs to be parsed multiple times in order to ensure that you have the correct format. Dependent on the particular format and the amount of parsing needed this can be expensive. This example shows how a message flow which processed multiple types of input message was restructured to provide a substantial increase in message throughput. Originally the flow was implemented as a flow with a long critical path. Some of the most popular messages were not processed until late in the message flow resulting in a high overhead. The flow was complex. This was largely due to the variable nature of the incoming messages, which did not have a clearly defined format. Messages had to be parsed multiple times. The message flow was restructured. This substantially reduced the cost of processing. The two key features of this implementation were to use a very simple message model initially to parse the messages and the use of the RouteToLabel and Label nodes within the message flow in order to establish processing paths which were specialized for particular types of message. Because of the high processing cost of the initial flow it was only possible to process 5 non persistent message per second using one copy of the message flow. With the one copy of the restructured flow it was possible to process 138 persistent messages per second on the same system. This is a 27 times increase in message throughput plus persistent messages where now being processed whereas previously they were non persistent. By running five copies of the message flow it was possible to: Process around 800 non persistent messages per second when running with non persistent messages. Process around 550 persistent messages per second when running with persistent messages. 21 2012 IBM Corporation

Navigation ESQL WebSphere User Group UK - 2013 The logical tree is walked every time it is evaluated This is not the same as parsing! although accessing a field might trigger on-demand parsing. SET Description = Root.Body.Level1.Level2.Level3.Description.Line[1]; Long paths are inefficient Minimise their usage, particularly in loops Use reference variables/pointers (ESQL/Java) 22 2012 IBM Corporation

Navigation is the process of accessing elements in the message tree. It happens when you refer to elements in the message tree in the Compute, JavaCompute,.NET, PHP and Mapping nodes. The cost of accessing elements is not always apparent and is difficult to separate from other processing costs. The path to elements is not cached from one statement to another. If you have the ESQL statement SET Description = Root.Body.Level1.Level2.Level3.Description.Line[1]; the broker runtime will access the message tree starting at the correlation Root and then move down the tree to Level1, then Level2, then Level3, then Description and finally it will find the first instance of the Line array. If you have this same statement in the next line of your ESQL module exactly the same navigation will take place. There is no cache to the last referenced element in the message tree. This is because access to the tree is intended to be dynamic to take account of the fact that it might change structure from one statement to another. There are techniques available though to reduce the cost of navigation. With large message trees the cost of navigation can become significant. There are techniques to reduce which you are recommended to follow: Use reference variables if using ESQL or reference pointers if using Java. This technique allows you to save a pointer to a specific place in the message tree. Say to Root.Body.Level1.Level2.Level3.Description for example. Use the compact parsers (XMLNSC and RFH2C). The compact parsers discard comments and white space in the input message. Dependent on the contents of your messages this may or may not have an effect. For an example of how to use reference variables and reference pointers see the coding tips given in the Common Problems section. 23 2012 IBM Corporation

Message tree copying WebSphere User Group UK - 2013 SET OutputRoot.XMLNSC.A = InputRoot.XMLNSC.A; Message tree copying causes the logical tree to be duplicated in memory and this is computationally expensive Reduce the number of times the tree is copied Reduce the number of Compute and JavaCompute nodes in a message flow See if Compute mode can be set to not include message Copy at an appropriate level in the tree (copy once rather than for multiple branch nodes) Copy data to the Environment (although changes are not backed out) Minimize the effect of tree copies Produce a smaller message tree (again)! 24 2012 IBM Corporation

Tree Copying is the process of copying the message tree either in whole or part. Copying occurs in nodes which are able to change the message tree such as Compute nodes. A copy of the message tree is taken for recovery reasons so that if a compute node makes changes and processing in node incurs or generates an exception the message tree can be recovered to a point earlier in the message flow. Without this a failure in the message flow downstream could have implications for a different path in the message flow. The tree copy is a copy of a structured object and so is relatively expensive. It is not a copy of a sequence of bytes. For this reason it is best to minimize the number of such copies, hence the general recommendation to minimize the number of compute nodes in a message flow. Tree copying does not take place in a Filter node for example since ESQL only references the data in the message tree and does not update it. There are a few ways to reduce the costs of tree copying. These are: Produce a smaller message tree in the first place. A smaller tree will cost less to copy. Ways to achieve this are to use Smaller messages, use Compact Parsers (XMLNSC, RFH2C), use Opaque parsing partial parsing (all discussed previously). Reduce the number of times the whole tree is copied. Reducing the number of compute nodes (ESQL or Java) will help to reduce the number of times that the whole tree needs to be copied. In particular avoid situations where you have one compute node followed immediately by another. In many cases you may need multiple computes across a message flow. What we want to do is to optimise the processing not have to force everything into one compute node. Copy portions of the tree at the branch level if possible rather than copying individual leaf nodes. This will only work where the structure of the source and destination are the same but it is worth doing if possible. Copy data to the Environment tree (remember it is not backed out) and work with it in Environment. This way the message tree does not have to be copied every time you run a compute node. Environment is a scratchpad area which exists for each invocation of a message flow. The contents of Environment are accessible across the whole of the message flow. Environment is cleared down at the end of each message flow invocation. The first compute node in a message flow can copy InputRoot to Environment. Intermediate nodes then read and update values in the Environment instead of using the InputRoot and OutputRoot correlations as previously. In the final compute node of the message flow OutputRoot must be populated with data from Environment. The MQOutput node will then serialize the message as usual. Serialization will not take place from Environment. Whilst use of the Environment correlation is good from a performance point of view be aware that the any updates made by a node which subsequently generates an exception will remain in place. There is no back-out of changes as there is when a message tree copy was made prior to the node exception 25 2012 IBM Corporation

Example of avoiding a tree copy WebSphere User Group UK - 2013 26 2012 IBM Corporation

This foil shows one case where it was possible to avoid a tree copy. You may be able to use this same technique in other situations. The purpose of the message flow is read MQ messages, determine the message type and route to the appropriate type of processing. There are three legs of processing, each starting with a Label node (V0100, V0101 & V0102). The compute node Check_Version issues a PROPAGATE to the appropriate label node dependent on a field in the incoming message. The message version information is obtained from the incoming message by a function called getmessageversion. The ESQL on the foil shows how this is done. As processing at this point is limited to routing only there is no need for Check_Version to modify the incoming message tree and as such a value of LocalEnvironment is sufficient for the Compute Mode of the node. Had a value of LocalEnvironment and Message been selected then we would have needed to copy the message tree which would have increased processing costs, unnecessarily in this case. 27 2012 IBM Corporation

Agenda Message Flow Performance Fundamentals Tree operations Message Flow Tuning Find and remove bottlenecks Message Flow Performance Monitoring Keep it turning over 28 2012 IBM Corporation

Other performance costs in message flows Resource Access Web services Databases Queues Files Processing Logic ESQL Java Mapping XSLT 29 2012 IBM Corporation

Consider the end-to-end flow of data Interaction between multiple applications can be expensive! Store and Forward Serialise De-serialise Some questions to ponder: Where is data being generated? Where is data being consumed? What applications are interacting in the system? What are the interactions between each of these applications? And as data passes through the broker: Where are messages arriving? Where are they leaving? Are multiple message flows being invoked? Request/Reply? Flow-to-flow? 30 2012 IBM Corporation

Consider the sequencing of message flows 3X (Read Msg - Parse Process - Serialise Write Msg) VS Read Msg - Parse 3X(Process) - Serialise Write Msg 31 2012 IBM Corporation

It is important to think about the structure of your message flows and to think about how they will process incoming data. Will one message flow process multiple message types or will it process a single type only. Where a unique message flow is produced for each different type of message it is referred to as a specific flow. An alternative approach is to create message flows which are capable of processing multiple message types. There may be several such flows, each processing a different group of messages. We call this a generic flow. There are advantages and disadvantages for both specific and generic flows. With specific flows there are likely to be many different message flows. In fact as many message flows as there are types of input message. This does increase the management overhead which is a disadvantage. A benefit of this approach though is that processing can be optimized for the message type. The message flow does not have to spend time trying to determine the type of message before then processing it. With the generic flow there is a processing cost over and above the specific processing required for that type of message. This is the processing required to determine which of the possible message types a particular message is. Generic flows can typically end up parsing an input message multiple times. Initially to determine the type and then subsequently to perform the specific processing for that type of message. A benefit of the generic flow is that there are likely to be fewer of them as each is able to process multiple message types. This makes management easier. Generic flows tend to be more complex in nature. It is relatively easy to add processing for another type of message though. With generic message flows it is important to ensure that the most common message types are processed first. If the distribution of message types being processed changes over time this could mean processing progressively becomes less efficient. You need to take account of this possibility in you message flow design. Use of the RouteToLabel node can help with this problem. There are advantages to both the specific and generic approaches. From a message throughput point of view it is better to implement specific flows. From a management and operation point of view it is better to use generic flows. Which approach you choose will depend on what is important in your own situation. To bring clarity to your message flow processing consider using the RouteToLabel node. It can help add structure and be effective in separating different processing paths with a message flow. Without flows can become long and unwieldly resulting in high processing costs for those messages with have a long processing path. See the two examples on the foil. Both perform the same processing but have different structures. One is clearly more readable than the other. There are several ways of achieving code reuse with Message Broker. They are subflows, ESQL procedures and functions, invoking external Java classes and calling a database stored procedure. There are some performance implications of using the different techniques which we will briefly look at. 32 2012 IBM Corporation

Subflows are a facility to encourage the reuse of code. Subflows can be embedded into message flows. The subflows are 'in-lined' into the message flow at deploy time. There are no additional nodes inserted into the message flow as a result of using subflows. However be aware of implicitly adding extra nodes into a message flow as a result of using subflows. in some situations compute nodes are added to subflows to perform marshalling of data from one part of the message tree into a known place in the message tree so that the data can be processed by the message flow. The result may then be copied to another part of the message tree before the subflow completes. This approach can easily lead to the addition of two compute nodes, each of which performs a tree copy. In such cases the subflow facilitates the reuse of logic but unwittingly adds an additional processing head. Consider the use of ESQL procedures instead for code reuse. They provide a good reuse facility and the potential additional overhead of extra Compute nodes is avoided. Existing Java classes can be invoked from within a message flow using either ESQL or Java. From ESQL it is possible to declare an external function or procedure which specifies the name of the Java routine to be invoked.. Parameters (in,out, in-out) can be passed to the Java routine. From within a Java compute node the class can be invoked as any other Java class. You will need to ensure that the Java class file is accessible to the broker runtime for this to work. A database stored procedure can be called from within ESQL by using an external procedure. It is also possible to invoke a stored procedure using a PASSTHRU statement but this is not recommended from a performance point of view. The cost of calling these external routines will vary and be dependent on what is being called (Java VS Stored procedure) and the number and type of parameters. The performance reports give the CPU cost of calling different procedure types and you can compare the cost of using these methods to other processing which you might do. There are no hard and fast rules about whether to call an external procedure or not. It will very much depend on what code you want to access. It is important to bear in mind the cost of making the call against the function that is being executed. Is it really worth it if the external procedure is only a few lines of code. It might easier to re-write the code and make it available locally within the message flow. Database stored procedures can be a useful technique for reducing the size of the result set that is returned to a message flow from a database query. Especially where the result set from an SQL statement might contain hundreds or thousands of rows otherwise. The stored procedure can perform an additional refinement of the results. The stored procedure is close to the data and using it to refine results is a more efficient way of reducing the volume of data. Otherwise data has to be returned to the message flow only to be potentially discarded immediately. 33 2012 IBM Corporation

Consider your transformation options Various options available.net Java ESQL PHP Mapping XSL WebSphere TX (as a separate product) Performance characteristics of the different options is rarely an issue Choose an option based on skills, ease-ofuse and suitability for the scenario See Choosing the Right Transformation Option presentation It is usually more efficient ( and maintainable ) to use the facilities provided by the product wherever possible. Tuning tips in notes! Think carefully before mixing transformation options in the same message flow 34 2012 IBM Corporation

There are a number of different transformation technologies available with Message Broker V8. Theses are: ESQL, an SQL like syntax, which runs in nodes such as the Compute, Filter and Database. Java which runs in a JavaCompute node. The Mapping node. The mapping capability was rewritten in V8. The performance of the Mapping node is now comparable with Java and ESQL, and significantly better than in v6/v7..net which runs in the Microsoft CLR ( Windows only ) Extensible Stylesheets (XSL) running in an XML Transformation node. This provides a good opportunity to reuse an existing asset. PHP which runs in the PHPCompute node. The WTX node which runs a WTX map to parse the message. As there is a choice of transformation technology this offers significant flexibility. All of these technologies can be used within the same message flow if needed. Different technologies will suit different projects and different requirements. Factors which you may want to take into account when making a decision about the use of transformation technology are: The pool of development skills which is available. If developers are already skilled in the use of ESQL you wish continue using this as the transformation technology of choice. If you have a strong Java skills then the JavaCompute node may be more relevant, rather than having to teach your Java programmers ESQL. The ease with which you could teach developers a new development language. If you have many developers it may be not be viable to teach all of the ESQL for example and you may only educate a few and have them develop common functions or procedures. The skill of the person. Is the person an established developer, or is the mapping node more suitable. Asset re use. If you are an existing user of Message Broker you may have large amounts of ESQL already coded which you wish to re-use. You may also have any number of resources that you wish to re-use such as Java classes for key business processing, stylesheets, PHP scripts or WTX mappings. You want to use these as the core of message flow processing and extend the processing with one of the other technologies. Performance is rarely an issue. Think carefully before combining a lot of different transformation technologies within a path of execution of a message flow. ESQL, Java, PHP and Mapping node will happily intermix but there is an overhead in moving to/from other technologies such as XSL as they do not access the message directly. The message has to be serialised when it is passed to those other technologies and then the results parsed to build a new message tree. 35 2012 IBM Corporation

Consider the use of patterns (V7) Patterns provide top-down, parameterized connectivity of common use cases e.g. Web Service façades, Message oriented processing, Queue to File They help describe best practice for efficient message flows There also quick to write and less prone to errors Write your own patterns too! Help new message flow developers come on board more quickly 36 2012 IBM Corporation

Consider the different characteristics of different protocols MQ Tune the QM and associated QM s, logs, buffer sizes Consider running as a trusted application (but be aware of the risks) Avoid unnecessary use of persistent messages, although always use persistent messages as part of a co-ordinated transaction Use fast storage if using persistent messages http://www.ibm.com/developerworks/websphere/library/techarticles/0712_dunn/0712_dunn.html JMS Follow MQ tuning if using MQ JMS Follow provider instructions http://www.ibm.com/developerworks/websphere/library/techarticles/0604_bicheno/0604_bicheno.html SOAP/HTTP Use persistent HTTP connections Use embedded execution group-level listener for HTTP nodes (V7.0.0.1) Consider using an external servlet engine ( v8 ) http://www.ibm.com/developerworks/websphere/library/techarticles/0608_braithwaite/ 0608_braithwaite.html File Use cheapest delimiting option (see reports) Use fast storage 37 2012 IBM Corporation

There are a wide variety of ways of reading data into Message Broker and sending it out once it is has been processed. The most common methods are MQ messages, JMS messages, HTTP and files. Collectively for this discussion lets refer to them as methods of transport although we recognise that is pushing it where file, VSAM and database are concerned. Different transports have different reliability characteristics. An MQ persistent message has assured delivery. It will be delivered once and once only. MQ non persistent messages are also pretty reliable but are not assured. If there is a failure of machine or power outage for example data will be lost with these non persistent messages. Similarly data received over a raw TCP/IP session will be unreliable. With WebSphere MQ Real-time messages can be lost if there is a buffer overrun on the client or server for example. In some situations we are happy to accept the limitations of the transport in return for its wide availability or low cost for example. In others we may need to make good the shortcoming of the transport. One example of this is the use of a WebSphere MQ persistent message (or database insert) to reliably capture coming over a TCP/IP connection as the TCP/IP session is unreliable hey this is why MQ is popular because of the value it builds on an unreliable protocol. As soon as data is captured in this way the speed of processing is changed. We now start to work at the speed of MQ persistent messages or the rate at which data can be inserted into a database. This can result in a significant drop in processing dependent on how well the queue manager or database are tuned. In some cases it is possible to reduce the impact of reliably capturing data if you are prepared to accept some additional risk. If it is acceptable to have a small window of potential loss you can save the data to an MQ persistent message or database asynchronously. This will reduce the impact of such processing on the critical path. This is a decision only you can make. It may well vary by case by case dependent on the value of the data being processed. Use of SolidDB may be a way to get the best of both worlds! It is important to think how data will be received into Message Broker. Will data be received one message at a time or will it arrive in a batch. What will be involved in session connection set-up and tear-down costs for each message or record that is received by the message flow. Thinking of it in MQ terms will there be an MQCONN, MQOPEN, MQPUT, MQCMT and MQDISC by the application for each message sent to the message flow. Lets hope not as this will generate lot of additional processing for the broker queue manager [assuming the application is local to the broker queue manager]. In the HTTP world you want to ensure that persistent sessions (not to be confused with MQ persistence) are used for example so that session set-up and tear-down costs are minimised. Make sure that you understand the sessions management behaviour of the transport that is being used and that you know how to tune the transport for maximum efficiency. Message Broker give you the ability to easily switch transport protocols, so data could come in over MQ and leave the message flow in a file or be sent as a JMS message to any JMS 1.1 provider. In your processing you should aim to keep a separation between the transport used and the data being sent over that transport. This will make it easier to use different transports in the future. 38 2012 IBM Corporation

Consider your operational environment Network topology Distance between broker and data What hardware do I need? Including high availability and disaster recovery requirements IBM can help you! Transactional behaviour Early availability of messages vs. backout Transactions necessitate log I/O can change focus from CPU to I/O Fast storage can reduce I/O costs significantly Message batching (commit count) What are your performance requirements? Now and in five years 39 2012 IBM Corporation

Consider how your message flows will scale How many execution groups? As processes, execution groups provide isolation Higher memory requirement than threads Rules of thumb: One or two execution groups per application Allocate all instances needed for a message flow over those execution groups Assign heavy resource users (memory) to specialist execution groups How many message flow instances? Message flow instances provide thread level separation Lower memory requirement than execution groups Potential to use shared variables Rules of thumb: There is no pre-set magic number What message rate do you require? Try scaling up the instances to see the effect; to scale effectively, message flows should be efficient, CPU bound, have minimal I/O and have no affinities or serialisation. 40 2012 IBM Corporation

So far we have focused on the message and contents of the message flow. It is important to have an efficient message flow but this is not the whole story. It is also important to have an efficient environment for the message flow to run in. We collectively refer to this as the broker environment. It includes: Configuration of the broker Configuration of the broker queue manager The topology of the environment in which the messages are processed Business database configuration Hardware Software It is important that each of these components is well configured and tuned. When this occurs we can get the best possible message throughput for the resources which have been allocated. We will now briefly look at each of these aspects. The aim is to outline those aspects which you should be aware of and further investigate rather than to provide full guidance in this presentation. 41 2012 IBM Corporation

As with other MQ applications it is possible to run a broker as a trusted application on Windows, Solaris, HP-UX and AIX. The benefit of running in trusted mode is that the cost of an application communicating with the queue manager is reduced and MQ operations are processed more efficiently. It is thus possible to achieve a higher level of messaging with a trusted application. However when running in trusted mode it is possible for a poorly written application to crash and potentially corrupt the queue manager. The likelihood of this happening will depend on user code, such as a plugin node, running in the message flow and the extent to which it has been fully tested. Some users are happy to accept the risk in return for the performance benefits. Others are not. Using the MBExplorer it is possible to increase the number of instances of a message flow which are running. Similarly you can increase the number of execution groups and assign message flows to those execution groups. This gives the potential to increase message throughput as there are more copies of the message flow. There is no hard and fast rule as to how many copies of a message flow to run. For guidelines look at the details in the Additional Information section Tuning is available for non MQ transports. For example: When using HTTP you can tune the number of threads in the HTTP listener When using JMS nodes follow the tuning advice for the JMS provider that you are connecting to. As the broker is dependent on the broker queue manager to get and put MQ messages the performance of this component is an important component of overall performance. When using persistent messages it is important to ensure the queue manager log is efficient. Review log buffer settings and the speed of the device on which the queue manager log is located. It is possible to run the WebSphere queue manager channels and listener as trusted applications. This can help reduce CPU consumption and so allow greater throughput. In practice the broker queue manager is likely to be connected to other queue managers. It is important to examine the configuration of these other queue managers as well in order to ensure that they are well tuned. 42 2012 IBM Corporation

The input messages for a message flow do not magically appear on the input queue and disappear once they have been written to the output queue by the message flow. The messages must some how be transported to the broker input queue and moved away from the output queue to a consuming application. Let us look at the processing involved to process a message in a message flow passing between two applications with different queue manager configurations. Where the communicating applications are local to the broker, that this they use the same queue manager as the broker, processing is optimized. Messages do not have to move over a queue manager to queue manager channel. When messages are non persistent no commit processing is required. When messages are persistent 3 commits are required in order to pass one message between the two applications. This involves a single queue manager. When the communicating applications are remote from the broker queue manager, messages passed between the applications must now travel over two queue manager to queue manager channels (one on the outward, another on the return). When messages are non persistent no commit processing is required. When messages are persistent 7 commits are required in order to pass one message between the two applications. This involves two queue managers. If the number of queue managers between the applications and broker where to increase so would the number of commits required to process a message. Processing would also become dependent on a greater number of queue managers. Where possible keep the applications and broker as close as possible in order to reduce the overall overhead. Where multiple queue managers are involved in the processing of messages it is important to make sure that all are optimally configured and tuned. 43 2012 IBM Corporation

The extent to which business data is used will be entirely dependent on the business requirements of the message flow. With simple routing flows it is unlikely that there will be any database access. With complex transformations there might be involved database processing. This could involve a mixture of read, update, insert and delete activity. It is important to ensure that the database manager is well tuned. Knowing the type of activity which is being issued against a database can help when tuning the database manager as you can focus tuning on the particular type of activity which is used. Where there is update, insert or delete activity the performance of the database log will be a factor in overall performance. Where there is a large amount of read activity it is important to review buffer allocations and the use of table indices for example. It might be appropriate to review the design of the database tables which are accessed from within a message flow. It may be possible to combine tables and so reduce the number of reads which are made for example. All the normal database design rules should be considered. Where a message flow only reads data from a table, consider using a read only view of that table. This reduces the amount of locking within the database manager and reduces the processing cost of the read. Consider using a specialised, high-performance database such as IBM s SolidDB. It uses solid-state storage for optimal read/write performance. 44 2012 IBM Corporation

Allocating the correct resources to the broker is a very important implementation step. Starve a CPU bound message flow of CPU and you simply will not get the throughput. Similarly neglect I/O configuration and processing could be significantly delayed by logging activities for example. It is important to understand the needs of the message flows which you have created. Determine whether they are CPU bound or I/O bound. Knowing whether a message flow is CPU bound or I/O bound is key to knowing how to increase message throughput. It is no good adding processors to a system which is I/O bound. It is not going to increase message throughput. Using disks which are much faster such as a solid state disk or SAN with a fast-write nonvolatile cache will have a beneficial effect though. As we saw at the beginning Message Broker has the potential to use multiple processors by running multiple message flows as well as multiple copies of those message flows. By understanding the characteristics of the message flow it is possible to make the best of that potential. In many message flows parsing and manipulation of messages is common. This is CPU intensive activity. As such message throughput is sensitive to processor speed. Brokers will benefit from the use of faster processors. As a general rule it would be better to allocate fewer faster processors than many slower processors. We have talked about ensuring that the broker and its associated components are well tuned and it is important to emphasize this. The default settings are not optimized for any particular configuration. They are designed to allow the product to function not to perform to its peak. It is important to ensure that software levels are as current as possible. The latest levels of software such as Message Broker and WebSphere MQ offer the best levels of performance. 45 2012 IBM Corporation