{"id":5392,"date":"2012-07-20T08:09:59","date_gmt":"2012-07-20T13:09:59","guid":{"rendered":"http:\/\/jianmingli.com\/wp\/?p=5392"},"modified":"2012-08-25T23:07:12","modified_gmt":"2012-08-26T04:07:12","slug":"1z0-102-managing-clusters","status":"publish","type":"post","link":"https:\/\/jianmingli.com\/wp\/?p=5392","title":{"rendered":"Managing WebLogic 11g Clusters"},"content":{"rendered":"<div class='toc wptoc'>\n<h2>Contents<\/h2>\n<ol class='toc-odd level-1'>\n\t<li>\n\t\t<a href=\"#Deploy_an_application_to_a_cluster\">Deploy an application to a cluster<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#Describe_the_replication_of_a_session_state_in_a_cluster\">Describe the replication of a session state in a cluster<\/a>\n\t\t<ol class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#HTTP_Session_Replication\">HTTP Session Replication<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#In_Memory_Replication\">In Memory Replication<\/a>\n\t\t\t<\/li>\n\t\t<\/ol>\n\t<li>\n\t\t<a href=\"#Configure_replication_groups\">Configure replication groups<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#Configure_in-memory_session_replication\">Configure in-memory session replication<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#Configure_Java_Database_Connectivity_JDBC_session_replication\">Configure Java Database Connectivity (JDBC) session replication<\/a>\n\t\t<ol class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Configure_JDBC_Persistence\">Configure JDBC Persistence<\/a>\n\t\t\t<\/li>\n\t\t<\/ol>\n\t<li>\n\t\t<a href=\"#Configure_file_session_replication\">Configure file session replication<\/a>\n\t\t<ol class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#HTTP_State_Management_Best_Practices\">HTTP State Management Best Practices<\/a>\n\t\t\t<\/li>\n\t\t<\/ol>\n\t<li>\n\t\t<a href=\"#Describe_state_replication_for_stateful_session_EJBs\">Describe state replication for stateful session EJBs<\/a>\n\t\t<ol class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Configure_Deployment_Descriptors\">Configure Deployment Descriptors<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Configure_EJB_Clustering_using_Admin_Console\">Configure EJB Clustering using Admin Console<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#EJB_Best_Practices\">EJB Best Practices<\/a>\n\t\t\t<\/li>\n<\/ol>\n<\/ol>\n<\/ol>\n<\/div>\n<div class='wptoc-end'>&nbsp;<\/div>\n<p><< <a href=\"?p=5375\">Previous<\/a><\/p>\n<span id=\"Deploy_an_application_to_a_cluster\"><h2>Deploy an application to a cluster<\/h2><\/span>\n<p>* Applications are deployed using the two phase deployment (TPD) approach:<br \/>\n&#8211; phase 1: distribute components\/modules to all server instances<br \/>\n&#8211; phase 2: if phase 1 succeed, applications are deployed to allow client access<br \/>\n* Relaxed deployment mode:<br \/>\n&#8211; if one or more server instances are not available\/reachable (these servers are called partitioned server), deployment continues to available server instances<br \/>\n&#8211; when partitioned servers become reachable, deployment starts on these servers (potential performance hit)<br \/>\n* Relaxed deployment mode can be disabled by setting <em>enforceClusterConstraints<\/em> to true with <em>weblogic.Deployer<\/em><br \/>\n* Production redeployment in a cluster<br \/>\n&#8211; may result in both older and new versions running simultaneously<br \/>\n&#8211; older version always fails to same older version (fail if none exists)<\/p>\n<span id=\"\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/wls11gadmin_cluster_deployapp_ac_1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/wls11gadmin_cluster_deployapp_ac_1-300x186.jpg\" alt=\"\" title=\"wls11gadmin_cluster_deployapp_ac_1\" width=\"300\" height=\"186\" class=\"aligncenter size-medium wp-image-5388\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/wls11gadmin_cluster_deployapp_ac_1-300x186.jpg 300w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/wls11gadmin_cluster_deployapp_ac_1.jpg 679w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/h6><\/span>\n<span id=\"Describe_the_replication_of_a_session_state_in_a_cluster\"><h2>Describe the replication of a session state in a cluster<\/h2><\/span>\n<span id=\"HTTP_Session_Replication\"><h3>HTTP Session Replication<\/h3><\/span>\n<p>* Supports:<br \/>\n&#8211; in-memory replication: each user session always exists in two servers (primary and secondary servers)<br \/>\n&#8211; JDBC persistence<br \/>\n&#8211; file persistence<br \/>\n* Configured within each web application<br \/>\n&#8211; in <em>weblogic.xml<\/em>: <em>session-descriptor<\/em><br \/>\n* All web servers should have identical configuration<br \/>\n* WLS also supports <em>AsyncRep<\/em> to improve cluster performance<\/p>\n<span id=\"In_Memory_Replication\"><h3>In Memory Replication<\/h3><\/span>\n<p>* WLS supports in memory replication for:<br \/>\n&#8211; HttpSession objects<br \/>\n&#8211; Statefull session beans<br \/>\n* Session objects exist only on two servers: primary server and secondary server<br \/>\n* Primary\/secondary servers are determined by replication group and machine definition<br \/>\n* Clients must access the cluster using one of the following:<br \/>\n&#8211; <em>WLS aware<\/em> hardware load balancer: LB must support SSL persistence and passive cookie persistence to allow cookie persistence between client and WLS<br \/>\n&#8211; OHS with <em>mod_wl_ohs<\/em><br \/>\n&#8211; One or more web servers with <em>WebLogic proxy plug-ins<\/em> configured identically (WebLogic proxy plug-ins <strong>only<\/strong> supports round robin load balancing)<br \/>\n&#8211; Oracle WebLogic Server configured with <em>HTTPClusterServlet<\/em><\/p>\n<span id=\"Configure_replication_groups\"><h2>Configure replication groups<\/h2><\/span>\n<p>* Logical grouping of related servers in a cluster<br \/>\n* Used to decide where to put in-memory backup objects (<em>preferred replication group<\/em>)<br \/>\n* Better than using machines since one physical computer may have multiple IP addresses (machines)<\/p>\n<span id=\"_1\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/wls11gadmin_replgrp_1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/wls11gadmin_replgrp_1-300x230.jpg\" alt=\"\" title=\"wls11gadmin_replgrp_1\" width=\"300\" height=\"230\" class=\"aligncenter size-medium wp-image-5403\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/wls11gadmin_replgrp_1-300x230.jpg 300w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/wls11gadmin_replgrp_1.jpg 658w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/h6><\/span>\n<span id=\"Configure_in-memory_session_replication\"><h2>Configure in-memory session replication<\/h2><\/span>\n<p>* Use <em>weblogic.xml<\/em>:<\/p>\n<pre lang=\"xml\">\r\n<session-descriptor>\r\n  <persistent-store-type>replicated<\/persistent-store-type>\r\n<\/session-descriptor>\r\n<\/pre>\n<p>* persistent-store-type:<br \/>\n&#8211; memory: Disables persistent session storage.<br \/>\n&#8211; replicated: Same as memory, but session data is replicated across the clustered servers.<br \/>\n&#8211; replicated_if_clustered: If the Web application is deployed on a clustered server, the in-effect persistent-store-type will be replicated. Otherwise, memory is the default.<br \/>\n&#8211; async-replicated: Enables asynchronous session replication in an application or web application. See Configuring Session Persistence.<br \/>\n&#8211; async-replicated-if-clustered: Enables asynchronous session replication in an application or web application when deployed to a cluster environment. If deployed to a single server environment, then the &#8211; &#8211; session persistence\/replication defaults to in-memory. This allows testing on a single server without deployment errors.<br \/>\n&#8211; file: Uses file-based persistence (See also persistent-store-dir).<br \/>\n&#8211; async-jdbc: Enables asynchronous JDBC persistence for HTTP sessions in an application or web application. See Configuring Session Persistence.<br \/>\n&#8211; jdbc: Uses a database to store persistent sessions. (see also persistent-store-pool).<br \/>\n&#8211; cookie: All session data is stored in a cookie in the user\u2019s browser.<\/p>\n<span id=\"Configure_Java_Database_Connectivity_JDBC_session_replication\"><h2>Configure Java Database Connectivity (JDBC) session replication<\/h2><\/span>\n<p>* Advantages:<br \/>\n&#8211; No primary\/secondary needed.<br \/>\n&#8211; <strong>All<\/strong> members of a cluster have access to any client&#8217;s session data<br \/>\n* Disadvantages:<br \/>\n&#8211; Performance hit<\/p>\n<span id=\"_2\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/wls11gadmin_cluster_jdbc_1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/wls11gadmin_cluster_jdbc_1-300x134.jpg\" alt=\"\" title=\"wls11gadmin_cluster_jdbc_1\" width=\"300\" height=\"134\" class=\"aligncenter size-medium wp-image-5404\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/wls11gadmin_cluster_jdbc_1-300x134.jpg 300w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/wls11gadmin_cluster_jdbc_1.jpg 485w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/h6><\/span>\n<span id=\"Configure_JDBC_Persistence\"><h3>Configure JDBC Persistence<\/h3><\/span>\n<p>* Create required <strong>wl_servlet_sessions<\/strong> table in database:<\/p>\n<pre lang=\"sql\">\r\ncreate table wl_servlet_sessions ( \r\nwl_id VARCHAR2(100) NOT NULL,\r\nwl_context_path VARCHAR2(100) NOT NULL, \r\nwl_is_new CHAR(1),\r\nwl_create_time NUMBER(20), \r\nwl_is_valid CHAR(1), \r\nwl_session_values LONG RAW, \r\nwl_access_time NUMBER(20),\r\nwl_max_inactive_interval\r\nINTEGER, PRIMARY KEY (wl_id, wl_context_path) );\r\n<\/pre>\n<p>* Create JDBC data source that has read\/write privileges to the database<br \/>\n* Configure <em>weblogic.xml<\/em>:<\/p>\n<pre lang=\"xml\">\r\n<session-descriptor>\r\n  <persistent-store-type>jdbc<\/persistent-store-type>\r\n  <persistent-store-pool>MyDataSource<\/persistent-store-pool>\r\n<\/session-descriptor>\r\n<\/pre>\n<span id=\"Configure_file_session_replication\"><h2>Configure file session replication<\/h2><\/span>\n<p>* Create a folder shared by all servers on the cluster on a HA file system<br \/>\n* Assign read\/write privileges to the folder<br \/>\n* Configure weblogic.xml<\/p>\n<pre lang=\"xml\">\r\n<session-descriptor>\r\n  <persistent-store-type>file<\/persistent-store-type>\r\n  <persistent-store-dir>\/mnt\/wls_share<\/persistent-store-dir>\r\n<\/session-descriptor>\r\n<\/pre>\n<span id=\"HTTP_State_Management_Best_Practices\"><h3>HTTP State Management Best Practices<\/h3><\/span>\n<p>* Create WLS machines<br \/>\n* Use Replication Groups<br \/>\n* Choose replication strategy<br \/>\n* Use <em>ServerDebugConfig<\/em> MBean to debug session replication<br \/>\n* Ensure objects are serializable<\/p>\n<span id=\"Describe_state_replication_for_stateful_session_EJBs\"><h2>Describe state replication for stateful session EJBs<\/h2><\/span>\n<p>* Achieved via replica-aware stubs<br \/>\n* Replica-aware stubs are generated at compile time for clusterable EJBs<br \/>\n* Supported algorithms:<br \/>\n&#8211; round robin<br \/>\n&#8211; weight based<br \/>\n&#8211; random<br \/>\n&#8211; parameter based (custom programming)<br \/>\n* Also uses server affinity so that calls to objects remain with the same server<\/p>\n<span id=\"Configure_Deployment_Descriptors\"><h3>Configure Deployment Descriptors<\/h3><\/span>\n<p>* For EJB 2, configure in <em>weblogic-ejb-jar.xml<\/em> or <em>weblogic-cmp-rdbms-jar.xml<\/em>:<\/p>\n<pre lang=\"xml\">\r\n<stateless-clustering>\r\n  <stateless-bean-is-clusterable>True<\/stateless-bean-is-clusterable>\r\n  <stateless-bean-load-algorithm>random<\/stateless-bean-load-algorithm>\r\n<\/stateless-clustering>\r\n<\/pre>\n<p>* For pure EJB 3, use deployment plan<br \/>\n* For EJB 3 that supports backward compatibility with EJB 2, configure like EJB 2<br \/>\n* Stateless session bean in <em>weblogic-ejb-jar.xml<\/em><\/p>\n<pre lang=\"xml\">\r\n<stateless-session-descriptor>\r\n  <!\u2013- Other Tags As Appropriate Here\u2026 -->\r\n  <stateless-clustering>\r\n    <stateless-bean-is-clusterable>True<\/stateless-bean-is-clusterable>\r\n    <stateless-bean-load-algorithm>random<\/stateless-bean-load-algorithm>\r\n    <!\u2013- Other Tags As Appropriate Here\u2026 -->\r\n  <\/stateless-clustering>\r\n<\/pre>\n<p>* Stateful session bean in <em>weblogic-ejb-jar.xml<\/em><\/p>\n<pre lang=\"xml\">\r\n<stateful-session-descriptor>\r\n  <stateful-session-clustering>\r\n    <home-is-clusterable>true<\/home-is-clusterable>\r\n    <home-load-algorithm>random<\/home-load-algorithm>\r\n    ....\r\n    <!-- None for not to replicate -->\r\n    <replication-type>InMemory<\/replication-type>\r\n  <\/stateful-session-clustering>\r\n<\/stateful-session-descriptor>\r\n<\/pre>\n<p>* Entity bean in <em>weblogic-ejb-jar.xml<\/em><\/p>\n<pre lang=\"xml\">\r\n<entity-clustering>\r\n  <home-is-clusterable>True<\/home-is-clusterable>\r\n  <home-load-algorithm>random<\/home-load-algorithm>\r\n  <home-call-router-class-name>beanRouter<\/home-call-router-class-name>\r\n<\/entity-clustering>\r\n<\/pre>\n<span id=\"Configure_EJB_Clustering_using_Admin_Console\"><h3>Configure EJB Clustering using Admin Console<\/h3><\/span>\n<p>* Configures default EJB cluster settings for the domain<\/p>\n<span id=\"_3\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/wls11gadmin_cluster_cfg_adminconsole.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/wls11gadmin_cluster_cfg_adminconsole-300x278.jpg\" alt=\"\" title=\"wls11gadmin_cluster_cfg_adminconsole\" width=\"300\" height=\"278\" class=\"aligncenter size-medium wp-image-5406\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/wls11gadmin_cluster_cfg_adminconsole-300x278.jpg 300w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/wls11gadmin_cluster_cfg_adminconsole.jpg 685w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/h6><\/span>\n<span id=\"EJB_Best_Practices\"><h3>EJB Best Practices<\/h3><\/span>\n<p>* Set pool and cache sizes accordingly<br \/>\n* Cache size affects <strong>all<\/strong> nodes in the cluster<br \/>\n* Mark bean as idempotent at either bean or method level in <em>weblogic-ejb-jar.xml<\/em><br \/>\n&#8211; bean level:<\/p>\n<pre lang=\"xml\">\r\n<stateless-bean-methods-are-idempotent>true<\/stateless-bean-methods-are-idempotent>\r\n<\/pre>\n<p>&#8211; method level:<\/p>\n<pre lang=\"xml\">\r\n<dempotent-methods>true<\/dempotent-methods>\r\n<\/pre>\n<p><a href=\"?p=5001\">Next <\/a>>><\/p>\n<p>[mv_include id=&#8217;3268&#8242;]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>True random * Stateful session bean in weblogic-ejb-jar.xml true random &#8230;. InMemory * Entity bean in weblogic-ejb-jar.xml True random beanRouter Configure EJB Clustering using Admin Console * Configures default EJB cluster settings for the domain EJB Best Practices * Set &hellip; <a href=\"https:\/\/jianmingli.com\/wp\/?p=5392\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[107,104],"tags":[588,180,157,185,167],"class_list":["post-5392","post","type-post","status-publish","format-standard","hentry","category-certification","category-weblogic11g","tag-11g","tag-1z0-102","tag-cluster","tag-manage","tag-wls"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8cRUO-1oY","_links":{"self":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/5392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5392"}],"version-history":[{"count":12,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/5392\/revisions"}],"predecessor-version":[{"id":5710,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/5392\/revisions\/5710"}],"wp:attachment":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}