TOI-JMS-10.3.4.PS3

advertisement
<Insert Picture Here>
TOI WLS JMS 10.3.4 / PS3
Partitioned Distributed Topics &
MDBs aka Parallel HA for Topics Jan 20 2011
Version: 7m
Recommended Reading 1 of 2
 Trainees: Pre-release 10.3.4 edocs list. Will update
JMS wiki docs
 If needed, Chapter 2, "Understanding WebLogic JMS,"
provides an overview of the Java Message Service.
 Many of our customers do not get correct guidance.
 JMS Config Best Practices
 JMS Chapter of Perf Guide
 MDB Chapter of Perf Guide
Recommended Reading 2 of 2
 Trainees: Pre-release 10.3.4 edocs list. Will update
JMS wiki docs
 Configuring and using new features
Partitioned Dist Topics, Unrestricted ClientID, Shared Subs,
and Strategies for MDBs Using Distributed Topics
 WebLogic Messaging High Availability Features
 Using the JMS Destination Availability Helper API
 Optional
 Config Beans JMS Connection Factory , Uniform Dist Topic
 Runtime Beans Connection , Consumer , Subscription
Best Practices that are not always applied!
Encourage customers to repair these situations:
 Uniquely name different WebLogic domains & servers
 Even if two servers are in two different domains, they must
have different names – otherwise JMS and JTA operations can
fail. Also applies to JMS Servers and SAF Agents …
 Always configure Quotas to avoid OutOfMemory
 Every message header takes server memory, eventually if
consumers do not keep up with producers, server will OOM
(see JMS Chapter of Perf Guide)
 Always use advanced targeting for destinations
 Ensure they end up on the exact intended JMS Server or SAF
Agent (see JMS Config Best Practices)
If there is a production store emergency,
please escalate to get expertise from JMS
Sustaining Engineering
 If a server is unable to boot due to store corruption then the store admin
tool will also fail to work. If store corruption exists:
 Avoid restarting with a new store if possible. It’s very hard to combine
recovered data into the new store.
 To get their production system back online, Immediately:
 Obtain a copy of the problem store file or DB table dump.
 Obtain entire WLS config
 Pass config and store data to Sustaining Engineering for them to
attempt data recovery. This is a very time consuming manual
operation, but it is currently the only means of data recovery.
 Field engineers have tried to reverse engineer using the store admin tool
and the tooling to merge an old store into the new store does not exist.
Sample Internal JMS flows
(JNDI and RMI)
Client look up JMS
ConnectionFactory+
Destination in JNDI.
JMSConnection,
JMSSession,
JMSConsumer,
JMSProducer
____.________
____.________
Connection Factory
JMS
Connection
Factory is a
RMI Cluster
Aware stub.
FEConnection
FESession
FEProducer
FEConsumer
FE* objects
contain client
state.
Sample Internal JMS flows
(Threads, RMI, Messaging Kernel)
JMS Server
Blue Queue
Blocking call
Client or Server
JVM Thread: call()
Async
Messaging
Kernel
Async
AsyncResponse
FutureResult
non-blocking call
FEConnection
FESession
Introduce Distributed Destinations
Sample Internal JMS flows
JMS Server
BlueMember
Client or Server
JVM Thread: call()
Async
FEConnection
FESession
JMS Server
RedMember
Async
Messaging
Kernel
Async
Select Distributed
Destination Member
by Load Balancing
and Consumer counts
Messaging
Kernel
Async
Distributed Topics always Forward
before WLS 10.3.4 PS3
JMS Server
BlueMember
Client or Server
JVM Thread: call()
Async
FEConnection
FESession
JMS Server
RedMember
Async
Messaging
Kernel
Async
Messages forwarded
between all
Distributed Topic
Members
Messaging
Kernel
Async
What’s Coming in JMS in WebLogic Server 11gR1
PS3
Partitioned Distributed
Topics
Shared Durable
Subscriptions
• Better matches MDB and
application deployment
strategies across a cluster
Relaxed Client ID
Restrictions
Destination Availability Helper APIs
SOA JMS Adapter
Enhancements
• Messages are load balanced
similar to a distributed queue
MDB Enhancements
• No forwarding between topic
members
New JMS PS3 features
1) PartitionedDistributedTopic (PDT)
 New PDT does not forward messages between topic members
 Old “Replicated” Distributed Topic (PDT) forward every message
 ForwardingPolicy on <uniform-distributed-topic>
 “Replicated” (default, old behavior)
 “Partitioned”
 PDT Messages are load balanced similar to a distributed queue
 PDT matches cluster MDB and application deployment strategies
 Applications can add “NOT JMS_WL_DDForwarded” to consumer
