toi wls jms 10.3.4 / ps3 partitioned distributed topics & mdbs aka parallel ha for topics jan...
TRANSCRIPT
<Insert Picture Here>
TOI WLS JMS 10.3.4 / PS3Partitioned 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.
____.________JMS Connection Factory is a RMI Cluster Aware stub.
FE* objects contain client state.
____.________Connection Factory
JMSConnection, JMSSession,
JMSConsumer, JMSProducer
FEConnection
FESessionFEProducer
FEConsumer
Sample Internal JMS flows(Threads, RMI, Messaging Kernel)
Client or Server JVM Thread: call()
Blocking call
AsyncResponse FutureResult non-blocking call
JMS Server Blue Queue Async
Messaging KernelAsync
FEConnectionFESession
Introduce Distributed DestinationsSample Internal JMS flows
Client or Server JVM Thread: call()
Select Distributed Destination Member by Load Balancing and Consumer counts
Async
JMS Server BlueMember Async
Messaging Kernel
Messaging KernelAsync
Async
JMS Server RedMember
FEConnectionFESession
Distributed Topics always Forward before WLS 10.3.4 PS3
Client or Server JVM Thread: call()
Messages forwarded between all Distributed Topic Members
Async
JMS Server BlueMember Async
Messaging Kernel
Messaging KernelAsync
Async
JMS Server RedMember
FEConnectionFESession
What’s Coming in JMS in WebLogic Server 11gR1 PS3
Partitioned Distributed Topics
• No forwarding between topic members
• Messages are load balanced similar to a distributed queue
• Better matches MDB and application deployment strategies across a cluster
Destination Availability Helper APIs
Shared Durable Subscriptions
Relaxed Client ID Restrictions
New JMS PS3 features1) 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 features2) 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 features3) 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-durableClient-responsible-for-ack disabled for shared subs
Performance impact on non-durable, non-UOO, non-transactional topic subscribers
PS3 MDBs may automatically activate this feature
New JMS PS3 features4) 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 features5) Full MDB Support for WebLogic Topics
Single “mode” annotation for both RDTs and PDTsAutomatically 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 featuresClient Interfaces
WLConnection setClientIDPolicy()/getClientIDPolicy()
setSubscriptionSharingPolicy()/getSubscriptionSharingPolicy()
WLSession Unsubscribe(Topic topic, String name)
New JMS PS3 featuresJMSDestinationAvailabilityHelper 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 featuresJMSDestinationAvailabilityHelper 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 featuresProduct 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 featuresProduct 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 featuresProduct 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 featuresProduct code location and classes (10.3.4)
${SRC}/wls/weblogic/ejb/container/ deployer/MessageDrivenBeanInfoImpl
internal/JMSConnectionPoller
manager/MessageDrivenManager
Cluster
Server 1 Server 2 Server 3
DT Member 1
DT Member 2
DT Member 3
12
3
Publish
Distributed Topic
New Topic ArchitectureLocal Case
Start with a cluster and a Partitioned Uniform Distributed Topic (UDT)
Start with a cluster and a Partitioned Uniform Distributed Topic (UDT)
Publish to the UDT.
Messages are load-balanced
Publish to the UDT.
Messages are load-balanced
NO message forwarding!NO message forwarding!
MDB MDB MDB
MDBs are deployed to the cluster.MDBs are deployed to the cluster.
Each MDB creates a subscription on the UDT.
Each MDB creates a subscription on the UDT.
Subscription SubscriptionSubscription
Messages are processed in parallel; no duplicate processing.
Messages are processed in parallel; no duplicate processing.
• Basis for Event-Driven Messaging
• Parallelism for performance and scalability
• Simplified configuration
Cluster
Server 1 Server 2 Server 3
DT Member 1
DT Member 2
DT Member 3
Distributed Topic
Expand CapacityWhole Cluster
MDB MDB MDB
Subscription SubscriptionSubscription
Server 4
DT Member 4
MDB
Subscription
Add a server with a JMS server to the cluster
Add a server with a JMS server to the cluster
The UDT automatically expandsThe UDT automatically expandsThe MDB container creates an MDB poolThe MDB container creates an MDB pool
Distributed Topic
The MDB creates a subscription on the UDTThe MDB creates a subscription on the UDTMessages are load-balanced to Server 4Messages are load-balanced to Server 4
1 2 3 4
5 6 7 8
• Architectural flexibility
• Neither the publisher nor subscriber needs to know the architecture of the DT or cluster
• MDB container automatically adapts to topology changes
Cluster
Server 1 Server 2 Server 3
DT Member 1
DT Member 2
DT Member 3
Expand CapacityAdd Subscribers
Subscription SubscriptionSubscription
Server 4
DT Member 4
Subscription
Deploy another MDB to the clusterDeploy another MDB to the cluster
Distributed Topic
MDB 2 MDB 2 MDB 2 MDB 2
The MDB creates its own UDT subscriptionThe MDB creates its own UDT subscription
MDB MDB MDB MDB
Subscription 2 Subscription 2Subscription 2Subscription 2
Each sub/MDB gets a copy of the messageEach sub/MDB gets a copy of the message
1 2 3 4
5 6 7 8
1 2 3 4
5 6 7 8
• Event Driven SOA/Looser Coupling – Add subscribers without any dependency on publishers
• Parallelism for scalability and performance
Cluster 1
Cluster 2
Server 1
DT Member 1
DT Member 2
DT Member 3
Publish
New Topic ArchitectureRemote Case
Same starting point: a cluster and a Uniform Distributed Topic (UDT)
Same starting point: a cluster and a Uniform Distributed Topic (UDT)
Publish to the UDT.
Messages are load-balanced
Publish to the UDT.
Messages are load-balanced
MDB The MDB container creates a sub on each member of the UDT
The MDB container creates a sub on each member of the UDT
Subscription
MDB gets messages from all UDT membersMDB gets messages from all UDT members
Subscription Subscription
Distributed Topic
12
3
NO message forwarding!NO message forwarding!
Deploy an MDB to a remote server/cluster with a sub on the UDT
Deploy an MDB to a remote server/cluster with a sub on the UDT
• Parallelism for performance and scalability
• Architectural flexibility
• Adaptability, no dependency on architecture
• Simplified configuration
Subscription
Cluster 1
Cluster 2
Server 1
DT Member 1
DT Member 2
DT Member 3
1 2 3
Publish
New Topic ArchitectureRemote Cluster Case
Same starting point: a cluster and a Uniform Distributed Topic (UDT)
Same starting point: a cluster and a Uniform Distributed Topic (UDT)
Publish to the UDT.
Messages are load-balanced
Publish to the UDT.
Messages are load-balanced
MDB MDB Container requests shared subscriptions
MDB Container requests shared subscriptions
MDBs subscribe to the UDTMDBs subscribe to the UDT
Shared Sub
Message processing is load balanced between all MDB pools
Message processing is load balanced between all MDB pools
Shared Sub Shared Sub
Distributed Topic
15
9
Server 2 Server 3
MDB MDB
4 5 67 8 9
24
6
37
8
• Parallelism for performance and scalability
• Architectural flexibility
• Adaptability, no dependency on architecture
• Simplified configuration
Location 1
DT Member 2
Publish
Unit of Orderon Shared Subscription
All of the subscriptions from a MDB on a PDT act as a Dist Queue
All of the subscriptions from a MDB on a PDT act as a Dist Queue
A Shared Subscription is like a single queue with many consumers
A Shared Subscription is like a single queue with many consumers
MDB MDB consumers access resources without conflicting UOO Id
MDB consumers access resources without conflicting UOO Id
Messages in the same Unit of Order go to one Session or Transaction
Messages in the same Unit of Order go to one Session or Transaction
Caveat: Same selector MDB X&Y on same PDT will get same msgs
Caveat: Same selector MDB X&Y on same PDT will get same msgs
Shared Sub
15
9
Location 2 Location 3
MDB MDB
24
6
37
8
• Many MDB threads, multiple transactions, multiple servers, without contention on Unit of Order ID resources
• When UOO ID is Database Key, no contention
X
Cluster 1
Cluster 2
Server 1
DT Member 1
DT Member 2
DT Member 3
1 2 3
Publish
New Topic ArchitectureRemote Cluster Expansion
MDB
Shared Sub Shared Sub Shared Sub
15
9
Server 2 Server 3
MDB MDB
5 67 8
24
6
37
8
Messaging host cluster expands, subscribers react
Messaging host cluster expands, subscribers react
Distributed Topic
DT Member 4
Shared Sub
4 9
• Parallelism for performance and scalability
• Architectural flexibility
• Adaptability, no dependency on architecture
• Simplified configuration
Cluster 1
Cluster 2
Server 1
DT Member 1
DT Member 2
DT Member 3
1 2 3
Publish
New Topic ArchitectureRemote Cluster Expansion 2
MDB
Shared Sub Shared Sub Shared Sub
1
9
Server 2 Server 3
MDB MDB
5 67 8
24
6
37
Messaging subscriber cluster expands, container manages shared subs
Messaging subscriber cluster expands, container manages shared subs
Distributed Topic
DT Member 4
Shared Sub
4 9
Server 4
MDB
58
• Parallelism for performance and scalability
• Architectural flexibility
• Adaptability, no dependency on architecture
• Simplified configuration
Cluster 1
Cluster 2
Server 1
DT Member 1
DT Member 2
DT Member 3
1 2 3
Publish
New Topic ArchitectureAdd Competing Subscribers
MDB
Shared Sub Shared Sub Shared Sub
Server 2 Server 3
MDB MDB
5 67 8
24
63
7
Distributed Topic
DT Member 4
Shared Sub
4 9
Server 4
MDB 5
8
MDB 2 MDB 2 MDB 2 MDB 2
1
9
58
1
9
24
6
37
Each sub/MDB gets a copy of the messageEach sub/MDB gets a copy of the message
• Event-Driven SOA/Looser Coupling – Add subscribers without any dependency on publishers
• Parallelism for scalability and performance
What’s Coming in JMS in WebLogic Server 11gR1 PS3
Partitioned Distributed Topics
• No forwarding between topic members
• Messages are load balanced similar to a distributed queue
• Better matches MDB and application deployment strategies across a cluster
Destination Availability Helper APIs
Shared Durable Subscriptions
Relaxed Client ID Restrictions
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 DTA consumer is still pinned to a memberNeed to create consumers for all members when
application boots and when new members come onlineConsider 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 TopicDurable 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