Erp100论坛's Archiver

xiangzhao 发表于 2008-7-26 15:14

Oracle as 10gR3 集群及其管理

Agenda

10gR3 Cluster new features
10gR3 Cluster change
10gR3 Cluster concept
10gR3 Cluster configuration
10gR3 Cluster administration
10gR3 Cluster deploy architecture
10gR3 Cluster performance and tips

xiangzhao 发表于 2008-7-26 15:14

New features


Database  based replication
More tunable  replication policy
          onSetAttribute, onRequestEnd, onShutdown
Wan-wide replication
Deploy clustered and non-clustered application simultaneously
More Dynamic
Dynamic Topologies,Dynamic Routing Relationships,Mount Point Discovery

xiangzhao 发表于 2008-7-26 15:15

Change


Islands No Longer Supported
loadbalancer.jar No Longer Used
<cluster-config>  of server.xml Deprecated
<cluster-island>  of <web-site> Deprecated

xiangzhao 发表于 2008-7-26 15:15

Concept


Session replication(multicast,peer to peer)
Dynamic discovery
Transparent failover
Dynamic routing
Mod_oc4j
OPMN

xiangzhao 发表于 2008-7-26 15:15

Dynamic Routing


mod_oc4j routes requests from Web Server to OC4J instances where application is running
Previously used a static mapping file which required restart to take affect
OC4J now announces mappings
mod_oc4j dynamically adds mappings to its route table
Removes system down time
Reduces maintenance

xiangzhao 发表于 2008-7-26 15:15

MOD_OC4J


Route requests from Web Server to OC4J instances
Route to the first served server if available
Many load balance policies
Dynamic maintain oc4j mapping route
Route to specific OC4J (routing id)

xiangzhao 发表于 2008-7-26 15:15

Cluster configuration-topology


OPMN
ORACLE_HOME/opmn/bin/opmnctl config topology update discover=*225.0.0.1:8001
ORACLE_HOME/opmn/bin/opmnctl reload
One Step
opmnassociate *225.0.0.1:8001 -restart

xiangzhao 发表于 2008-7-26 15:15

Cluster configuration-session replication


Modify $OC4J_HOME/config/application.xml or oraion_application.xml
Add following :
<cluster allow-colocation="false" write-quota="1">
<replication-policy trigger="onRequestEnd" scope="modifiedAttributes"/>
<protocol>
<multicast ip="225.130.0.0" port="45577" bind-addr="226.83.24.10"/>
</protocol>
</cluster>
Modify web.xml  add
<distributable/>

xiangzhao 发表于 2008-7-26 15:15

Modify $OC4J_HOME/config/application.xml or oraion_application.xml
Add following :
<cluster allow-colocation="false" write-quota="1">
<replication-policy trigger="onRequestEnd" scope="modifiedAttributes"/>
<protocol>
<peer>
<opmn-discovery />
</peer>
</protocol>
</cluster>
Modify web.xml  add
<distributable/>

xiangzhao 发表于 2008-7-26 15:16

Modify $OC4J_HOME/config/application.xml or oraion_application.xml
Add following :
<cluster allow-colocation="false" write-quota="1">
<replication-policy trigger="onRequestEnd" scope="modifiedAttributes"/>
<protocol>
<peer start-port="7900" range="10" timeout="6000">
<node host="www2.company.com" port="7900" />
</peer>
</protocol>
</cluster>
Modify web.xml  add
<distributable/>

xiangzhao 发表于 2008-7-26 15:16

Modify $OC4J_HOME/config/application.xml or oraion_application.xml
Add following :
<cluster allow-colocation="false" write-quota="1">
<replication-policy trigger="onRequestEnd" scope="modifiedAttributes"/>
<protocol>
<database data-source="jdbc/MyOracleDS"/>
</protocol>
</cluster>

OC4J_HTTP_SESSION (auto create)
OC4J_HTTP_SESSION_VALUE
OC4J_EJB_SESSION

xiangzhao 发表于 2008-7-26 15:16

