Академический Документы
Профессиональный Документы
Культура Документы
with Oracle
Aychin Gasimov
02/2014
Required components
Oracle Clusterware, Oracle Restart, Oracle Data
Guard
FAN
ONS
Services
UCP
LBA and different types of load balancing
FCF
TAF
SUBSCRIBE_FOR_NODE_DOWN_EVENT_listener_name=ON (default)
Services
A named representation of one or more database instances. The service
name for an Oracle database is normally its global database name. Clients
use the service name to connect to one or more database instances.
Logical abstractions for managing workloads in Oracle Database
The services are tightly integrated with Oracle Database and are
maintained in the data dictionary.
Connection requests can include a database service name.
Services enable you to configure a workload, administer it, enable and
disable it, and measure the workload as a single entity.
AWR records service performance. Each service has quality-of-service
thresholds for response time and CPU consumption.
Database Resource Manager can map services to consumer groups.
Therefore, you can automatically manage the priority of one service
relative to others.
Services can be created by DBMS_SERVICE package or srvctl utility
Services
Oracle Cluster CLS1
Applications
Node 1
Instance1
30% RTPC 0.5s CPUPC 0.3s
70% RTPC 0.7s CPUPC 0.5s
Srv1_db
Srv2_db
Node 2
Instance2
100% RTPC 0.3s CPUPC 0.2s
Srv3_db
Node 3
Instance3
60% RTPC 0.8s CPUPC 0.6s
40% RTPC 0.5s CPUPC 0.3s
100.125.200.21
100.125.200.22
100.125.200.23
DB =
(DESCRIPTION =
(FAILOVER = on)
(LOAD_BALANCE = off)
(CONNECT_TIMEOUT = 5)
(TRANSPORT_CONNECT_TIMEOUT = 2)
(RETRY_COUNT = 2)
(ADDRESS = (PROTOCOL = TCP)(HOST = scan1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = scan2)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = scan3)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = myservice)
)
)
Application
SCAN Listener
service1
UCP
service2
ONS
Instance 1
ONS
Instance 2
SCAN Listener
service1
service2
ONS
Instance 3
UCP will create physical connections to the instances using provided connection description. Client side load balancing will distribute new
connection requests between different SCAN listeners (3 IPs) because LOAD_BALANCE=ON
Connection request arrives to the Listener, now according to the Services clb_goal value it will redirect it to the appropriate instance, it is serverside connection load balancing. If clb_goal is SHORT and LBA is enabled for the Service then listener will use the services GOODNESS information
which it receives from serving instances to decide to which instance to redirect the connection. If clb_goal is LONG then Listener will balance
connections by number of sessions per service. If connection pools physical connections count is constant then we can use clb_goal=LONG with
UCP, if this number is dynamic then clb_goal=SHORT must be used, because each new connection request from UCP must be accurately redirected
according to the LBA advice and goal (goal can be SERVICE_TIME or THROUGHPUT)
ONS from each node periodically sends LBA FAN events to UCP. This way UCP is aware about current service levels on each instance, like Listener.
According to this information Run-time load balancing mechanism distributes workload between different instances during application life.
FCF
Planned outage
Stale borrowed connections are marked and removed after they
are returned to the pool
On-going transactions proceed to complete
Unplanned outage
Detect and remove stale connections from pool
Borrowed connections are immediately aborted and closed
On-going transactions immediately receive an exception
ONS
Application
UCP
Interconnect
Borrowed
connections
Instance 1
Service
Node 2
ONS
Service
Instance 2
ONS
Application
UCP
Interconnect
Borrowed
connections
Instance 1
Service
ONS
Service
Node 2
Instance 2
Application
Instance 1
Service
UCP
Interconnect
Borrowed
connections
Node 1
ONS
ONS
Service
Node 2
Instance 2
ONS
Application
UCP
Interconnect
Borrowed
connections
ONS
Service
Instance 1
Service
Node 2
Instance 2
UCP received FAN event and immediately marks borrowed connections to the Instance 1 as to be
cleared, not borrowed connects are cleared and if needed reestablished to the available instance
Physical connections is still there, because there is borrowed connections in use. It is possible
because when we do normal service shutdown already active connections are not disconnected
and it is up to client (UCP) when to disconnect.
ONS
Application
UCP
Interconnect
Borrowed
connections
Instance 1
Service
Node 2
ONS
Service
Instance 2
ONS
Application
UCP
Interconnect
Borrowed
connections
Instance 1
Service
ONS
Service
Node 2
Instance 2
If the pool min size will be reached new connection will be reestablished immediately
to the available Instance
After Service on Node 1 will be started new connections will be placed to it by SLB
ONS
Application
UCP
Interconnect
Borrowed
connections
Instance 1
Service
ONS
Service
Node 2
Instance 2
ONS
Application
UCP
Interconnect
Borrowed
connections
ONS
Service
Instance 1
Service
Node 2
Instance 2
ONS
Application
UCP
Interconnect
Borrowed
connections
Instance 1
Service
ONS
Service
Node 2
Instance 2
Connections to the Instance 1 will fall into TCP retransmission cycle and will be in this
state until TCP timeout will expire which can take several minutes, but
ONS
Application
UCP
Interconnect
Borrowed
connections
Instance 1
Service
ONS
Service
FAN DOWN event
Node 2
Instance 2
ONS
Application
UCP
Interconnect
Borrowed
connections
ONS
Service
Instance 1
Service
Node 2
Instance 2
UCP will receive DOWN event and will immediately break affected connections out of TCP timeouts by
disconnecting physical connections
Application will immediately receive error, all not committed work is already rolled back by Instance 2.
Application do not need to execute rollback.
Application must:
Retry the connection request, because the old one is no longer open
Replay the transaction
ONS
Application
Continuity
Directory
Interconnect
LTXID
Replay
Context
UCP
Borrowed
connections
Instance 1
Service
ONS
Service
LTXID
Node 2
Instance 2
Continuity
Directory
LTXID