selector for PDT behavior on a RDT
 PS3 MDBs may automatically add this selector as needed
New JMS PS3 features
2) Unrestricted ClientID
 An extension to JMS Standard
 Multiple JMS connections can use the same ClientID
 ClientIDPolicy on JMSConnectionFactoryBean.ClientParamsBean
 Restricted (default, old behavior)
 Unrestricted
 Allow same Name in Restricted and Unrestricted mode
 They are independent and not equal
 Restricted ClientID bound into JNDI, unrestricted one does not
 unsubscribe in Unrestricted mode
 Need to use an extension API
 (Member) destination object is required!
 PS3 MDBs may automatically activate this feature
New JMS PS3 features
3) Shared Subscriptions
 Multiple consumers can process messages in parallel
from a single subscription
 treated as a queue with multiple consumers
 SubscriptionSharingPolicy on
JMSConnectionFactoryBean.ClientParamsBean
 Exclusive (default)
 Sharable
 Applies to both durable and non-durable
 Client-responsible-for-ack disabled for shared subs
 Performance impact on non-durable, non-UOO, nontransactional topic subscribers
PS3 MDBs may automatically activate this feature
New JMS PS3 features
4) JMSDestinationAvailabilityHelper
 A register/notification mechanism for DD member
availability notifications
 Help to have a full consumption coverage among all
active DD members
 Help to react on cluster topology changes.
 Help to work around some security issues using
Foreign JMS server
 Used by MDB container and SOA Adapter container
New JMS PS3 features
5) Full MDB Support for WebLogic Topics
 Single “mode” annotation for both RDTs and PDTs
 Automatically enable two new patterns
 “one copy per application”
 “one copy per server”
 New modes automatically enable new JMS features
described on previous slides.
 Programmer’s guide heavily updated, includes:





Sample code
Full chapter on working with topics, including topic patterns
Single table enumerating all attributes and annotations.
Appendix with diagrams for new distributed topic patterns
Highly recommended reading
New JMS PS3 features
Client Interfaces
 WLConnection
 setClientIDPolicy()/getClientIDPolicy()
 setSubscriptionSharingPolicy()/getSubscriptionSharingPolicy()
 WLSession
 Unsubscribe(Topic topic, String name)
New JMS PS3 features
JMSDestinationAvailabilityHelper interfaces
 JMSDestinationAvailabilityHelper
 public RegistrationHandle register(Hashtable properties,
String destJNDIName,DestinationAvailabilityListener listener);
 RegistrationHandle




void unregister()
lookupConnectionFactory(String jndiName)
lookupDestination(String jndiName)
runAs(PrivilegedExceptionAction action)
 DestinationAvailabilityListener
 onDestinationsAvailable(String destJNDIName,
List<DestinationDetail>)
 onDestinationsUnavailable(String destJNDIName,
List<DestinationDetail>)
 onFailure(String destJNDIName, Exception exception)
New JMS PS3 features
JMSDestinationAvailabilityHelper interfaces
 DestinationDetail











Type (RDT, PDT, DQ, standalone topic, 3rd party topic)
JNDIName (member’s)
Destination
WLSServerName
JMSServerName
MigratableTargetName
CreateDestinationArgument
StoreName
isAdvancedTopicSupported
isLocalWLSServer
isLocalCluster
New JMS PS3 features
Product code location and classes (10.3.4)
 ${SRC}/wls/weblogic/jms/extensions/
 JMSDestinationAvailabilityHelper
 DestinationAvailabilityListener
 DestinationDetail
 DestinationDetailImpl
 RegistrationHandle
 ${SRC}/wls/weblogic/jms/common/
 CDS* (10.3.*)
 CDSSecurityHandle (new in 10.3.4)
JMS PS3 features
Product code location and classes (10.3.*)
 ${SRC}/wls/weblogic/jms/backend/udd/
 SyntheticDTBean
 SyntheticDestinationBean
 UDDEntity
 ${SRC}/wls/weblogic/jms/dd/
 DDHandler
 ${SRC}/wls/weblogic/jms/common/




JMSLoadBalancer
JMSSQLExpression
JMSSQLFilter
JMSVariableBinder
JMS PS3 features
Product code location and classes (10.3.*)
 ${SRC}/wls/weblogic/jms/backend/
 BETopicImpl
 BEConsumerImpl
 BESessionImpl
 ${SRC}/wls/weblogic/jms/frontend/
 FEConsumer
 FEConnection
 FESession
 ${SRC}/wls/weblogic/jms/client/
 WLConnection and JMSConnection
 WLSession and JMSSession
