SlideShare a Scribd company logo
3450: Writing and optimising Applications for
performance in a hybrid messaging world
Tim McCormick
IBM MQ Service Architect
timmccor@uk.ibm.com
Agenda
• Some performance numbers
• Structure of the Queue Manager
• Function Walkthroughs
• Client Channels
• Logging and Recovery
Agenda
• Some performance numbers
• Structure of the Queue Manager
• Function Walkthroughs
• Client Channels
• Logging and Recovery
Performance Bottlenecks
• Business Systems are complex
– Often no single bottleneck limiting performance
– Performance can mean different things to different people
– Throughput
• Scalability
• Low resource usage
• Not only limited by physical resources
– Application design, such as parallelism can have major effect
• Performance Reports (from SupportPac site) show range of scenarios
RAM CPU NetworkI/O
Bottlenecks
See how far it's come …
Distributed Performance: Persistent Messaging
• An AIX system: Max performance increased from 16K to 19K
Distributed Performance: Non-persistent Messaging
• A Windows system: Max performance increased from 90K to 121K
Distributed Performance in V8
• Improvements to distributed queue manager scaling
– Improve efficiency
– Better exploitation of wider SMP machines
– Looking at customer-provided application patterns not just benchmarks
• Always happy to have more customer examples
• Multiplexed client performance
– Increase the performance of multiplexed client channels (SHRCONV > 0)
– Especially for SHRCONV=1
• Other areas that helped:
– Cache alignment for internal structures
– Extended 64-bit exploitation for locking primitives
– RFH2 handling, particularly for waiting-getter
• Fewer copies of data are needed
– Better compiler optimisations including feedback-directed optimisation
– Faster data conversion (especially for 1208)
• Many messages are in 1208 codepage
• Optimised handling when the queue manager needs to convert them
Agenda
• What is distributed WebSphere MQ?
• Structure of the Queue Manager
• Function Walkthroughs
• Client Channels
• Logging and Recovery
Also:
runmqchi
runmqlsr
amqzdmaa
amqrmppa
amqpcsea
Queue Manager Process Tree
Execution
Controller
(amqzxma0)
Critical
Services
(amqzmuc0)
Restartable
Services
(amqzmur0)
External
Processes
(amqzmgr0)
Repository
Manager
(amqrrmfa)
Object
Authority
Manager
(amqzfuma)
LQM
Agent
(amqzlaa0)
V6V7.x,
V8
PubSub
V6 Compat
(amqfqpub)
PubSub
Streams
(amqfcxba)
PubSub Utils
(amqzmuf0)
Dur/Subs
Mgr
Topic
Scavenger
Multicast
Brw/Mark
Delayed Deliv
Cache,
Inter QMgr
Agent
Queue Manager
Shared Resources
Checkpoint
MQCONN
MQCONN
MQOPEN
MQDISC
MQPUT
MQGET
etc.
Agent
IPCC
Execution
Controller
IPCC
Log Manager
MQI Stub
Application
IPCC
MQI Stub
Application
IPCC
MQI Stub
Application
IPCC
Object
Authority
Manager
Queue Manager: Process Model
Shared, Isolated and
Trusted Bindings
Agenda
• What is distributed WebSphere MQ?
• Structure of the Queue Manager
• Function Walkthroughs
• Client Channels
• Logging and Recovery
MQI Stub
Application
IPCC
Execution
Controller
IPCC
IPCC
DAP
Kernel
Agent
IPCC
Application (MQI Stub)
Verify parameters and handles
Construct a Connect message
Call API crossing exit
Send a message to the EC
Application (MQI Stub)
Receive the reply
Construct an IPCC message
Send the message to the agent
Application (MQI Stub)
Receive reply and call API crossing exit
Return HCONN
Execution Controller
Choose an agent or start a new one
Construct a reply IPCC message
Return reply to application
Agent
Check App's permission to connect
Allocate and assign agent resources
Send IPCC reply back to application
MQCONN
Performance Implications: Connection Binding
• Fastpath binding removes inter-process communications
– Implies that the application is 'trusted'
– MQCONNX option MQCNO_FASTPATH_BINDING
– Application failure can corrupt queue manager
• Primary benefit is for non-persistent message processing
– Use for MCAs, Broker
• - 30% CPU saving
MQ
Appl
Agent
Memory
Log
IPC
Standard
Binding
MQ
Appl
Agent
Memory
Log
FASTPATH
Binding
Performance Implications: Connection Binding
MQ
Appl
Agent
Memory
Log
IPC
Standard
Binding
MQ
Appl
Agent
Memory
Log
FASTPATH
Binding
MCA Agent
Memory
Log
IPC
Client
Binding
MQ
Appl
Network
Application (MQI Stub)
Verify hConn
Call API crossing exit
Verify parameter addressability
Place parameters in an Open message
Send an IPCC message to the agent
MQI Stub
Application
IPCC
DAP
Kernel
Agent
IPCC
Agent
Application interface
 Verify open parameters