Test jsp
<% String user_count=(String)session.getAttribute("user_count";
if(user_count==null)
{
session.setAttribute("user_count","1";
out.print("null";
System.out.println("null";
}
else
{
System.out.println("before "+user_count);
user_count=Integer.parseInt(user_count)+1+"";
System.out.println("after add "+user_count);
session.setAttribute("user_count",user_count);
out.print(user_count);
}%>

xiangzhao 发表于 2008-7-26 15:16

Test
Open the test page ,check which oc4j serve
Restart the first serve oc4j
Reclick the test page on the first window,session should replicated to the second oc4j

xiangzhao 发表于 2008-7-26 15:16

Administration


Application Server Control
opmnctl
admin_client.jar
admin.jar(standalone only)

xiangzhao 发表于 2008-7-26 15:16

OPMN


Oracle Notification Server(ONS)
Receives  notification from other ONS
Send notification to other ONS
Oracle Process Manager(PM)
Start,stop,restart managed process(oc4j,OHS..)
Monitor managed process
Automatic restart managed process
Two process,first start second ,second manage managed  process

xiangzhao 发表于 2008-7-26 15:17

admin_client.jar


Deploy,undeploy application,web module,ejb module
Incrementally update a deployed EJB module
Create, modify, or remove shared libraries for an application
Start, restart, or stop applications
Restart or stop an OC4J instance or group of instances
Add, test, and remove data sources
Add and remove JMS connection pools

xiangzhao 发表于 2008-7-26 15:17

admin_client.jar


[oas1013@test001 home]$ java -jar admin_client.jar
Usage:
   java -jar admin_client.jar <connection_uri> <username> <password> <command>
Valid commands are:
-shutdown
-restart
-deploy -file <filename> -deploymentName <appname> [options]
-redeploy -file <filename> -deploymentName <appname> [options]
-undeploy <appname> [options]
-bindWebApp -appName <appname> -webModuleName <name> [options]
-bindAllWebApps -appName <appname> [options]
-start <appname>
-stop <appname>
-updateEJBModule -appName <appname> -ejbModuleName <name> -file <path>
-listSharedLibraries
-describeSharedLibrary -name <name> -version <version>
-publishSharedLibrary -name <name> -version <version> [options]
-modifySharedLibrary -name <name> -version <version> [options]
-removeSharedLibrary -name <name> -version <version>
-validateURI

xiangzhao 发表于 2008-7-26 15:17

Performance monitor


DMS Tools
        command line  tool for report performance metrics

AggreSpy
        web-based servlet for report performance metrics

Application server control

xiangzhao 发表于 2008-7-26 15:17

Performance monitor -dmstool


[oas1013@test001 home]$ dmstool

Usage:

dmstool -help
dmstool -list [-table] [-delimitor <delimitor>]
        [-address <[opmn://]host[ort][path],...>]
dmstool [-interval <secs>] [-count <num>]
        [-address <[opmn://]host[ort][path],...>]
        [-delimitor <delimitor>] <metric> <metric> ...
dmstool -table [-interval <secs>] [-count <num>]
       [-address <[opmn://]host[ort][path],...>]
       [<table> <table> ...]
dmstool -reset [-table] <metric|table> <metric|table> ...
dmstool -dump [-interval <secs>] [-count <num>]
       [-address <[opmn://]host[ort][path],...>] [format=xml|<query>]

xiangzhao 发表于 2008-7-26 15:17

[oas1013@test001 OracleAS_1]$ dmstool -table -list

oc4j_web_module
oc4j_workManagementPool
ohs_child
ohs_module
ohs_ossl
ohs_responses

xiangzhao 发表于 2008-7-26 15:17

[oas1013@test001 OracleAS_1]$ dmstool -table ohs_server
Thu Jul 19 06:21:34 CST 2007
ohs_server
Host:   test001
Name:   OHS
Parent: /
Process:        HTTP_Server:OHS:3349:6100
connection.avg: 156492  usecs
connection.completed:   38583   ops
connection.maxTime:     96091863        usecs
connection.minTime:     1679    usecs
request.avg:    13426   usecs
request.completed:      38952   ops
request.maxTime:        65148495        usecs
request.minTime:        666     usecs
request.time:   523002495       usecs

xiangzhao 发表于 2008-7-26 15:18

Performance monitor - AggreSpy


Config:
$ORACLE_HOME/Apache/Apache/conf/dms.conf

Redirect /dms0/AggreSpy [url]http://127.0.0.1:7200/dmsoc4j/AggreSpy[/url]
# DMS VirtualHost for access and logging control
Listen 127.0.0.1:7200
OpmnHostPort [url]http://127.0.0.1:7200[/url]

<VirtualHost 127.0.0.1:7200>
  ServerName 127.0.0.1
  TransferLog /dev/null

xiangzhao 发表于 2008-7-26 15:18

Config:
Redirect /dms0/AggreSpy [url]http://10.64.3.148:7201/dmsoc4j/AggreSpy[/url]

# DMS VirtualHost for access and logging control
Listen 10.64.3.148:7201
OpmnHostPort [url]http://10.64.3.148:7201[/url]

<VirtualHost 10.64.3.148:7201>
  ServerName 10.64.3.148
  TransferLog /dev/null

xiangzhao 发表于 2008-7-26 15:18

Performance-tuning


Don’t store large objects in session
Don’t store many objects in session
limit session replication nodes
Select right load balance policy
Set right heap size
Set right GC policy
Pool JDBC Connection

xiangzhao 发表于 2008-7-26 15:18

Limit session replication nodes
<cluster allow-colocation="false" write-quota="1">
<replication-policy trigger="onRequestEnd" scope="modifiedAttributes"/>
<protocol>
<multicast ip="225.130.0.0" port="45577" bind-addr="226.83.24.10"/>
</protocol>
</cluster>

xiangzhao 发表于 2008-7-26 15:18

Choose right load balance policy
mod_oc4j.xml
Random
Round Robin (default)
Random with Local Affinity
Round Robin with Local Affinity
Random using Routing Weight
Round Robin using Routing Weight
Metric Based
Metric Based with Local Affinity

xiangzhao 发表于 2008-7-26 15:18

Set right heap size and gc policy
-server -Xms1500m -Xmx1500m -XX:NewSize=700m  -XX:MaxNewSize=700m  -XX:SurvivorRatio=8   -XX:MaxPermSize=256m -XX:+UseParallelGC -XX:ParallelGCThreads=4 -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+AggressiveHeap
-verbose:gc -Xloggc:gc.log

xiangzhao 发表于 2008-7-26 15:18

Jdk 1.5 new monitor tools
Jinfo           obtain configuration information
Jmap         obtain memory map information,
Jstack         obtain java and native stack information
Jdb           debug jvm

xiangzhao 发表于 2008-7-26 15:18

Jdk 1.5 new monitor tools
Jconsole   provide information on performance and resource consumption
Jstat                 provide information on performance and resource consumption
Heap Analysis Tool  useful for memory leaks
HPROF Profiler    report cpu usage,heap statistics

xiangzhao 发表于 2008-7-26 15:19

OC4J performance-thread pool

System          not change,system use only
http                Serves HTTP and AJP requests and rmi
rmi request      Serves  rmi request
rmi connection handles rmi connection
Custom             serves user applications

xiangzhao 发表于 2008-7-26 15:19

OC4J performance-thread pool
Server.xml
<thread-pool
name="http"
min="40"
max="40"
queue="2560"
keepAlive="-1"
stackSize="0"/>

xiangzhao 发表于 2008-7-26 15:19

OHS performance
MaxClients
Oc4jCacheSize
MaxRequestsPerChild
KeepAlive

xiangzhao 发表于 2008-7-26 15:19

Tips-route to specific oc4j


<ias-instance id="test.test001.picclife.cn" name="test.test001.picclife.cn">
         <environment>
            <variable id="TMP" value="/tmp"/>
         </environment>
         <module-data>
            <category id="start-parameters">
               <data id="routing-id" value="g_rt_id"/>
            </category>
         </module-data>

xiangzhao 发表于 2008-7-26 15:19

Tips-debug session replication


<ias-component id="MyGroup" status="enabled">
            <process-type id="test" module-id="OC4J" status="enabled">
               <module-data>
                  <category id="start-parameters">
   <data id="java-options" value="-server -Dhttp.cluster.debug=true  -Dhttp.session.debug=true -Djava.security.policy=$ORACLE_HOME/j2ee/test/config/java2.policy -Djava.awt.headless=true -Dhttp.webdir.enable=false"/>

xiangzhao 发表于 2008-7-26 15:19

Tips-debug session replication


Debug session replication
07/07/19 08:00:54 FINE: JGroupHttpSession.beginRequest ClusteredHttpSession.beginRequest()
07/07/19 08:00:54 before 1
07/07/19 08:00:54 after add 2
07/07/19 08:00:54 FINE: JGroupHttpSession.attributeModified attribteModified -- user_count newValue: 2 oldValue 1
07/07/19 08:00:54 FINE: JGroupHttpSession.endRequest ClusteredHttpSession.endRequest(), accessed=true, modified=true
07/07/19 08:00:58 FINEST: Manager.reapReplicas reaped 0 replicated sessions
07/07/19 08:00:58 FINEST: Manager.reapReplicas reaped 0 replicated sessions

07/07/19 08:14:19 FINEST: Manager.reapReplicas reaped 0 replicated sessions
07/07/19 08:14:19 FINEST: AbstractGroup.dispatch dispatching message: ApplyDelta- - 0a40039430d7cea9bc827bf24a13876c98c3c3b60c86
07/07/19 08:14:19 FINEST: SessionReplica.applyDelta  Applying put: user_count value: [B@14ea256
07/07/19 08:14:19 FINEST: SessionReplica.applyDelta Applied 1 puts and 0 removes
07/07/19 08:14:50 FINEST: Manager.reapReplicas reaped 0 replicated sessions
07/07/19 08:15:21 FINEST: Manager.reapReplicas reaped 0 replicated sessions

xiangzhao 发表于 2008-7-26 15:20

Tips-replication flow control


orion-application.xml

<cluster >
<flow-control-policy enabled=true max-bytes
=500000 min-bytes=0 >

</cluster>

xiangzhao 发表于 2008-7-26 15:20

Tips-synchronization time


Set the same time for all cluster nodes

配置服务器
修改 /etc/ntp.conf
加上需要同步得网段
restrict 10.64.3.0 mask 255.255.255.0
启动ntp
chkconfig ntpd on
/etc/init.d/ntpd start
# vi /etc/ntp/step-tickers
加入一行
pool.ntp.org
这样每次ntpd启动时,会自动连接该国际标准时间服务器;

配置客户端
ntpdate ip_of server

0 3 * * * /usr/sbin/ntpdate 192.168.0.179

页: [1]

Powered by Discuz! Archiver 7.0.0  © 2001-2007 Comsenz Inc.