Additional MDB JMS PS3 features
Product code location and classes (10.3.4)
 ${SRC}/wls/weblogic/ejb/container/
 deployer/MessageDrivenBeanInfoImpl
 internal/JMSConnectionPoller
 manager/MessageDrivenManager
New Topic
Architecture
Local Case
Start with a cluster and
a Partitioned Uniform
Distributed Topic (UDT)
3
• Basis for Event-Driven
Messaging
2
1
• Parallelism for performance
and scalability
• Simplified configuration
Publish
DT Member
1
DT Member
2
DT Member
3
Publish to the UDT.
Messages are loadbalanced
Distributed Topic
Subscription
Subscription
Subscription
MDB
MDB
MDB
Server 1
Server 2
Server 3
NO message
MDBs
are deployed to
forwarding!
the cluster.
Each MDB creates a
subscription on the
UDT.
Messages are
processed in parallel; no
duplicate processing.
Cluster
Expand Capacity
• Architectural flexibility
Whole Cluster
• Neither the publisher nor subscriber needs to
know the architecture of the DT or cluster
• MDB container automatically adapts to
topology changes
Messages
The
UDT
automatically
container
creates
arewith
loadAdd MDB
a server
a JMS
expands
creates
subscription
balanced
toMDB
Server
on
the
pool
UDT
4
server toan
the
cluster
DT Member
4
DT Member
1
DT Member
2
DT Member
3
Distributed Topic
Distributed Topic
Subscription
Subscription
Subscription
Subscription
MDB
MDB
MDB
MDB
1
2
5
Server 4
Cluster
3
6
Server 1
4
7
Server 2
8
Server 3
Expand Capacity
Add Subscribers
Deploy
another
MDB
The MDB
creates
itsato
Each
sub/MDB
gets
the
cluster
own UDT
copy
of thesubscription
message
DT Member
4
• Event Driven SOA/Looser Coupling – Add
subscribers without any dependency on
publishers
• Parallelism for scalability and performance
DT Member
1
DT Member
2
DT Member
3
Subscription
Subscription
Distributed Topic
Subscription
Subscription
Subscription 2
MDB 1
Subscription 2
MDB 2
MDB
5
MDB 2
MDB 2
Cluster
MDB
MDB 2
6
Server 1
4
7
2
5
Subscription 2
3
6
1
Server 4
Subscription 2
8
MDB 2
3
7
Server 2
4
8
Server 3
New Topic
Architecture
Remote Case
• Parallelism for3performance and scalability
2
• Architectural flexibility
1
• Adaptability, no dependency on architecture
Publish
• Simplified configuration
Same starting point: a
cluster and a Uniform
Distributed Topic (UDT)
DT Member
1
DT Member
2
DT Member
3
Subscription
Subscription
Subscription
Publish to the UDT.
Messages are loadbalanced
Distributed Topic
Deploy an MDB to a
NO message
remote server/cluster
forwarding!
with a sub on the UDT
Cluster 1
Subscription
The MDB container
creates a sub on each
member of the UDT
MDB
MDB gets messages
from all UDT members
Server 1
Cluster 2
New Topic Architecture
• Parallelism for performance and scalability
Remote Cluster Case • Architectural flexibility
• Adaptability, no dependency on architecture
Publish
• Simplified configuration
Same starting point: a
cluster and a Uniform
Distributed Topic (UDT)
DT Member
1
Publish to the UDT.
1
Messages are loadbalanced
Shared Sub
4
7
DT Member
2
2
5
8
Shared Sub
DT Member
3
3
6
9
Shared Sub
Distributed Topic
MDBs subscribe to the
UDT
MDB Container
requests shared
subscriptions
Message processing is
load balanced between
all MDB pools
Cluster 1
MDB
1
5
MDB
2
9
Server 1
Cluster 2
4
MDB
3
6
Server 2
7
8
Server 3
Unit of Order
• Many MDB threads, multiple transactions,
multiple servers, without contention on Unit
of Order ID resources
on Shared Subscription
• When UOO ID is
Database Key, no contention
Publish
All of the subscriptions
from a MDB on a PDT
act as a Dist Queue
DT Member
2
A Shared Subscription
is like a single queue
with many consumers
Shared Sub
Messages in the same
Unit of Order go to one
Session or Transaction
MDB consumers access
resources without
conflicting UOO Id
Caveat: Same selector
MDB X&Y on same PDT
will get same msgs
MDB
1
5
MDB
2
9
Location 1
4
MDB
3
6
X
Location 2
7
8
Location 3
New Topic Architecture
• Parallelism for performance and scalability
Remote Cluster Expansion
• Architectural flexibility
• Adaptability, no dependency on architecture
Messaging host cluster
expands, subscribers
react
DT Member
4
4
9
Shared Sub
Publish
• Simplified configuration
DT Member
1
1
7
DT Member
2
2
Shared Sub
5
8
DT Member
3
3
6
Shared Sub
Shared Sub
MDB
MDB
Distributed Topic
Cluster 1
MDB
1
5
2
9
Server 1
Cluster 2
4
3
6
Server 2
7
8
Server 3
New Topic Architecture
• Parallelism for performance and scalability
Remote Cluster Expansion 2 • Architectural flexibility
• Adaptability, no dependency on architecture
Messaging subscriber
cluster expands, container
manages shared subs
DT Member
4
4
9
Shared Sub
Publish
• Simplified configuration
DT Member
1
1
7
DT Member
2
2
Shared Sub
5
8
DT Member
3
3
6
Shared Sub
Shared Sub
MDB
MDB
Distributed Topic
Cluster 1
MDB
5
MDB
1
8
Server 4
Cluster 2
2
9
Server 1
4
3
6
Server 2
7
Server 3
New Topic Architecture
• Event-Driven SOA/Looser Coupling – Add
Add Competing Subscribers subscribers without any dependency on
publishers
Each sub/MDB gets a copy
of the message
DT Member
1
DT Member
4
4
• Parallelism for Publish
scalability and performance
1
9
DT Member
2
7
2
Shared Sub
Shared Sub
5
DT Member
3
8
3
Shared Sub
6
Shared Sub
Distributed Topic
Cluster 1
MDB
MDB 2
Server 4
Cluster 2
MDB 1
5
8
5
MDB 2
4
9
MDB 2
8
MDB 2
1
Server 1
9
2
Server 2
MDB
MDB 2
4
3
6
6
3
Server 3
7
7
What’s Coming in JMS in WebLogic Server 11gR1
PS3
Partitioned Distributed
Topics
Shared Durable
Subscriptions
• Better matches MDB and
application deployment
strategies across a cluster
Relaxed Client ID
Restrictions
Destination Availability Helper APIs
SOA JMS Adapter
Enhancements
• Messages are load balanced
similar to a distributed queue
MDB Enhancements
• No forwarding between topic
members
Benefits
 Support for new patterns and trends
 Event-Driven SOA
 Looser coupling
 Increased flexibility
 Fire and forget
 Add new subscribers more easily
 Ease of use
 Simplified MDB configuration, common cluster model
 Improved overall system performance through better