Kernel
Verify operation validity
Resolve target – including cluster lookup
Check permissions on the queue
DAP
Load the queue ready for gets and puts if required
ƒ This is the part that can use system resources
Kernel
Generate handle to object for application
Generate responses and event messages
IPCC
Send reply back to application
Application (MQI Stub)
Receive reply
Call API crossing exit
Return HOBJ
MQOPEN of a queue
MQOPEN internal changes for V8
• The object catalog is the list of objects and a map to the real files
– Shows that queue 'X.Y' is stored in "/var/mqm/qmgrs/<qm>/queues/X!Y"
– dspmqfls command shows the map
– Updated whenever an object is created or deleted
• In MQ V7 there were just two locks associated with the object catalog
– A significant implication of this scheme was that an MQOPEN could not overlap with the
creation/deletion of a queue (or any other object)
– Ghost queues introduced in MQ V5.2 went some way to reducing the impact, particularly for TDQ’s, but
very significant serialization implications remained.
• MQ V8 uses finer grained locks
– The master mutex need not be owned while waiting for the object mutex.
• The most significant impact of this serialization change is that dynamic queues can now be
created and destroyed concurrently with MQOPEN activity
26
Performance Implications: Heavyweight MQI Calls
• MQCONN is a “heavy” operation
– Don’t let your application do lots of them
– Wrappers and OO interfaces can sometimes hide what’s really happening
– Lots of MQCONNs can drop throughput from 1000s Msgs/Sec to 10s Msgs/Sec
• MQOPEN is also ‘heavy’ compared to MQPUT/MQGET
– Depends on the type of queue and whether first use
• Loading pre-existing queue; creating dynamic queue
– It’s where we do the security check
• Try to cache queue handles if more than one message
– If you’re only putting one message consider using MQPUT1
• Particularly client bindings
• Try to avoid exclusive access to the Queue
– Makes it harder to scale the solution
• For example adding more instances of application
– Implies that reliance on message order is not required
• Partition the data to allow parallel processing?
Performance Implications: Persistence
• Log bandwidth is going to restrict throughput
– Put the log files on the fastest disks you have, separate from queue file
– Persistent messages are the main things requiring recovery after an outage
– Can significantly affect restart times
• Why use persistence?
– False assumption that persistence is for "important" data and nonpersistent for when you don't care
– The real reason for persistent messages is to reduce application complexity
– With persistent, apps do not need logic to detect and deal with lost messages
– If your app (or operational procedures) can detect and deal with lost messages, then you do not need to
use persistent messages
• Understand which apps use persistence
MQPUT Queue File
Log
Kernel
Verify operation validity
(Resolve cluster queue destination)
DAP
Reserve space for the message data
If (persistent message)
Write log records for the update
(Wait for log records to reach the disk if outside syncpoint)
Write the message to the queue file
Else (non-persistent)
If (space available in queue buffer)
Copy the message data into the buffer
Else
Write the message to the queue file without logging
Maintain queue statistics such as queue depth
Kernel
Generate responses and events, wakeup getters/drive async consumers
Serialised
MQPUT Walkthrough
Also check for "if waiting getter"
Tip!
Use persistent messages with
syncpoint
Put to a waiting getter
• MQPUT most efficient if there is getting application waiting
– Having multiple applications processing queue increases percentage
– May not appear ‘balanced’ – May keep one ‘hot’
• Only for out of syncpoint messages
– Both persistent and non-persistent
– If Persistent outside of syncpoint, think carefully about why using persistence
• Got message could be lost if crash before returning to the application!
• No queuing required
– Removes a lot of processing of placing the message onto the queue
• Significantly reduces CPU cost and improves throughput
– Lots of improvements on this area in newest releases (7.1, 7.5)
MQPUT MQGET
MQGET
MQGET
Kernel
Verify operation validity
Check message expiry
Wait for message if not available
DAP
Locate a message meeting the requested criteria including
current browse cursor position
priority
message id, correlation id, segment or group conditions
Copy data into the message buffer
If (persistent)
Write log record
(Wait for log record to reach the disk if outside syncpoint)
Move the browse cursor if required
Maintain queue statistics such as queue depth
Kernel
Generate responses and events
Serialised
MQGET Walkthrough
Tip!
In request reply model, get by correlid
more efficient than get by msgid
Kernel
Verify operation validity
DAP
Write log record to end transaction
Wait for this log record to reach the disk
Lock all queues touched in this transaction
For each queue
Make any changes to messages in the transaction visible
Unlock queue
Kernel
Generate responses and events
Wakeup Getters/Drive Async Consumers
MQCMIT Walkthrough
Deal with 2PC protocol if in an
XA transaction
Performance Implications: Syncpoint
• Do you need it?
– Yes, when a set of work needs to either all be performed, or all not performed
• Maximum Size of UOW can be limited
– QMGR MAXUMSGS parm
– Set to sensible value to avoid runaway applications
• Make sure you keep the size of your UOWs small
– Don’t forget to end the UOW
• Cheaper to process in syncpoint for persistent messages
– Up to a point, not huge UOWs
– Log not forced after every MQPUT/MQGET
• Useful even when only a single message inside syncpoint
– And running multiple parallel applications
Good Application Design - Summary
• Long-running connection
• Opens queues up-front
• Uses syncpoint for persistent operations
• No message affinities so multiple instances can run in parallel
Agenda
• What is distributed WebSphere MQ?
• Structure of the Queue Manager
• Function Walkthroughs
• Client Channels
• Logging and Recovery
• Multiple Installation Support
Clients from V7
• Many changes to the client protocols in V7
– All can improve performance
• Multiplexing or Shared Conversations
– For multi-threaded applications
– Several connections use the same socket
• Asynchronous Put
– For sending applications
• Read-ahead
– For receiving applications
• New threads inside application for full-duplex comms
– Sharecnv(0) – May be fast but no full-duplex so miss good functionality
– Sharecnv(1) – One socket per hconn, optimised in V8 - recommended value
– Sharecvn(10) – Shared socket for multiple conversations (default value)
Client
Asynchronous Put Response
MQCONN
MQOPEN
MQOPEN
MQPUT
MQPUT
MQPUT
MQPUT
MQCMIT
Server
Read-ahead of messages
Client
MQCONN
MQOPEN
MQGET
MQGET
MQGET
Server
Request for
‘n’ messages
Client Connection Performance.
• Lots of internal changes at V8
– Channel status table restructure
– Reduce cost of health checking (MQIBindType=FASTPATH)
– Keep a hash table of processes, each with a sub-list of threads.
– Reduce cost of creating/deleting TDQ’s
– Channel process pooling pre-start
• Net effect of all of these changes is significant improvement to the queue manager’s ability to
accept a large number of inbound connections in a relatively short time.
• In one test the time taken to attach 50,000 clients, with each client owning a TDQ, reduced from
over an hour at 7.0.1.6 to under 4 minutes at MQ V8.
58
Agenda
• What is distributed WebSphere MQ?
• Structure of the Queue Manager
• Function Walkthroughs
• Channels
• Logging and Recovery
• Multiple Installation Support
What's the point of logging?
• A log record is written for each persistent update
– The log record describes the update
• Optimisations to minimise serialisation points
• Write-Ahead Logging
– The log is always more up-to-date than the actual data
• Log is a sequential file
– Sequential I/O is much quicker than random
– Single point of writing rather than to individual object files
• Log and actual data are reconciled during strmqm
– Progress information displayed
• Point of consistency – Checkpoint
– Log control file: amqhlctl.lfh – in log directory
– Checkpoint amqalchk.fil – qmgr directory
– Backup queue managers from MQ V6
Myth!
Triple write integrity does not mean
we write all data 3 times!
Looking at logger performance
• Can extract internal information from a service tool
– Lots of MQ performance PMRs turn out to be disk-related. So recording was added to the internal state
• amqldmpa –c H –m <qmgr> -d 8 –n <count> -s <interval> -f <file>
– The amqldmpa program can dump lots of other internal information too
• Includes logger I/O activity
– WriteTimeMax shows maximum time (microseconds) to complete I/O
– WriteSizeMax shows largest (bytes) I/O
– Since qmgr started
• Maintains averages
– WriteSizeShort is short-term (64-sample) weighted average of recent writes
– WriteSizeLong is longer-term (1024-sample) weighted average
– Similarly for WriteTimeShort/Long
• From one PMR:
– WriteTimeMax = 59102377, WriteSizeMax=2097152
– So it has taken nearly 60 seconds to write 2MB
– Implies they need to talk to disk support team!
Summary – understand the applications
• Understand the application pattern
– Exclusivity, affinity
• Understand the individual application
– Many times have heard "it's using persistence" when it's not. Or vice versa.
• If you don't have access to application source, tools exist to help
– Application Activity Trace
– Accounting messages
– MQ Trace
Questions?
Notices and Disclaimers
66
Copyright © 2016 by International Business Machines Corporation (IBM). No part of this document may be reproduced or transmitted in any form without written permission
from IBM.
U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM.
Information in these presentations (including information relating to products that have not yet been announced by IBM) has been reviewed for accuracy as of the date of initial
publication and could include unintentional technical or typographical errors. IBM shall have no responsibility to update this information. THIS DOCUMENT IS DISTRIBUTED
"AS IS" WITHOUT ANY WARRANTY, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL IBM BE LIABLE FOR ANY DAMAGE ARISING FROM THE USE OF THIS
INFORMATION, INCLUDING BUT NOT LIMITED TO, LOSS OF DATA, BUSINESS INTERRUPTION, LOSS OF PROFIT OR LOSS OF OPPORTUNITY. IBM products and
services are warranted according to the terms and conditions of the agreements under which they are provided.
Any statements regarding IBM's future direction, intent or product plans are subject to change or withdrawal without notice.
Performance data contained herein was generally obtained in a controlled, isolated environments. Customer examples are presented as illustrations of how those customers
have used IBM products and the results they may have achieved. Actual performance, cost, savings or other results in other operating environments may vary.
References in this document to IBM products, programs, or services does not imply that IBM intends to make such products, programs or services available in all countries in
which IBM operates or does business.
Workshops, sessions and associated materials may have been prepared by independent session speakers, and do not necessarily reflect the views of IBM. All materials and
discussions are provided for informational purposes only, and are neither intended to, nor shall constitute legal or other guidance or advice to any individual participant or their
specific situation.
It is the customer’s responsibility to insure its own compliance with legal requirements and to obtain advice of competent legal counsel as to the identification and
interpretation of any relevant laws and regulatory requirements that may affect the customer’s business and any actions the customer may need to take to comply with such
laws. IBM does not provide legal advice or represent or warrant that its services or products will ensure that the customer is in compliance with any law
Notices and Disclaimers Con’t.
67
Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not
tested those products in connection with this publication and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM products.
Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. IBM does not warrant the quality of any third-party products, or the
ability of any such third-party products to interoperate with IBM’s products. IBM EXPRESSLY DISCLAIMS ALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
The provision of the information contained h erein is not intended to, and does not, grant any right or license under any IBM patents, copyrights, trademarks or other intellectual
property right.
IBM, the IBM logo, ibm.com, Aspera®, Bluemix, Blueworks Live, CICS, Clearcase, Cognos®, DOORS®, Emptoris®, Enterprise Document Management System™, FASP®,
FileNet®, Global Business Services ®, Global Technology Services ®, IBM ExperienceOne™, IBM SmartCloud®, IBM Social Business®, Information on Demand, ILOG,
Maximo®, MQIntegrator®, MQSeries®, Netcool®, OMEGAMON, OpenPower, PureAnalytics™, PureApplication®, pureCluster™, PureCoverage®, PureData®,
PureExperience®, PureFlex®, pureQuery®, pureScale®, PureSystems®, QRadar®, Rational®, Rhapsody®, Smarter Commerce®, SoDA, SPSS, Sterling Commerce®,
StoredIQ, Tealeaf®, Tivoli®, Trusteer®, Unica®, urban{code}®, Watson, WebSphere®, Worklight®, X-Force® and System z® Z/OS, are trademarks of International Business
Machines Corporation, registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM
trademarks is available on the Web at "Copyright and trademark information" at: www.ibm.com/legal/copytrade.shtml.
Thank You
Your Feedback is Important!
Access the InterConnect 2016 Conference Attendee
Portal to complete your session surveys from your
smartphone,
laptop or conference kiosk.
Monday
10:30-11:30 3592 New MQ features
3452 Managing applications
12:00-13:00 2835 MQ on z/OS and Distributed
15:00-16:00 3470 Latest MQ z/OS features
2833 Where is my message?
3544 MQ Light in an MQ infrastructure
16:30-17:30 3573 Hybrid cloud messaging
2941 MQ Advanced
Tuesday
08:30-09:30 3540 The MQ Light API
12:00-13:00 3456 The IBM MQ Appliance
13:15-14:15 3499 Introducing Message Hub
3458 MQ Appliance administration
14:30-15:30 6432 MQ updates and futures (InnerCircle)
2849 Messaging feedback roundtable
16:00-17:00 3544 MQ Light in an MQ infrastructure
3513 MQ hands on lab
Wednesday
08:30-09:30 3602 Managing your MQ environment
12:00-13:00 3613 Designing MQ self service
6408 Hybrid messaging roadmap (InnerCircle)
13:15-14:00 3416 HA and DR with MQ
3433 Why secure your messaging?
15:45-16:30 3429 Securing MQ
2847 Meet the messaging experts
16:00-17:00 3508 MQ Light hands on lab
16:45-17:30 2275 Migrating to the IBM MQ Appliance
Thursday
08:30-09:15 3420 MQ Clustering
2931 Business agility with self service MQ
09:30-10:15 3479 MQ z/OS clusters and shared queue
3450 Optimising MQ applications
2849 Messaging feedback roundtable
10:30-11:15 3465 MQ Appliance high availability
3481 MQ z/OS messaging connectivity
11:30-12:15 3474 Active-active messaging
3537 Monitoring and managing MQ
3425 MQ publish/subscribe
Find us at the EXPO:
Hybrid Integration peds 65-68
Check out the Hybrid Messaging sub topic under the
Hybrid Integration topic for further customer and business
partner sessions
Hybrid Messaging from the IBM experts at InterConnect 2016
Sunday
14:30-15:30 6408 Hybrid messaging roadmap (InnerCircle)

