BP2190: Best Practices: SonicMQ Configuration and Tuning - PowerPoint PPT Presentation

1 / 51
About This Presentation
Title:

BP2190: Best Practices: SonicMQ Configuration and Tuning

Description:

Hold Messages so Threads don't Wait. Marshall 'bytes' appropriate to System Resource ... messages to free up processing threads. Output Buffer. Optimize use of ... – PowerPoint PPT presentation

Number of Views:598
Avg rating:3.0/5.0
Slides: 52
Provided by: bill186
Category:

less

Transcript and Presenter's Notes

Title: BP2190: Best Practices: SonicMQ Configuration and Tuning


1
BP2190Best Practices SonicMQ Configuration and
Tuning
  • Bill Woodwood_at_sonicsoftware.com
  • Technical Fellow

2
Agenda
  • General Comments
  • Background and Tradeoffs
  • Key Configuration Parameters
  • Where to Create Configurations
  • Putting it all Together
  • Summary and Questions

3
Sample Pub/Sub Durables
SonicMQ Broker
Subscriber
Dur. Sub Connected
?
receive
OutgoingMsgBufferSize
ack
1K
75K
Publisher
150 K
?
publish()
PsGuarMsgBufferSize
DbConnect
Dur. Sub Disconnected
PsDbQueueSize
db
500 K
RecoveryLogPath
4
General Comments
  • Tuning and Configuring SonicMQ
  • Parameters are available in Version 5.0
  • Access via
  • Sonic Management Console (SMC)
  • Management API
  • Best practices
  • SonicMQ v.4 has same parameters
  • Some name changes
  • Set in broker.ini

5
Agenda
  • General Comments
  • Background and Tradeoffs
  • Key Configuration Parameters
  • Where to Create Configurations
  • Putting it all Together
  • Summary and Questions

6
What we do!
SonicMQ Broker

Producer

Consumer

7
What we really do!
SonicMQ Broker
  • As necessary,
  • Check permissions
  • Log
  • Deliver to clients
  • Buffer for slow clients
  • Save for disconnected

Producer
Consumer
send()
process acknowledge
TCP/IP
Disk
8
and we do it many times!
Many Receiving Connections
Many Sending Applications


SonicMQ Broker

Producer

As necessary,


Consumer





send()

Check permissions



Producer




Log

process




Deliver to clients

send()



Buffer for slow clients

process

send()



Buffer for disconnected



Many Senders per Application
Many Receivers per Application
Disk
9
The Problem
  • Many pieces of many applications sending many
    messages
  • Limited Resources
  • Disk
  • Network
  • Consumers
  • Goal
  • Maximize throughput by minimizing contention for
    resources!

10
Our Solution
Optimize use of system resource
Get Messages ready for transfer as fast as
possible
Multiple Message Processing Threads
Message Buffer
Output Buffer
LimitedResource
Hold Messages so Threads dont Wait
Marshall bytes appropriate to System Resource
11
Messages, Buffers and Bytes
  • Common Design Pattern in SonicMQ
  • Dont block on Limited Resources
  • Allow Message processing to continue
  • Message Buffer
  • Holds messages to free up processing threads
  • Output Buffer
  • Optimize use of System Resources
  • Tuned for transferring data (not messages)

12
Message Buffers
  • As they fill, change behavior
  • Throttle producers
  • Block processing threads
  • Free space
  • Message Buffer Size
  • Not an absolute Size
  • Only a Threshold for changing behavior
  • Sizing Guidelines
  • Size for bursts
  • When producers are TEMPORARILY too fast

13
Agenda
  • General Comments
  • Background and Tradeoffs
  • Key Configuration Parameters
  • Where to Create Configurations
  • Putting it all Together
  • Summary and Questions

14
Key Configuration Parameters
  • Recovery Log
  • Topic Subscribers
  • Non-Durable
  • Connected Durable
  • Disconnected Durable
  • Reconnecting Durable
  • Queues
  • Short and Long-term Storage
  • Transactions