support for parallelization
 Parallel processing across a cluster
 Multi-threaded processing for transactional subscriptions – up
to 16X
Combination of Features Enables MDB Ease
Of Use
 Parallelism - Avoid duplicated processing
 Simplified model - Subscribe to Distributed Topic instead of DT member
 Dynamically adjust to DT membership
 Local MDB deployment: create MDB pools only where DT members are
hosted
 Remote MDB deployment: automatically create/destroy subscriptions as DT
members come and go
 MDB Activation Properties control/fine tune behavior
 topicMessageDistributionMode – One copy per application, one copy per
server, or compatibility
 distributedDestinationConnection – Local only or every member (fine tuning
use only)
 You can still get the old behavior with partitioned distributed topics by tuning
these parameters
 Two necessary switches: DT Forwarding Policy and MDB
topicMessageDistributionMode activation property
MDB Activation Example
//import statements
@MessageDriven(
name = "MyMDBAppName",
mappedName = "MyDistTopic",
activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "subscriptionDurability",
propertyValue = "Durable"),
@ActivationConfigProperty(propertyName = "topicMessagesDistributionMode“,
propertyValue = "One-Copy-Per-Application")
// propertyValue = "One-Copy-Per-Server ")
// optional tuning
// @ActivationConfigProperty(propertyName = "distributedDestinationConnection",
//
propertyValue = "EveryMember")
})
public class MyMDB implements MessageListener {
…
Best MDB Practices
 Local RDTs with Durable MDBs
 One-copy-per-application/One-copy-per-server with LocalOnly
 Ensure each WebLogic Server in the cluster hosts exactly one
member of the RDT.
 Do not use WebLogic JMS service-migration (unsupported)
 but can use "whole server migration”
 Not an issue with PDTs
 Compatibility Mode
 The same as above
 Always set generate-unique-client-id to true
Best MDB Practices (continued)
Caution when Changing Durable MDB Attributes
 May cause
 messages on current durable subscriptions to be deleted
 existing durable subscriptions to be abandoned/deleted/replaced
 Settings








topicMessagesDistributionMode
topic type
distributedDestinationConnection
generate-unique-client-id
subscription durability
ejb-name
client-id
selector
Best Practices When Consuming from WLS
JMS DDs
 Use MDB and SOA Adapter if possible
 Automatically create and close internal consumers across all
members of a DD as needed.
 They also handle
 Security
 Threading
 Pooling
 Application life cycle
 Automatic reconnect
 Transaction enlistment
When MDB or SOA Adapter are not available
 Still cannot create durable subscribers on a DT
 A consumer is still pinned to a member
 Need to create consumers for all members when
application boots and when new members come online
 Consider simple work around
 periodically restarting consumers to rebalance consumers
across a distributed queue.
 if messaging ordering and performance are not a concern,
enabling the distributed queue forwarding option.
 Use JMSDestinationAvailabilityHelper (advanced
users)
PS3 MDBs draining PS2 Destinations and
vice versa
 New MDB features require PS3 JMS destinations
 PS2 and earlier releases are supported, but without
the new features.
 A PS2 MDB draining a PS3 DD
 Doesn’t use PS3 features. It can not use Unrestricted
ClientID or Shared Subscriptions.
 Old behavior
 A PS3 MDB draining a PS2 DD
 Doesn’t use PS3 features. It can not use Unrestricted
ClientID or Shared Subscriptions.
 Set “topic message distribution mode” to Compatibility (the
default).
Uniform Distributed Topic
Durable Subscription Management
 Importance: We have uniform distributed topic durable
subscription management in the console for the first time.
This will help out users to manage subscriptions.
 We have added console pages to view and filter existing durable
subscription on uniform distributed Topic. Also added required
configurations for creating partitioned distributed topic.
 It is mainly designed for filtering your subscription on specific
distributed destination topic and view statistics on specific
subscription. Filtering capability will help user easily focus on
required subset of their subscriptions.
 Currently it does not allow user to create new durable subscription
on any member of uniform distributed topic.
Partitioned Topic
configuration parameters page
UDT Subscription Page Overview
Subscriptions details section of the page
Subscriptions : Advanced filtering
Details of subscription
Helpful debugging options
 JMS Debugging








-Dweblogic.Debug.DebugJMSBackEnd=true
-Dweblogic.Debug.DebugJMSFrontEnd=true
-Dweblogic.Debug.DebugJMSDispatcher=true
-Dweblogic.Debug.DebugJMSBoot=true
-Dweblogic.debug.DebugJMSCDS=true
-Dweblogic.debug.DebugJMSSAF=true
-Dweblogic.debug.DebugJMSDistTopic=true
-Dweblogic.debug.DebugJMSDurSub=true
 Messaging kernel debugging
 -Dweblogic.debug.DebugMessagingKernel=true
Helpful debugging options (continued)
 JTA debugging
 -Dweblogic.debug.DebugJTALLR=true
 -Dweblogic.debug.DebugJTAJDBC=true
 -Dweblogic.debug.DebugJTAXA=true
 -Dweblogic.debug.DebugJTANonXA=true
 -Dweblogic.debug.DebugJTATLOG=true
 -Dweblogic.debug.DebugJTAJDBC=true
 -Dweblogic.debug.DebugJTARecovery=true
 -Dweblogic.debug.DebugJTA2PC=true
Helpful debugging options (continued)
 Store debugging
 -Dweblogic.debug.DebugStoreAdmin=true
 -Dweblogic.debug.DebugStoreXA=true
 -Dweblogic.debug.DebugStoreXAVerbose=true
 -Dweblogic.debug.DebugStoreIOPhysical=true
 core/T3 debugging
 -Dweblogic.kernel.debug=true
 -Dweblogic.debug.DebugConnection=true
 -Dweblogic.debug.DebugMessaging=true
Helpful debugging options (continued)
 EJB/MDB debugging
 -Dweblogic.debug.DebugEjbDeployment=true
 -Dweblogic.debug.DebugEjbMdbConnection=true
 -Dweblogic.debug.DebugEjbSecurity=true
 JNDI debugging
 -Dweblogic.debug.DebugJNDI=true
 -Dweblogic.debug.DebugJNDIFactories=true
 -Dweblogic.debug.DebugJNDIResolution=true
Download