More Related Content

PDF
3452 - Managing your applications
PDF
HHM-2833: Where is My Message?: Using IBM MQ Tools to Work Out What Applicati...
PDF
HHM 6887 Managing Your Scalable Applications in an MQ Hybrid Cloud World
PDF
MQ V8004 Summary
PDF
IBM MQ Clustering (2017 version)
PPTX
3429 How to transform your messaging environment to a secure messaging envi...
PDF
IBM MQ - better application performance
PDF
Monitoring and problem determination of your mq distributed systems
3452 - Managing your applications
HHM-2833: Where is My Message?: Using IBM MQ Tools to Work Out What Applicati...
HHM 6887 Managing Your Scalable Applications in an MQ Hybrid Cloud World
MQ V8004 Summary
IBM MQ Clustering (2017 version)
3429 How to transform your messaging environment to a secure messaging envi...
IBM MQ - better application performance
Monitoring and problem determination of your mq distributed systems

What's hot (20)

PDF
DataPower-MQ Integration Deep Dive
PDF
MQ What's New Beyond V8 - V8003 level
PDF
IBM MQ - Comparing Distributed and z/OS platforms
PDF
IBM MQ for z/OS The Latest and Greatest Enhancements
PDF
MQ Security Overview
PDF
SoC Idling for unconf COSCUP 2016
PDF
HHM-3481: IBM MQ for z/OS: Enhancing Application and Messaging Connectivity ...
PPTX
Improving Kafka at-least-once performance at Uber
PDF
Socket Programming using Java
ODT
Guidelhhghghine document final
PDF
HHM 6894 Messaging APIs for Cloud, Enterprise and Digital Applications
PPT
IBM WebSphere MQ: Managing Workloads, Scaling and Availability with MQ Clusters
ODP
Tls 13final13
PDF
Training Slides: 104 - Basics - Working With Command Line Tools
PDF
Intro to Packet Analysis - pfSense Hangout May 2014
PDF
M|18 Architectural Overview: MariaDB MaxScale
PDF
Ibm websphere mq
PDF
SRX Automation at Groupon
PDF
Server Load Balancing on pfSense 2.4 - pfSense Hangout July 2017
PDF
Connectivity Troubleshooting - pfSense Hangout June 2016
DataPower-MQ Integration Deep Dive
MQ What's New Beyond V8 - V8003 level
IBM MQ - Comparing Distributed and z/OS platforms
IBM MQ for z/OS The Latest and Greatest Enhancements
MQ Security Overview
SoC Idling for unconf COSCUP 2016
HHM-3481: IBM MQ for z/OS: Enhancing Application and Messaging Connectivity ...
Improving Kafka at-least-once performance at Uber
Socket Programming using Java
Guidelhhghghine document final
HHM 6894 Messaging APIs for Cloud, Enterprise and Digital Applications
IBM WebSphere MQ: Managing Workloads, Scaling and Availability with MQ Clusters
Tls 13final13
Training Slides: 104 - Basics - Working With Command Line Tools
Intro to Packet Analysis - pfSense Hangout May 2014
M|18 Architectural Overview: MariaDB MaxScale
Ibm websphere mq
SRX Automation at Groupon
Server Load Balancing on pfSense 2.4 - pfSense Hangout July 2017
Connectivity Troubleshooting - pfSense Hangout June 2016
Ad