15
Recovery Log
RecoveryLogMaxFileSize
Messages and acks from multiple producers and
consumers
RecoveryLogPath
RecoveryLogQueueSize
500,000 bytes
8,196 bytes
Recovery Logs
RecoveryLogBlockSize
BROKER_RECOVERY_LOG_PARAMETERS.RECOVERY_LOG_FLUSH
_DELAY
16
Subscribers
OutgoingMsgBufferSize
Messages from multiple publishers
TCP/IP (network)
150,000 bytes
1,024 bytes
BROKER_CONNECTION_BUFFERS.AGENT_SENDER_OUTPUT_BUF
FER_SIZE
TcpNodelay
17
Durable Subscribers Connected
BROKER_CONNECTION_BUFFERS.AGENT_SENDER_OUTPUT_BUF
FER_SIZE
OutgoingMsgBufferSize
TCP/IP (network)
Messages from multiple publishers
150,000 bytes
1,024 bytes
Guaranteed List(Message Buffer)
PsGuarMsgBufferSize
18
Durable Subscribers Disconnected
Database Parameters DbConnectJdbcDriver etc.
PsDbQueueSize
Messages from many publishers, targeted for many
disconnected durable subscribers
500,000 bytes
DB classes
Database
(i.e. Long-term Storage Pub/Sub)
19
Durable Subscribers Reconnecting
WaitMsgBufferSize
OutgoingMsgBufferSize
BROKER_CONNECTION_BUFFERS.AGENT_SENDER_OUTPUT_BUF
FER_SIZE
75,000 bytes
TCP/IP (network)
Messages from multiple publishers
JMSClient
Message Buffer
Output Buffer
Guaranteed List
Reconnect Logic
PsGuarMsgBufferSize
BROKER_PUBSUB_PARAMETERS. THROTTLE_PUBS_DURING_RES
TORE
BROKER_PUBSUB_PARAMETERS.RESTORE_MSGS_FC_COUNT
20
Queues
QueueSaveThreshold
QueueMaxSize
QueueDeliveryThreads
TCP/IP (network)
Messages from multiple senders
1,024 bytes
Queue (on disk)
Queue (in memory)
Message Buffer
BROKER_CONNECTION_BUFFERS.AGENT_SENDER_OUTPUT_BUF
FER_SIZE
21
Long-term Storage Point-to-Point
Database Parameters DbConnectJdbcDriver
PtpDbQueueSize
Messages from many senders for Queues exceeding
their QueueSaveThreshold
500,000 bytes
DB classes
Database
22
Transactions
TxnPrimaryThreads
TxnBufferSize
Messages from one transacted session
Delivery(Normal) Processing
Txncommit/ rollback
Message Buffer(32K)
BROKER_TXN_PARAMETERS.TXN_FLUSH_THREADS
file-based transaction
23
Message Buffers and Priorities
OutgoingMsgBufferSize150K
Messages from multiple publishers using
different JMS priorities
TCP/IP (network)
Message Buffer
Output Buffer
low priority publishers flow-controlled first
Normal JMS Priority occurs in the middle
Publishers sending high priority message flow
controlled here
24
Tuning and Message Size
  • Big Messages
  • dominated by disk and network speed
  • Only tune parameters that matter
  • Quality of Service
  • Messaging Domain
  • Large Buffers may increase latency
  • Small Buffers
  • will not cause failures
  • may reduce concurrent processing

25
Agenda
  • General Comments
  • Background and Tradeoffs
  • Key Configuration Parameters
  • Where to Create Configurations
  • Putting it all Together
  • Summary and Questions

26
Sonic Management Console
  • Mange Tab
  • Broker Component
  • Restart Broker
  • For broker properties
  • Re-initialize storage
  • For Recovery Log and Database properties
  • Use Templates for large deployments

27
Setting Tuning Parameters
  • Sonic Management Console
  • Broker Properties
  • Advanced Properties
  • Queues Properties
  • Sonic Management API

28
Sonic Management Console
29
Storage Parameters
30
Subscriber Parameters

OutgoingMsgBufferSize
PsGuarMsgBufferSize
WaitMsgBufferSize
31
Queue Properties
Broker-wide Queues Properties
Properties on Individual Queues
32
Transaction Parameters

TxnPrimaryThreads

TxnSecondaryThreads

TxnBufferSize

33
Sonic Management API
  • APIs to support configurations through
  • Programming
  • Scripting
  • package com.sonicsw.mq.mgmtapi
  • IBrokerBean
  • IQueuesBean

