Title: DM218 Multiple DSI
1DM218Multiple DSIs Cross Domain Replication
Jeff Tallman Principal Consultant Enterprise
Solutions Division tallman_at_sybase.com
2Multiple DSI Cross Domain Replication
- Agenda
- Understanding Parallel DSIs
- Serialization Methods Parallelism
- Multiple DSIs
- Business Case
- Implementation Design Considerations
- Cross Domain Replication
- Business Case
- Implementation Design Considerations
3Multiple DSI Cross Domain Replication
- Caveats
- Techniques discussed are not new
- Taught for 3-4 years in Sybase Course MGT700
- Is it supported by Sybase Tech Support??
- If reproducible with single DSI, then YES
- Basically if a product bug, then supported
- If data loss/implementation, then NO
- Deliberately by-passing normal RS safeguards
4Multiple DSI Cross Domain Replication
- Terms
- Serialization
- Xactns must be applied in same order to guarantee
same result and business integrity - Example deposit followed by withdrawal
- Commit Consistent
- Xactns applied in any order yields same result
- Example Point-Of-Sale, Corporate-Rollups
5Understanding Parallel DSI
- Topics
- Why Parallel DSI
- Internals Implementation
- Serialization Methods
- Performance Consideration
6Why Parallel DSI
- Single DSI was bottleneck
- RS 10.x used single DSI
- Originally done to ensure serialization
- Replicate systems could not keep up in OLTP
- DSI had to maintain rate of 100s of users
- Customer Example (Oct 1995)
- Sql Server 11.0, RS 10.5, Alpha 2100 4/275
- Primary 5 feeds 1.5 million tpd (goal 3 million)
- Replicate 1 DSI 300K tpd (35 tps)
7The Need For Parallel DSI
210 tpm max
210 tpm each 1050 tpm total
High sleep time 1 cpu busy RS queue growing
steadily Outbound queue steady
Transaction rates are from 1995 RS 10.x case study
High Volume OLTP Balanced work/load in run/sleep
queue
8Single-Threaded DSI Processing
DSI Grouping Preparation
DSI Grouping Preparation
9Parallel DSI Implementation Review
- Implemented by splitting DSI into two
- DSI-S - Schedular, groups transactions
- DSI-E - Parallel execution threads
- Other RS internals unaffected
- Parallel transaction management
- Next xactn sent to RDB ...
- before previous xactn committed
- after DSI-S read next xactn commit
- Large xactn before DSI-S read next xactn commit
10Parallel DSI Internals
DSI-Exec
DSI-Exec
Replicate
DSI-Exec
SQT
SRE
TD
MD
Stable Device
Primary
Distributor
Outbound (0)
Inbound (1)
Outbound (0)
Inbound (1)
Rep Agent User
RepAgent
11Parallel DSI Serialization
- Two Considerations
- Four methods for serialization
- wait_for_commit
- single_transaction_per_origin
- isolation_level_3
- none
- rs_threads table
- wait_for_commit coordination
- updated regardless of serialization method
- often a source of contention/deadlocks
12Parallel DSI Serialization Method ? Commit Order
- Commit Order is always guaranteed!!!
- Serialization method refers to conflict avoidance
- basically a timing of when the next transaction
is sent to the replicate for execution - commit order sequence is guaranteed through
rs_threads
13wait_for_commitHow It Works
- Xactns may be executed in parallel
- Next xactn not sent until previous ready to
commit
14wait_for_commit Minimizing Conflict
15wait_for_commitAdvantages Disadvantages
Advantages
Disadvantages
- Serialization is maintained
- Minimizes contention reducing deadlocks/blocking
between DSIs - No design considerations
- Transaction execution is barely parallel
- Gain is only directly proportionate to commit
time (including time to update rs_lastcommit) and
internal DSI processing time
16noneHow It Works
- Xactns are submitted in parallel
- Does not wait until previous is ready to commit
before sending next transaction - Fastest parallel method if no inter-thread
contention
17none The Theory
Ins Table A
Upd Table B
CT 1
Upd rs_threads 1
BT 1
Ins Table B
Upd Table C
Upd rs_threads 2
BT 2
CT 2
Sel rs_threads 1
Ins Table A
Upd Table C
Upd rs_threads 3
BT 3
CT 3
Sel rs_threads 2
Ins Table C
Upd Table A
CT 4
Upd rs_threads 4
BT 4
Sel rs_threads 3
18none On a Bad Day
Ins Table A
Upd Table B
CT 1
Upd rs_threads 1
BT 1
Deadlock
Ins Table B
Upd Table C
Upd rs_threads 2
BT 2
CT 2
Sel rs_threads 1
Blocked
Blocked
Ins Table A
Upd Table C
Upd rs_threads 3
BT 3
CT 3
Sel rs_threads 2
Deadlock
Ins Table C
Upd Table A
CT 4
Upd rs_threads 4
BT 4
Sel rs_threads 3
19noneAdvantages Disadvantages
Advantages
Disadvantages
- Highest throughput serialization method (if no
conflicts) - Execution is nearly in parallel
- High contention could lead to slower performance
due to retries
20isolation_level_3How It Works
- Xactns are submitted in parallel - same as none
- Isolation Level 3 is set for connection
- Xactns block or wait when isolation level 3
violated - Declarative integrity (DRI always holds locks)
- Select statements inside replicated procedures
- Trigger code if not turned off for connection
- Custom function strings
- Aggregate calculations, etc.
21isolation_level_3Advantages Disadvantages
Advantages
Disadvantages
- Transactions submitted in parallel
- Isolation level 3 guaranteed
- Possible good choice for low cardinality source
db over single_transaction_per_source
- Same as none
- Possibility of contention higher due to
isolation level 3 holding select locks
22single_transaction_per_originHow It Works
- Each xactn from same source uses same DSI thread
- No parallelism within same db
- Set num_dsi_threads of source dbs (max is 20)
- Should be the default in corporate rollup
scenarios - Internals review
- rs_lastcommit - each source db has own row
- inbound queue/DIST - 1 per source db
- outbound queue - 1 target shared by all
- DSI-S - groups transactions by source db
23single_transaction_per_originthe Internals
(ideally)
DSI-Exec
DSI-Exec
Corporate HQ
DSI-Exec
SQT
Stable Device
Distributor
Distributor
Outbound (0)
SQT
Inbound (1)
dAIO
SQT
Outbound (0)
New York
Inbound (1)
SQM
Rep Agent
Outbound (0)
Chicago
SQM
Rep Agent
Inbound (1)
Seattle
Outbound (0)
Inbound (1)
24single_transaction_per_originAdvantages
Disadvantages
Advantages
Disadvantages
- Serialization maintained within each source db
- If source DB load is balanced across sources,
execution is near parallel - Takes advantage of the inherent commit
consistency to avoid conflicts
- Parallelism limited to number of source systems
- Need to be careful of conflicting updates
- Aggregates
- If conflict is high, may need to reduce
parallelism - Source DBs may share DSI
- If source DB load unbalanced, worst case is
wait_for_commit type performance.
25Parallel DSI rs_threads Table
- Parallel DSI only
- Primary purpose is commit order coordination
- Manipulated via fstrings procs
- rs_get_thread_seq
- rs_get_thread_seq_noholdlock
- rs_initialize_threads
- rs_update_threads
- Incorporated in xactn group
- rs_begin
- rs_update_threads id, seq
- xactn stmts
- rs_get_thead_seq_noholdlock
- rs_commit
- create table rs_threads (
- id int,
- seq int,
- pad1 char(255),
- pad2 char(255),
- pad3 char(255),
- pad4 char(255)
- )
- go
- create unique clustered index rs_threads_idx on
rs_threads(id) - go
- grant select on rs_threads to public
- go
26rs_threads Parallel DSIHow It Works
- rs_initialize_threads sets up rs_threads at
connect - Update as first stmt in xactn group locks its row
- Consequently blocks all other threads
- Longest xactn in series effectively sets
throughput - Selects seq from previous thread
- If previous thread not done - blocks
- If number is 1 higher than last time - commit
- If number lt prev1 - previous rolled back
- RS decides whether to rollback other threads
27Rs_threads Processing psuedo-code
- begin tran
- locks its row in rs_threads with update
- executes xactn stmts
- selects row for previous thread
- --blocked until previous thread commits
- if prev thread seq is expected value
- rs_commit execs rs_update_lastcommit !!!
- else
- rollback transaction
28rs_threads wait_for_commitReasons Seq lt
Expected Value
- Typically due to a rollback condition
- Victim of conflicts between users/DSI threads
- Error which suspends DSI
- All other DSI threads will suspend as well
29Large Transactions Parallel DSI
- Behaves similar to other parallel DSIs
- Starts sending statements to replicate BEFORE
seeing own commit - Avoids lag on replicate while DSI-S reading queue
until commit is seen - Every dsi_large_xactn_size rows
- rs_get_thread_seq (n-1)
- Supposed to flush conflicting updates
- Earlier detection of deadlocks with other threads
30rs_threads Large Transactions(dsi_num_large_xac
t_threads2)
Ins
UT1
BT 1
Upd
CT 1
Blocked
Ins
UT2
BT 2
Upd
CT 2
ST1
Blocked
Ins
Upd
ST2
Ins
Ins
UT3
BT 3
Upd
CT 3
ST2
Upd
Blocked
Ins
Upd
ST3
Ins
Ins
UT4
BT 4
Upd
CT 4
ST3
Upd
31rs_threads Large TransactionsConflict With
Large Xactn
Ins
UT1
BT 1
Upd
CT 1
Blocked
Ins
UT2
BT 2
Upd
CT 2
ST1
Deadlock
Ins
Upd
ST2
Ins
Ins
UT3
BT 3
Upd
CT 3
ST2
Upd
Blocked
Ins
Upd
ST3
Ins
Ins
UT4
BT 4
Upd
CT 4
ST3
Upd
32rs_threads Large TransactionsWithout Early
Detection
Ins
UT1
BT 1
Upd
CT 1
Blocked
Rollback/Block Penalty Range
Ins
UT2
BT 2
Upd
CT 2
ST1
Deadlock
Ins
Upd
ST2
Ins
Ins
UT3
BT 3
Upd
CT 3
ST2
Upd
Blocked
Ins
Upd
ST3
Ins
Ins
UT4
BT 4
Upd
CT 4
ST3
Upd
33dsi_serialization_method No Serialization
- All still use rs_get_thread_seq/rs_update_threads
- Serialization is enforced in RS code
- if (rs_get_thread_seq) then rs_commit
- To by-pass behavior (and get no serialization)
- Create own base function string class and alter
rs_get_thread_seq to at isolation read
uncommitted - Use multiple DSIs
34Parallel DSI SerializationSo What Does It All
Mean???
- If xactns have high contention
- Use wait_for_commit
- Try increasing dsi_max_xacts_in_group
- No real benefit to large numbers of DSIs
- If not much contention (i.e. a lot of inserts)
- Use none or isolation_level_3
- Possibly increase number of DSIs
- If contention, reduce dsi_max_xacts_in_group
35wait_for_commit vs. noneIs It Good or BadYou
Decide...
- Transaction Profile
- Serial bcp of 1,000,000 rows total (slow bcp)
- Three tables - some text/image
- batch size effectively 200-300
- RS 12.0 w/ 3 DSIs (2 large DSIs not used)
- wait_for_commit - 1GB behind after 1 hour
- none - cleared queue in 30 minutes
- Averaged 3 parallel failures/minute
- Target batch size for none for client is 100
36Parallel DSI Advice for Large Transactions
- dsi_num_large_xact_threads
- If DSI frequently appears waiting add some of
these - Good check is admin who,sqt (cmds)
- How many will depend on how conflict friendly
xactn is - But, more than likely only 2 will ever be
effective due to rs_update_threads/rs_get_thread_s
eq - dsi_large_xact_size - 100 may be too low.
- For example, if replicating bulkloads, whats -b
???
37Multiple DSIs Cross Domain Replication
- Understanding Parallel DSIs
- Serialization Methods Parallelism
- Multiple DSIs
- Business Case
- Implementation Design Considerations
- Cross Domain Replication
- Business Case
- Implementation Design Considerations
38What is Multiple DSI
- Answer Method invented in RS 10.x to overcome
single-threaded DSI - Uses multiple independent DSI connections
- Each connection has own outbound queue DSIs
- Usually achieved by faking out server.database
- Can be from one or more Replication Servers
- Still has applicability today
- Can easily outperform parallel DSI
- Easily extends to cross-domain replication
39Why Use Multiple DSIs ???
- Parallel DSI may not meet requirements
- If one DSI suspends, they all do
- Single RS cant manage the load
- Control parallelism to reduce inter-thread
contention - Create separate user batch channels
- Different serialization methods per channel
- Separate data per channel
- Allows cross-domain replication
40How Effective are Multiple DSIs?
- 1995 Case Study
- Transportation System
- SQL Server 11.0
- DEC Alpha 2100 4/275
- 5 streams, 4 million procs/day (10 writes each)
- RS 11.0 with 10 parallel DSI 50 scalability
- RS 10.5 11.0 with 7 multiple DSI 98
scalability
41Multiple DSI Business Case 1Corporate
Rollup/Peer-Peer
42Multiple DSI Business Case 2Dedicated Data
Channels
Sales Gross Receipts
Commissions
Department Store
Headquarters
Customer Demographics
Stock Orders
Flight Departures
Shipment Orders
Transportation Center
Headquarters
Package Deliveries
Timesheets Equip Costs
43Multiple DSI Business Case 3Controlled
Parallelism
Acct_num mod 0
Acct_num mod 1
Branch Bank
Headquarters
Acct_num mod 2 (etc)
Cross_Acct Transfer
Batch Interest Payments
Closing Trade Position
OLTP System
DataWarehouse
Customer Trades
Mutual Fund Trades
44Multiple DSI Rules
- Parallel xactns must be commit consistent
- Serial xactns must use same DSI connection
- If not 1 2, you must implement own synch point
- mimic rs_threads
- requires procedure or function string coding
Note Implementing Multiple-DSIs is easy -
implementing multiple DSIs and maintaining
transactional consistency can be much more
difficult in situations where a single source is
used. If you get to 3, you may want to stay
with parallel DSI and get faster hardware.
45Multiple DSIs - Step 1Alias Destination Server
- Aliasing Server is key to faking out RS/RSSD
- Replicate DB Server has multiple entries in
interfaces - i.e. DS2_a, DS2_b, DS2_c
- RS thinks it is replicating to n different
replicate DBs - i.e. DS2_a.my_db, DS2_b.my_db, DS2_c.my_db
- Use for both single or multiple sources in one RS
- or for multiple RSs (ala Corporate Rollup)
- If in same domain, the aliasing gets around the
unique index restriction on rs_databases in RSSD
46Multiple DSIs - Step 1Alias Destination Server
my_db
DS2
DS2_a.my_db
DSI-Exec
DS2_b.my_db
DSI-Exec
DS2_c.my_db
DSI-Exec
DSI
DSI
DSI
Stable Device
SQM
Outbound (0)
SQM
Inbound (1)
SQM
Outbound (0)
Inbound (1)
Outbound (0)
Inbound (1)
Outbound (0)
Rep Agent User
Inbound (1)
47Multiple DSIs - Step 2Set Up Multiple
Connections
- One connection per DSI/Aliased Name
- Can be done via rs_init or manually
- Manual is easy but requires RS knowledge
- Multiple replication tables or single
- rs_lastcommit, rs_threads associated procs
- You MUST do this to ensure recovery
48Multiple DSIs - Step 2aSet Up Maintenance Users
- If single rs_lastcommit, this can be skipped
- Add maintenance user logins
- Grant maintenance logins replication role
- Do NOT give them sa_role
- Add maintenance users to replicate database
- If identity values used, one may have to be
aliased to dbo - Grant all permissions on tables/procs
49Multiple DSIs - Step 2bCreate Connections
- create connection to data_server.database
- set error class to rs_sqlserver_error_class
- set function string class to
rs_sqlserver_function_class - set username to maint_user_name
- set password to maint_user_password
- set database_param to 'value'
- set security_param to 'value'
- with log transfer on, dsi_suspended
- as active for logical_ds.logical_db
- as standby for logical_ds.logical_db
- use dump marker
50Multiple DSIs - Step 2cSet Up Replication
Tables/Procs
- Method 1 Multiple Replication Tables
- Make copy of SYBASE/scripts/rs_install_primary
- Modify copy and add maint user 1 as owner for
all tables and procs - Use isql to load into replicate database
- Change copy for maint user 2
- Repeat as necessary
51Multiple DSIs - Step 2cSet Up Replication
Tables/Procs
- Method 2 Single Set of Replication Tables
- Make copy of SYBASE/scripts/rs_install_primary
- Modify copy
- Add column for maint user suid to all
tables/procs - Adjust clustered indexes as appropriate
- Create custom fstring class (inherit from
default) - Modify rs_threads rs_lastcommit functionsto
include suid() - Modify connections to use fstring class
52Multiple DSIs - Step 2dSet Up Replication Agent
- Only necessary if replicating out of target
- Configure Replication Agent using
sp_config_rep_agent - Specify one of the maint users or a new one
- Add maint user to RS as user
- Grant Log Transfer permission to user
- Alter Multiple DSI connections to prevent looping
- dsi_replication off
- However, you may want it replicated
- (i.e. consider Field ? Region ? Headquarters)
53Multiple DSIs - Step 2(b-d)Alternative Method
(rs_init)
- Alternative for multiple rs_lastcommit
- After adding maint users (step a)
- Modify SYBASE/scripts/rs_install_primary
- Add maint user 1 as owner for all tables/procs
- Run rs_init for maint user 1/DSI 1
- Modify install script for maint user 2
- Repeat until done
54Multiple DSIs - Step 2 Explained Why Multiple
Maintenance Users
55Multiple DSIs - Step 2 Explained Why Multiple
rs_lastcommit, etc.
rs_lastcommit tran oqid 41 ...
DS2_a.my_db tran oqid 31 tran oqid 35 tran
oqid 39 tran oqid 43 ...
DS2_b.my_db tran oqid 32 tran oqid 36 tran
oqid 40 tran oqid 44 ...
DS2_c.my_db tran oqid 33 tran oqid 37 tran
oqid 41 tran oqid 45 ...
DS2_d.my_db tran oqid 34 tran oqid 38 tran
oqid 42 tran oqid 46 ...
Plausible Scenarios 1 - c committed after a, b,
d (long xactn) 2 - a, b, d suspended first 3 -
a, b, d rolled back due to deadlocks
56Multiple DSIs - Step 2 Explained Why Multiple
rs_lastcommit, etc.
rs_lastcommit tran oqid 39 ...
rs_lastcommit tran oqid 44 ...
rs_lastcommit tran oqid 41 ...
rs_lastcommit tran oqid 34 ...
DS2_a.my_db tran oqid 31 tran oqid 35 tran
oqid 39 tran oqid 43 ...
DS2_b.my_db tran oqid 32 tran oqid 36 tran
oqid 40 tran oqid 44 ...
DS2_c.my_db tran oqid 33 tran oqid 37 tran
oqid 41 tran oqid 45 ...
DS2_d.my_db tran oqid 34 tran oqid 38 tran
oqid 42 tran oqid 46 ...
Plausible Scenarios 1 - c committed after a, b,
d (long xactn) 2 - a, b, d suspended first 3 -
a, b, d rolled back due to deadlocks
57Multiple DSIs - Step 3Implement Parallelism
- Single Source subscriptions
- Each aliased database connection subscribes to
different transactions/different data - Determine parallel subscription mechanism
- Add a column to table ??? (i.e. acct 10)
- Add a parameter to procedure call ??? (spid 5)
- Subset tables for each connection
- Data partitioning (A-Z, 0ltlt10000)
- Table grouping (tables common in transactions)
58Multiple DSIs - Step 3Implement Parallelism
- Multiple Sources connections
- Each aliased DB connection different source DSI
- No code modification may be necessary
- May even benefit with Parallel DSI Multiple DSI
- Doesnt appear to add benefit if multiple DSIs
are from a single source, but if multiple sources
involved, it helps with large transactions OLTP
(i.e. corporate rollup of POS/Sales)
59Multiple DSIsDesign Considerations
- Indentity Columns in replicate
- One DSI needs to be dbo ..all identities use
dbo DSI - May also need parallel DSI
- Table/Proc Mods
- May need to add column for spid, suid, susername
- Provides serialization for processes and
prevents splitting transaction (bill for
Anesthesia and Xray) - rs_id based subscriptions
- Use bitmask of acct s/spid in subscriptions
60Multiple DSIsDesign Considerations (cont)
- Multiple DSIs Contention
- Transaction grouping could increase
inter-connection contention/deadlocking - set dsi_xact_group_size to -1 or low byte count
- ...or set dsi_max_xacts_in_group to low number (3
or 5) - Case Study 5 DSIs _at_ 200 tps 30 deadlocks
- Change clustered indexes
- Works well with partitioned data.
- Row-Level Locking??
61Multiple DSIsDesign Considerations (cont)
- What if Replicate is also a Primary
- Multiple DSIs vs. Primary Data
- Since using different maintenance users, RepAgent
may only know of oneor none effectively -A - alter connection set dsi_replication to off
- Or it may be desirable.
- One possible method for controlling which
transactions get re-replicated - use normal maint
user for ones you dont and multiple DSI for ones
you do...
62Multiple DSI - No Re-ReplicationPeer-to-Peer/Upat
e Anywhere
London
Chicago
New York
San Francisco
Washington DC
Dallas
63Multiple DSI - With Re-ReplicationPeer-to-Peer/Up
ate Anywhere
London
Chicago
New York
San Francisco
Washington DC
Dallas
64Multiple DSIs Cross Domain Replication
- Understanding Parallel DSIs
- Serialization Methods Parallelism
- Multiple DSIs
- Business Case
- Implementation Design Considerations
- Cross Domain Replication
- Business Case
- Implementation Design Considerations
65Cross Domain ReplicationeBusiness Case
Integration
Availability
- Access Analysis Corporate Information
- Plugn Play with Standard
- Internet Technologies
- Continuous Database Availability
- Realtime Database Maintenance Tuning
Database Requirements
Productivity
- Portal Productivity Technologies
- Web Transaction Management
66Cross Domain Replication
- Not automatically supported in RS, but
- Can be done - if you are careful
- loosely based off of multiple DSIs
- bidirectional can get a bit tricky
- Many ways of achieving this
- Replicating through another database via triggers
- Use Enterprise Event Broker/TIBCO, etc...
- We gonna just use Rep Server - nothing special
67Cant we just merge the replication domains??
- Yesif you use resource files
- rs.rs_start_rs_id USE_DEFAULT
- rs_ids start at 16777217 and end at 2147483647
- rs.rs_start_db_id USE_DEFAULT
- db_ids start at 100 and end at 16777216
- Then bcp info into other domain RSSDs
- which tables???
- Requires upfront planning
- Requires single system administrative group
68Cross Domain ReplicationBusiness Case
- Consider the following scenarios
- Bank X merges with Bank Y
- Govt agency to State Agency or other Govt
agency - Desire to integrate existing business unit
systems - Order entry, shipping, accounting
- Retail POS commissions Payroll
- Desire to share data with alliance partners
- Any large multi-tiered replication system
NEED
NEED
69Cross Domain ReplicationBusiness Case 1
Customer, Credit History, etc.
Credit Cards
Savings Accts
Mortgage Services
Loan Services
70Business Case 1Cross Business Lines
- sa access not desired - schemas totally
different - heterogenous support (CIS)
HR
Sales
71Cross Domain ReplicationBusiness Case 2
Customer
Rates
Credit Cards
Savings Accts
Mortgage Services
Loan Services
72Business Case 2Corporate System Integration
Corporate Financials
- local vs. corporate sa - different
application support - holding company vs. division
Busines Unit Autonomous
Order/Entry
Line Of Business
Regional Office
Accounting
POS/Sales
73Cross Domain ReplicationInformation Flow
- Replication within domains
- Tends to be more data driven
- Schemas can be somewhat similar
- Normalized, Denormalized Variants
- Replication between domains
- Can be data driven but primarily message
oriented - Schemas typically vary significantly
- Higher degree of function string usage
- or message queues
74Cross Domain ReplicationInformation Flow
Order 1234 Item 5678 Customer A9012 Qty
5 Price 300.00
Regional Office
Corporate Office
Sales Domain
ReOrder 34567 Item 5678 Store ID 7890 Qty
10 Price 185.00 Shipping 95.00
Store ID 7890 Dept Sporting Goods ReOrder
34567 Total Cost 1945.00
Store ID 7890 Dept Sportiing Goods Order
1234 Total 1500.00 Commission 150.00 Employee
Id 0123
Store ID 7890 Dept Sporting Goods Tran ID
1234567 Amount -1945.00
Store Id 7890 Dept Sporting Goods Tran ID
1234566 Amount 1350.00
Finance Accounting Domain
Emp Id 0123 Pay Adj 150.00 Adj Cd Comm
Regional Office
Corporate Office
75Cross Domain ReplicationImplementation Steps
- Clearly define information flow
- Attributes, Schema, Direction
- Define Domain Access Points
- Where will domains intersect ?
- How do we avoid duplicate data if multiple
access points are used ? - Configure replication
- Set up connections similar to multiple DSI
- Prevent unnecessary replication looping
76Cross Domain ReplicationDomain Access Points
- Singular
- Master dataserver is identified for each domain
- All exchange of data between the domains is
performed between the master DS/RS pairs - Multiple
- Geographic locale or other factor makes it more
efficient to have multiple access points - Different data elements at different access
points - Can lead to duplicate data if further replicated
77Cross Domain ReplicationSingle Domain Access
Point
DS2
DS1
DS1.db1
DS2.db2
DS3a.db1
DS1a.db1
DS4.db2
DS3.db1
DS3
DS4
78Cross Domain ReplicationMultiple Domain Access
Points
79Cross Domain ReplicationMultiple Domain Access
Points
Sales Domain
Accounting Finance Domain
Corporate Offices
Regional Offices
Field Offices
80Cross Domain ReplicationConnection Implementation
- Set up multiple DSIs to Access Points
- Alias Domain Access dataservers
- Implement multiple maint users, rs_lastcommit
- Define normal replication objects
- Create or use existing repdefs
- Additional repdefs may avoid function strings
- Add subscriptions to aliased DS in other domain
- Alter subscriptions with function strings
- Handle schema differences
81Cross Domain Replication Connection
Implementation
create replication definition authors_ds1
with primary at DS1.db1
DS1
DS2
DS1.db1
DS2.db2
create subscription authors_ds1_ds3a with
primary at DS1.db1 with replicate at DS3a.db1
DS1a.db1
create subscription authors_ds1_ds2 with
primary at DS1.db1 with replicate at DS2.db2
create subscription authors_ds3_ds1a with
primary at DS3.db1 with replicate at DS1a.db1
create subscription authors_ds3_ds4 with
primary at DS3.db1 with replicate at DS4.db2
DS3a.db1
DS3.db1
DS4.db2
DS3
create replication definition authors_ds3
with primary at DS3.db1
DS4
82Cross Domain ReplicationAvoiding Loops/Duplicate
Data
- Determine how to stop replication loops
- only applicable if applied data to be replicated
- ..else alter connection set dsi_replication off
on - caused when LTL get maintenance user for ds.db
will get maintenance user for the in-domain
connection - Similar to send_maint_xacts_to_replicate (-A)
- Determine how to stop duplicated data
- Only applicable to multiple domain access points
- Could involve replicated aggregates
83Cross Domain ReplicationReplication Looping
rs_insert acct1234, amt-450.00, date6/13/99
WDC
PHL
rs_insert acct1234, amt-450.00, date6/13/99
rs_insert acct1234, amt-450.00, date6/13/99
CHI
NYC
rs_insert acct1234, amt-450.00, date6/13/99
84Cross Domain ReplicationReplication Looping
- If proc based
- Use deliver as to exec non-replicated procs
- If data oriented
- Subscribe to different tables
- Typical if domains are different business
functions - Use two sets of tables - one for each direction
- More useful for queuing situations
- Add source to tables
- Useful for event based tables (bank acct
register)
85Cross Domain ReplicationReplication Looping -
Queuing
Regional Stores
Corporate Office
Sales Domain
Shipped Orders
Completed Orders
Shipments Cmplt
Shipment Rqsts
Shipping Domain
Regional Warehouses
Corporate Office
86Cross Domain ReplicationDuplicate Data
- At each tier level, data is replicated
- Within domain, it is replicated to next level
- Between domains it is replicated to other domain
- At each non-originating level
- The replicated aggregates are higher by a factor
- Result.
- Only replicate changes originating at tier
- Problem will also occur in single domain with -A
or with Multiple DSIs
87Cross Domain ReplicationDuplicate Data
Sales Domain
Accounting Finance Domain
total_sales2400.00
income9600.00
total_sales2400.00
income3600.00
total_sales2400.00
income3600.00
total_sales1200.00
total_sales600.00
income1200.00
total_sales600.00
total_sales300.00
income300.00
total_sales300.00
88In Summary
- Parallel DSIs
- Need tuning much like any thing else
- Can experience considerable contention
- Multiple DSIs
- Can improve performance by controlling contention
- Allows flexibility in data delivery
- Cross Domain Replication
- Based on multiple DSIs
- Useful between business units, for mergers, etc.
89If You Aint Cheatin.You Aint Tryin!!!!
(with apologies to VQ-2)