Viewers also liked (12)

PDF
3425 - Using publish/subscribe to integrate applications
PPT
Apache kafka- Onkar Kadam
PDF
Introducing IBM Message Hub: Cloud-scale messaging based on Apache Kafka
PPT
#1922 rest-push2 ap-im-v6
PDF
HHM-3540: The IBM MQ Light API: From Developer Laptop to Enterprise Data Cen...
PPTX
WhatsNewIBMIntegrationBus10FP4
PPTX
ConnectorsForIntegration
PPTX
IBM Messaging Security - Why securing your environment is important : IBM Int...
PDF
Hia 1691-using iib-to_support_api_economy
PDF
Hia 1689-techinical introduction-to_iib
PDF
Java zone 2015 How to make life with kafka easier.
PDF
Microservices: Where do they fit within a rapidly evolving integration archit...
3425 - Using publish/subscribe to integrate applications
Apache kafka- Onkar Kadam
Introducing IBM Message Hub: Cloud-scale messaging based on Apache Kafka
#1922 rest-push2 ap-im-v6
HHM-3540: The IBM MQ Light API: From Developer Laptop to Enterprise Data Cen...
WhatsNewIBMIntegrationBus10FP4
ConnectorsForIntegration
IBM Messaging Security - Why securing your environment is important : IBM Int...
Hia 1691-using iib-to_support_api_economy
Hia 1689-techinical introduction-to_iib
Java zone 2015 How to make life with kafka easier.
Microservices: Where do they fit within a rapidly evolving integration archit...
Ad