34
Sonic Management API Example
import com.sonicsw.mq.mgmtapi.config. MQMgmtBea
nFactory domain IBrokerBean bb IBrokerBean.ITuni
ngParametersType params   // Get the broker
config domain new MQMgmtBeanFactory() domain.co
nnect("Domain1","tcp//localhost2506","User","pwd
") // Load the Broker Bean for broker with the
view name // "/Brokers/Broker1" bb
domain.getBrokerBean("/Brokers/Broker1") params
bb.getConnectionTuningParameters() // Make
sure Nagle algorithm is disabled
(TcpNodelaytrue)if (!params.getTcpNodelay())
params.setTcpNodelay(true)  // When done, save
changes domain.saveBrokerBean(bb)
35
Sonic Management API Example
import com.sonicsw.mq.mgmtapi.config. MQMgmtBea
nFactory domain IBrokerBean bb IBrokerBean.ITuni
ngParametersType params   // Get the broker
config domain new MQMgmtBeanFactory() domain.co
nnect("Domain1","tcp//localhost2506","User","pwd
") // Load the Broker Bean for broker with the
view name // Then get the Recovery Log
parameters bb domain.getBrokerBean("/Brokers/Bro
ker1")params bb.getBrokerRecoveryLogParameters
() // Set the RECOVERY_LOG_FLUSH_DELAY to
0 params.setIntegerAttribute(RECOVERY_LOG_FLUSH_D
ELAY, 0)   // When done, save
changes domain.saveBrokerBean(bb)
36
Agenda
  • General Comments
  • Background and Tradeoffs
  • Key Configuration Parameters
  • Where to Create Configurations
  • Putting it all Together
  • Summary and Questions

37
What we do -- Revisited
  • Which parameters apply in different scenarios

SonicMQ Broker

Producer

Consumer

38
Pub/Sub Non-Durable
SonicMQ Broker
Publisher
Subscriber
Subscribers
?
OutgoingMsgBufferSize
publish()
1,000 K
receive
1K
150 K
All subscribers have a buffer. Non-Durables can
always use this!
Each publish() must wait for broker to check
security (and PERSIST, if necessary)
39
Pub/Sub Non-Durable, No Security
(or NON_PERSISTENT_ASYNC)
SonicMQ Broker
Publisher
Subscriber
Subscribers
OutgoingMsgBufferSize
250K
1,000 K
publish()
receive
1K
150 K
If no security and NON_PERSISTENT, or
NON_PERSISENT_ASYNC, many publishes can occur
before anything has reached broker.
40
Pub/Sub Connected Durable
SonicMQ Broker
Dur. Subs Connected
OutgoingMsgBufferSize
Publisher
1K
75K
Subscriber
?
publish()
150 K
?
receive
ack
PsGuarMsgBufferSize
Disk speed is KEY!
Used if ASYNC delivery
RecoveryLogPath
41
Pub/Sub Durables
SonicMQ Broker
Subscriber
Dur. Sub Connected
?
receive
OutgoingMsgBufferSize
ack
1K
75K
Publisher
150 K
DbConnect
?
publish()
PsGuarMsgBufferSize
Dur. Sub Disconnected
PsDbQueueSize
Disk speed is KEY!
db
500 K
there is also the Reconnect Case
RecoveryLogPath
42
Queues NON_PERSISTENT
(and below QueueSaveThreshold)
SonicMQ Broker
Queues
Sender
QueueMaxSize lt QueueSaveThreshold
n/a
send()
1,000K
1K
n/a
QueueDeliveryThreads
Not used hereQueue Receivers pull messages
Cant use this send always checks for existence
of Queue!
43
Queues PERSISTENT sends()
(and below QueueSaveThreshold)
SonicMQ Broker
Queues
Sender
QueueMaxSize lt QueueSaveThreshold
n/a
send()
1,000K
1K
n/a
QueueDeliveryThreads
Disk speed is KEY!
RecoveryLogPath
44
Queues
SonicMQ Broker
Queues
QueueMaxSize
QueueSaveThreshold
1K
n/a
Sender
DbConnect
QueueDeliveryThreads
n/a
send()
Long-term Store PTP
PtpDbQueueSize
Disk speed is KEY!
db
500 K
RecoveryLogPath
45
Key Parameters
P/Snon-durable
P/S durable
PTP
Transacted
DRA
Message Size
Parameter
lt1K
20K
250K
OutgoingMsgBufferSize
1st
2nd
50K
150K
500K
PsGuarMsgBufferSize
1st
2nd
75K
150K
500K
WaitMsgBufferSize
1st
100K
250K
50K
PsDbQueueSize
2nd
1M
5M
Dflt
PtpDbQueueSize
2nd
1M
5M
Dflt
QueueDeliveryThreads
1st
10
10
5
Save Threshold
1st
5M
5M
1M
Maximum Size
1st
1M
10M
100M
RecoveryLogMaxFileSize
1st
1st
2nd
1st
Dflt
100M
1G
Dflt
RecoveryLogQueueSize
1st
Dflt
1M
DMQ Max. Size
2nd
1st
1M
10M
100M
Routing Queue Max.Size
1st
Dflt
1M
10M
TxnBufferSize
1st
32K
SizeN
SizeN
46
Agenda
  • General Comments
  • Background and Tradeoffs
  • Key Configuration Parameters
  • Where to Create Configurations
  • Putting it all Together
  • Summary and Questions

47
Final Points
  • Dont tune without some test
  • See Benchmarking white-paper
  • Know what you are testing
  • Latency
  • Throughput
  • Client or Broker
  • Application Design
  • Your biggest point of leverage
  • Configuration only FINE-TUNES performance

48
Further Reading
  • SonicSoftware Developers Exchange
  • http//www.sonicsoftware.com/cgi-bin/sonic.cgi/dx_
    prime.w
  • Select Code Shares
  • Click SonicMQ/Performance and Benchmarks
  • Download
  • SonicMQ V5 Tuning Guide
  • Benchmarking JMS Based E-Business Messaging
    Providers

49
Obligatory Quote
50
!
Allquestionsanswered
51
www.sonicsoftware.com
Write a Comment
User Comments (0)
About PowerShow.com