Similar to 3450 - Writing and optimising applications for performance in a hybrid messaging world (20)

PDF
IBM MQ Appliance - Administration simplified
PDF
Big Data Streams Architectures. Why? What? How?
PDF
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
PPTX
Hhm 3474 mq messaging technologies and support for high availability and acti...
PDF
Training Slides: Basics 102: Introduction to Tungsten Clustering
PDF
Kudu - Fast Analytics on Fast Data
PDF
IBM MQ High Availabillity and Disaster Recovery (2017 version)
PDF
Slash n: Technical Session 2 - Messaging as a Platform - Shashwat Agarwal, V...
PDF
Software Architecture for Cloud Infrastructure
PPTX
Apache Big Data 2016: Next Gen Big Data Analytics with Apache Apex
PPTX
Flexible and Real-Time Stream Processing with Apache Flink
PPTX
Maria DB Galera Cluster for High Availability
PPTX
MariaDB Galera Cluster
PDF
Flink forward-2017-netflix keystones-paas
PDF
AWS re:Invent presentation: Unmeltable Infrastructure at Scale by Loggly
PDF
Citi Tech Talk: Monitoring and Performance
PPTX
Intro to Apache Apex - Next Gen Platform for Ingest and Transform
PDF
OnPrem Monitoring.pdf
PDF
collab2011-tuning-ebusiness-421966.pdf
PDF
Apache Kafka - Scalable Message-Processing and more !
IBM MQ Appliance - Administration simplified
Big Data Streams Architectures. Why? What? How?
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
Hhm 3474 mq messaging technologies and support for high availability and acti...
Training Slides: Basics 102: Introduction to Tungsten Clustering
Kudu - Fast Analytics on Fast Data
IBM MQ High Availabillity and Disaster Recovery (2017 version)
Slash n: Technical Session 2 - Messaging as a Platform - Shashwat Agarwal, V...
Software Architecture for Cloud Infrastructure
Apache Big Data 2016: Next Gen Big Data Analytics with Apache Apex
Flexible and Real-Time Stream Processing with Apache Flink
Maria DB Galera Cluster for High Availability
MariaDB Galera Cluster
Flink forward-2017-netflix keystones-paas
AWS re:Invent presentation: Unmeltable Infrastructure at Scale by Loggly
Citi Tech Talk: Monitoring and Performance
Intro to Apache Apex - Next Gen Platform for Ingest and Transform
OnPrem Monitoring.pdf
collab2011-tuning-ebusiness-421966.pdf
Apache Kafka - Scalable Message-Processing and more !

Recently uploaded (20)

PDF
medical staffing services at VALiNTRY
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
AI in Product Development-omnex systems
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
Online Work Permit System for Fast Permit Processing
PDF
System and Network Administraation Chapter 3
PDF
Digital Strategies for Manufacturing Companies
PPT
Introduction Database Management System for Course Database
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
System and Network Administration Chapter 2
PPTX
L1 - Introduction to python Backend.pptx
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Transform Your Business with a Software ERP System
PDF
Nekopoi APK 2025 free lastest update
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
ISO 45001 Occupational Health and Safety Management System
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
medical staffing services at VALiNTRY
How Creative Agencies Leverage Project Management Software.pdf
AI in Product Development-omnex systems
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Online Work Permit System for Fast Permit Processing
System and Network Administraation Chapter 3
Digital Strategies for Manufacturing Companies
Introduction Database Management System for Course Database
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
System and Network Administration Chapter 2
L1 - Introduction to python Backend.pptx
Design an Analysis of Algorithms II-SECS-1021-03
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Transform Your Business with a Software ERP System
Nekopoi APK 2025 free lastest update
CHAPTER 2 - PM Management and IT Context
Softaken Excel to vCard Converter Software.pdf
VVF-Customer-Presentation2025-Ver1.9.pptx
ISO 45001 Occupational Health and Safety Management System
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx

3450 - Writing and optimising applications for performance in a hybrid messaging world

  • 1. 3450: Writing and optimising Applications for performance in a hybrid messaging world Tim McCormick IBM MQ Service Architect timmccor@uk.ibm.com
  • 2. Agenda • Some performance numbers • Structure of the Queue Manager • Function Walkthroughs • Client Channels • Logging and Recovery
  • 3. Agenda • Some performance numbers • Structure of the Queue Manager • Function Walkthroughs • Client Channels • Logging and Recovery
  • 4. Performance Bottlenecks • Business Systems are complex – Often no single bottleneck limiting performance – Performance can mean different things to different people – Throughput • Scalability • Low resource usage • Not only limited by physical resources – Application design, such as parallelism can have major effect • Performance Reports (from SupportPac site) show range of scenarios RAM CPU NetworkI/O Bottlenecks
  • 5. See how far it's come …
  • 6. Distributed Performance: Persistent Messaging • An AIX system: Max performance increased from 16K to 19K
  • 7. Distributed Performance: Non-persistent Messaging • A Windows system: Max performance increased from 90K to 121K
  • 8. Distributed Performance in V8 • Improvements to distributed queue manager scaling – Improve efficiency – Better exploitation of wider SMP machines – Looking at customer-provided application patterns not just benchmarks • Always happy to have more customer examples • Multiplexed client performance – Increase the performance of multiplexed client channels (SHRCONV > 0) – Especially for SHRCONV=1 • Other areas that helped: – Cache alignment for internal structures – Extended 64-bit exploitation for locking primitives – RFH2 handling, particularly for waiting-getter • Fewer copies of data are needed – Better compiler optimisations including feedback-directed optimisation – Faster data conversion (especially for 1208) • Many messages are in 1208 codepage • Optimised handling when the queue manager needs to convert them
  • 9. Agenda • What is distributed WebSphere MQ? • Structure of the Queue Manager • Function Walkthroughs • Client Channels • Logging and Recovery
  • 10. Also: runmqchi runmqlsr amqzdmaa amqrmppa amqpcsea Queue Manager Process Tree Execution Controller (amqzxma0) Critical Services (amqzmuc0) Restartable Services (amqzmur0) External Processes (amqzmgr0) Repository Manager (amqrrmfa) Object Authority Manager (amqzfuma) LQM Agent (amqzlaa0) V6V7.x, V8 PubSub V6 Compat (amqfqpub) PubSub Streams (amqfcxba) PubSub Utils (amqzmuf0) Dur/Subs Mgr Topic Scavenger Multicast Brw/Mark Delayed Deliv Cache, Inter QMgr
  • 11. Agent Queue Manager Shared Resources Checkpoint MQCONN MQCONN MQOPEN MQDISC MQPUT MQGET etc. Agent IPCC Execution Controller IPCC Log Manager MQI Stub Application IPCC MQI Stub Application IPCC MQI Stub Application IPCC Object Authority Manager Queue Manager: Process Model Shared, Isolated and Trusted Bindings
  • 12. Agenda • What is distributed WebSphere MQ? • Structure of the Queue Manager • Function Walkthroughs • Client Channels • Logging and Recovery
  • 13. MQI Stub Application IPCC Execution Controller IPCC IPCC DAP Kernel Agent IPCC Application (MQI Stub) Verify parameters and handles Construct a Connect message Call API crossing exit Send a message to the EC Application (MQI Stub) Receive the reply Construct an IPCC message Send the message to the agent Application (MQI Stub) Receive reply and call API crossing exit Return HCONN Execution Controller Choose an agent or start a new one Construct a reply IPCC message Return reply to application Agent Check App's permission to connect Allocate and assign agent resources Send IPCC reply back to application MQCONN
  • 14. Performance Implications: Connection Binding • Fastpath binding removes inter-process communications – Implies that the application is 'trusted' – MQCONNX option MQCNO_FASTPATH_BINDING – Application failure can corrupt queue manager • Primary benefit is for non-persistent message processing – Use for MCAs, Broker • - 30% CPU saving MQ Appl Agent Memory Log IPC Standard Binding MQ Appl Agent Memory Log FASTPATH Binding
  • 15. Performance Implications: Connection Binding MQ Appl Agent Memory Log IPC Standard Binding MQ Appl Agent Memory Log FASTPATH Binding MCA Agent Memory Log IPC Client Binding MQ Appl Network
  • 16. Application (MQI Stub) Verify hConn Call API crossing exit Verify parameter addressability Place parameters in an Open message Send an IPCC message to the agent MQI Stub Application IPCC DAP Kernel Agent IPCC Agent Application interface  Verify open parameters Kernel Verify operation validity Resolve target – including cluster lookup Check permissions on the queue DAP Load the queue ready for gets and puts if required ƒ This is the part that can use system resources Kernel Generate handle to object for application Generate responses and event messages IPCC Send reply back to application Application (MQI Stub) Receive reply Call API crossing exit Return HOBJ MQOPEN of a queue
  • 17. MQOPEN internal changes for V8 • The object catalog is the list of objects and a map to the real files – Shows that queue 'X.Y' is stored in "/var/mqm/qmgrs/<qm>/queues/X!Y" – dspmqfls command shows the map – Updated whenever an object is created or deleted • In MQ V7 there were just two locks associated with the object catalog – A significant implication of this scheme was that an MQOPEN could not overlap with the creation/deletion of a queue (or any other object) – Ghost queues introduced in MQ V5.2 went some way to reducing the impact, particularly for TDQ’s, but very significant serialization implications remained. • MQ V8 uses finer grained locks – The master mutex need not be owned while waiting for the object mutex. • The most significant impact of this serialization change is that dynamic queues can now be created and destroyed concurrently with MQOPEN activity 26
  • 18. Performance Implications: Heavyweight MQI Calls • MQCONN is a “heavy” operation – Don’t let your application do lots of them – Wrappers and OO interfaces can sometimes hide what’s really happening – Lots of MQCONNs can drop throughput from 1000s Msgs/Sec to 10s Msgs/Sec • MQOPEN is also ‘heavy’ compared to MQPUT/MQGET – Depends on the type of queue and whether first use • Loading pre-existing queue; creating dynamic queue – It’s where we do the security check • Try to cache queue handles if more than one message – If you’re only putting one message consider using MQPUT1 • Particularly client bindings • Try to avoid exclusive access to the Queue – Makes it harder to scale the solution • For example adding more instances of application – Implies that reliance on message order is not required • Partition the data to allow parallel processing?
  • 19. Performance Implications: Persistence • Log bandwidth is going to restrict throughput – Put the log files on the fastest disks you have, separate from queue file – Persistent messages are the main things requiring recovery after an outage – Can significantly affect restart times • Why use persistence? – False assumption that persistence is for "important" data and nonpersistent for when you don't care – The real reason for persistent messages is to reduce application complexity – With persistent, apps do not need logic to detect and deal with lost messages – If your app (or operational procedures) can detect and deal with lost messages, then you do not need to use persistent messages • Understand which apps use persistence MQPUT Queue File Log
  • 20. Kernel Verify operation validity (Resolve cluster queue destination) DAP Reserve space for the message data If (persistent message) Write log records for the update (Wait for log records to reach the disk if outside syncpoint) Write the message to the queue file Else (non-persistent) If (space available in queue buffer) Copy the message data into the buffer Else Write the message to the queue file without logging Maintain queue statistics such as queue depth Kernel Generate responses and events, wakeup getters/drive async consumers Serialised MQPUT Walkthrough Also check for "if waiting getter" Tip! Use persistent messages with syncpoint
  • 21. Put to a waiting getter • MQPUT most efficient if there is getting application waiting – Having multiple applications processing queue increases percentage – May not appear ‘balanced’ – May keep one ‘hot’ • Only for out of syncpoint messages – Both persistent and non-persistent – If Persistent outside of syncpoint, think carefully about why using persistence • Got message could be lost if crash before returning to the application! • No queuing required – Removes a lot of processing of placing the message onto the queue • Significantly reduces CPU cost and improves throughput – Lots of improvements on this area in newest releases (7.1, 7.5) MQPUT MQGET MQGET MQGET
  • 22. Kernel Verify operation validity Check message expiry Wait for message if not available DAP Locate a message meeting the requested criteria including current browse cursor position priority message id, correlation id, segment or group conditions Copy data into the message buffer If (persistent) Write log record (Wait for log record to reach the disk if outside syncpoint) Move the browse cursor if required Maintain queue statistics such as queue depth Kernel Generate responses and events Serialised MQGET Walkthrough Tip! In request reply model, get by correlid more efficient than get by msgid
  • 23. Kernel Verify operation validity DAP Write log record to end transaction Wait for this log record to reach the disk Lock all queues touched in this transaction For each queue Make any changes to messages in the transaction visible Unlock queue Kernel Generate responses and events Wakeup Getters/Drive Async Consumers MQCMIT Walkthrough Deal with 2PC protocol if in an XA transaction
  • 24. Performance Implications: Syncpoint • Do you need it? – Yes, when a set of work needs to either all be performed, or all not performed • Maximum Size of UOW can be limited – QMGR MAXUMSGS parm – Set to sensible value to avoid runaway applications • Make sure you keep the size of your UOWs small – Don’t forget to end the UOW • Cheaper to process in syncpoint for persistent messages – Up to a point, not huge UOWs – Log not forced after every MQPUT/MQGET • Useful even when only a single message inside syncpoint – And running multiple parallel applications
  • 25. Good Application Design - Summary • Long-running connection • Opens queues up-front • Uses syncpoint for persistent operations • No message affinities so multiple instances can run in parallel
  • 26. Agenda • What is distributed WebSphere MQ? • Structure of the Queue Manager • Function Walkthroughs • Client Channels • Logging and Recovery • Multiple Installation Support
  • 27. Clients from V7 • Many changes to the client protocols in V7 – All can improve performance • Multiplexing or Shared Conversations – For multi-threaded applications – Several connections use the same socket • Asynchronous Put – For sending applications • Read-ahead – For receiving applications • New threads inside application for full-duplex comms – Sharecnv(0) – May be fast but no full-duplex so miss good functionality – Sharecnv(1) – One socket per hconn, optimised in V8 - recommended value – Sharecvn(10) – Shared socket for multiple conversations (default value)
  • 30. Client Connection Performance. • Lots of internal changes at V8 – Channel status table restructure – Reduce cost of health checking (MQIBindType=FASTPATH) – Keep a hash table of processes, each with a sub-list of threads. – Reduce cost of creating/deleting TDQ’s – Channel process pooling pre-start • Net effect of all of these changes is significant improvement to the queue manager’s ability to accept a large number of inbound connections in a relatively short time. • In one test the time taken to attach 50,000 clients, with each client owning a TDQ, reduced from over an hour at 7.0.1.6 to under 4 minutes at MQ V8. 58
  • 31. Agenda • What is distributed WebSphere MQ? • Structure of the Queue Manager • Function Walkthroughs • Channels • Logging and Recovery • Multiple Installation Support
  • 32. What's the point of logging? • A log record is written for each persistent update – The log record describes the update • Optimisations to minimise serialisation points • Write-Ahead Logging – The log is always more up-to-date than the actual data • Log is a sequential file – Sequential I/O is much quicker than random – Single point of writing rather than to individual object files • Log and actual data are reconciled during strmqm – Progress information displayed • Point of consistency – Checkpoint – Log control file: amqhlctl.lfh – in log directory – Checkpoint amqalchk.fil – qmgr directory – Backup queue managers from MQ V6 Myth! Triple write integrity does not mean we write all data 3 times!
  • 33. Looking at logger performance • Can extract internal information from a service tool – Lots of MQ performance PMRs turn out to be disk-related. So recording was added to the internal state • amqldmpa –c H –m <qmgr> -d 8 –n <count> -s <interval> -f <file> – The amqldmpa program can dump lots of other internal information too • Includes logger I/O activity – WriteTimeMax shows maximum time (microseconds) to complete I/O – WriteSizeMax shows largest (bytes) I/O – Since qmgr started • Maintains averages – WriteSizeShort is short-term (64-sample) weighted average of recent writes – WriteSizeLong is longer-term (1024-sample) weighted average – Similarly for WriteTimeShort/Long • From one PMR: – WriteTimeMax = 59102377, WriteSizeMax=2097152 – So it has taken nearly 60 seconds to write 2MB – Implies they need to talk to disk support team!
  • 34. Summary – understand the applications • Understand the application pattern – Exclusivity, affinity • Understand the individual application – Many times have heard "it's using persistence" when it's not. Or vice versa. • If you don't have access to application source, tools exist to help – Application Activity Trace – Accounting messages – MQ Trace
  • 36. Notices and Disclaimers 66 Copyright © 2016 by International Business Machines Corporation (IBM). No part of this document may be reproduced or transmitted in any form without written permission from IBM. U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM. Information in these presentations (including information relating to products that have not yet been announced by IBM) has been reviewed for accuracy as of the date of initial publication and could include unintentional technical or typographical errors. IBM shall have no responsibility to update this information. THIS DOCUMENT IS DISTRIBUTED "AS IS" WITHOUT ANY WARRANTY, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL IBM BE LIABLE FOR ANY DAMAGE ARISING FROM THE USE OF THIS INFORMATION, INCLUDING BUT NOT LIMITED TO, LOSS OF DATA, BUSINESS INTERRUPTION, LOSS OF PROFIT OR LOSS OF OPPORTUNITY. IBM products and services are warranted according to the terms and conditions of the agreements under which they are provided. Any statements regarding IBM's future direction, intent or product plans are subject to change or withdrawal without notice. Performance data contained herein was generally obtained in a controlled, isolated environments. Customer examples are presented as illustrations of how those customers have used IBM products and the results they may have achieved. Actual performance, cost, savings or other results in other operating environments may vary. References in this document to IBM products, programs, or services does not imply that IBM intends to make such products, programs or services available in all countries in which IBM operates or does business. Workshops, sessions and associated materials may have been prepared by independent session speakers, and do not necessarily reflect the views of IBM. All materials and discussions are provided for informational purposes only, and are neither intended to, nor shall constitute legal or other guidance or advice to any individual participant or their specific situation. It is the customer’s responsibility to insure its own compliance with legal requirements and to obtain advice of competent legal counsel as to the identification and interpretation of any relevant laws and regulatory requirements that may affect the customer’s business and any actions the customer may need to take to comply with such laws. IBM does not provide legal advice or represent or warrant that its services or products will ensure that the customer is in compliance with any law
  • 37. Notices and Disclaimers Con’t. 67 Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not tested those products in connection with this publication and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. IBM does not warrant the quality of any third-party products, or the ability of any such third-party products to interoperate with IBM’s products. IBM EXPRESSLY DISCLAIMS ALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. The provision of the information contained h erein is not intended to, and does not, grant any right or license under any IBM patents, copyrights, trademarks or other intellectual property right. IBM, the IBM logo, ibm.com, Aspera®, Bluemix, Blueworks Live, CICS, Clearcase, Cognos®, DOORS®, Emptoris®, Enterprise Document Management System™, FASP®, FileNet®, Global Business Services ®, Global Technology Services ®, IBM ExperienceOne™, IBM SmartCloud®, IBM Social Business®, Information on Demand, ILOG, Maximo®, MQIntegrator®, MQSeries®, Netcool®, OMEGAMON, OpenPower, PureAnalytics™, PureApplication®, pureCluster™, PureCoverage®, PureData®, PureExperience®, PureFlex®, pureQuery®, pureScale®, PureSystems®, QRadar®, Rational®, Rhapsody®, Smarter Commerce®, SoDA, SPSS, Sterling Commerce®, StoredIQ, Tealeaf®, Tivoli®, Trusteer®, Unica®, urban{code}®, Watson, WebSphere®, Worklight®, X-Force® and System z® Z/OS, are trademarks of International Business Machines Corporation, registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at: www.ibm.com/legal/copytrade.shtml.
  • 38. Thank You Your Feedback is Important! Access the InterConnect 2016 Conference Attendee Portal to complete your session surveys from your smartphone, laptop or conference kiosk.
  • 39. Monday 10:30-11:30 3592 New MQ features 3452 Managing applications 12:00-13:00 2835 MQ on z/OS and Distributed 15:00-16:00 3470 Latest MQ z/OS features 2833 Where is my message? 3544 MQ Light in an MQ infrastructure 16:30-17:30 3573 Hybrid cloud messaging 2941 MQ Advanced Tuesday 08:30-09:30 3540 The MQ Light API 12:00-13:00 3456 The IBM MQ Appliance 13:15-14:15 3499 Introducing Message Hub 3458 MQ Appliance administration 14:30-15:30 6432 MQ updates and futures (InnerCircle) 2849 Messaging feedback roundtable 16:00-17:00 3544 MQ Light in an MQ infrastructure 3513 MQ hands on lab Wednesday 08:30-09:30 3602 Managing your MQ environment 12:00-13:00 3613 Designing MQ self service 6408 Hybrid messaging roadmap (InnerCircle) 13:15-14:00 3416 HA and DR with MQ 3433 Why secure your messaging? 15:45-16:30 3429 Securing MQ 2847 Meet the messaging experts 16:00-17:00 3508 MQ Light hands on lab 16:45-17:30 2275 Migrating to the IBM MQ Appliance Thursday 08:30-09:15 3420 MQ Clustering 2931 Business agility with self service MQ 09:30-10:15 3479 MQ z/OS clusters and shared queue 3450 Optimising MQ applications 2849 Messaging feedback roundtable 10:30-11:15 3465 MQ Appliance high availability 3481 MQ z/OS messaging connectivity 11:30-12:15 3474 Active-active messaging 3537 Monitoring and managing MQ 3425 MQ publish/subscribe Find us at the EXPO: Hybrid Integration peds 65-68 Check out the Hybrid Messaging sub topic under the Hybrid Integration topic for further customer and business partner sessions Hybrid Messaging from the IBM experts at InterConnect 2016 Sunday 14:30-15:30 6408 Hybrid messaging roadmap (InnerCircle)