SlideShare a Scribd company logo
1 of 67
Download to read offline
Copyright©2018 NTT Corp. All Rights Reserved.
Architecture & Pitfalls

of Logical Replication
NTT OSS Center
Atsushi Torikoshi
PGConf.US 2018
2
Who am I
➢Atsushi Torikoshi
➢@atorik_shi
➢torikoshi_atsushi_z2@lab.ntt.co.jp
➢NTT Open Source Software Center
➢PostgreSQL technical support
➢PostgreSQL performance verification
Copyright©2018 NTT Corp. All Rights Reserved.
3
About NTT
• Who we are
– NTT(Nippon Telegraph and Telephone Corporation)
– Japanese telecommunications company
• What NTT OSS Center does
– Promotes the adoption of OSS by the group companies
• Total support
– support desk, Introduction support, Product maintenance
• R&D
– developing OSS and related tools with the communities
• Deals about 60 OSS products
– developing OSS and related tools with the communities
NTT
NTT OSS Center
Copyright©2018 NTT Corp. All Rights Reserved.
Copyright©2018 NTT Corp. All Rights Reserved.
4
•Background of Logical Replication
•Architecture and Behavior
•Pitfalls
•Summary
INDEX
Copyright©2018 NTT Corp. All Rights Reserved.
5
BACKGROUND OF
LOGICAL REPLICATION
Copyright©2018 NTT Corp. All Rights Reserved.
6
PostgreSQL has built-in Physical Replication
since 2010.
It replicates a whole DB by sending WAL.
Suitable for load balancing and high
availability.
Physical Replication
Upstream Downstream
sendTable
Table
Table
WALWAL WALWAL Table
Table
Table
replay
Copyright©2018 NTT Corp. All Rights Reserved.
7
Physical Replication cannot do things like:
• partial replication
• replication between different major version
PostgreSQL
Logical Replication has added flexibility to
built-in replication and made these things
possible!
Logical Replication
Upstream Downstream
decode, sendTable
Table
Table
WALWAL WALWAL Table
Table
apply
write
Copyright©2018 NTT Corp. All Rights Reserved.
8
Comparison between Logical and Physical Replication
Physical Logical
way of the
replication
Sending and
replaying all
WAL
decoding WAL and extracting changes
downstream DB copy of the
upstream DB
not necessarily the same as upstream
DB
up/downstream DB can be different
PostgreSQL version
manipulations
for downstream
DB
SELECT only No restriction, but some manipulations
may lead to conflict
What is
replicated
ALL views, partition root tables, large
objects and some manipulations
including DDL are NOT replicated
Copyright©2018 NTT Corp. All Rights Reserved.
9
Logical Replication enables flexible data
replication.
1. Replicating partial data for analytical
purpose
2. Consolidating multiple DBs into a single
one
3. Online version up
Expected use cases of Logical Replication
(1) (2)
(3)
Copyright©2018 NTT Corp. All Rights Reserved.
10
ARCHITECTURE

AND

BEHAVIOR
Copyright©2018 NTT Corp. All Rights Reserved.
11
• ‘walsender’ and ‘apply worker’ do most of
the work for Logical Replication.
• ‘sync worker’ and corresponding
‘walsender’ run only at initial table sync.
Basics of the architecture
WAL
wal
sender
Publisher (upstream)
write
wal
sender
apply
worker
launcher
sync
worker
launch
launch
Subscriber(downstream)
backend
process
read
decode
backend
process
Copyright©2018 NTT Corp. All Rights Reserved.
12
• ‘walsender’ reads WAL and decodes it. Then
sends it to subscriber.
• ‘apply worker’ applies that change.
Basics of the architecture ~replication
WAL
backend
process
wal
sender
Publisher
write
read
apply
worker
Subscriber
TableTableTable
write
decode
send
change
Copyright©2018 NTT Corp. All Rights Reserved.
13
• ‘walsender’ reassembles queries by its
transaction.
• When WAL is INSERT, UPDATE or DELETE,
‘walsender’ keeps the change in memory.
Basics of the architecture ~replication
WAL
walsender
INSERT
UPDATE
UPDATE
DELETE
UPDATE apply
worker
Publisher Subscriber
:transaction
Copyright©2018 NTT Corp. All Rights Reserved.
14
• ‘walsender’ reassembles queries by its
transaction.
• When WAL is INSERT, UPDATE or DELETE,
‘walsender’ keeps the change in memory.
Basics of the architecture ~replication
WAL
walsender
INSERT
UPDATE
UPDATE
DELETE
UPDATE
1. read WAL
apply
worker
Publisher Subscriber
:transaction
Copyright©2018 NTT Corp. All Rights Reserved.
15
• ‘walsender’ reassembles queries by its
transaction.
• When WAL is INSERT, UPDATE or DELETE,
‘walsender’ keeps the change in memory.
Basics of the architecture ~replication
WAL
walsender
INSERT
INSERT
UPDATE
UPDATE
DELETE
UPDATE
1. read WAL
2. decode
apply
worker
Publisher Subscriber
:transaction
Copyright©2018 NTT Corp. All Rights Reserved.
16
• ‘walsender’ reassembles queries by its
transaction.
• When WAL is INSERT, UPDATE or DELETE,
‘walsender’ keeps the change in memory.
Basics of the architecture ~replication
WAL
walsender
INSERT
INSERT
UPDATE
UPDATE
DELETE
UPDATE
1. read WAL
2. decode
3. reassemble
by transaction
apply
worker
Publisher Subscriber
:transaction
INSERT
Copyright©2018 NTT Corp. All Rights Reserved.
17
• When WAL is COMMIT, ‘walsender’ sends all
the changes for that transaction to
subscriber.
Basics of the architecture ~replication
:transaction
WAL
apply
worker
walsender
COMMIT
INSERT
UPDATE
UPDATE
DELETE
UPDATE
1. read WAL
2. decode
4. send
Publisher Subscriber
3. reassemble
by transaction
COMMIT
Copyright©2018 NTT Corp. All Rights Reserved.
18
• When WAL is ROLLBACK, ‘walsender’ just
throws away the changes for that
transaction.
Basics of the architecture ~replication
:transaction
WAL
walsender
ROLLBACK
INSERT
UPDATE
UPDATE
DELETE
UPDATE
ROLLBACK
1. read WAL
2. decode
4. cleanup
apply
worker
Publisher Subscriber
3. reassemble
by transaction
Copyright©2018 NTT Corp. All Rights Reserved.
19
• At initial table sync, COPY runs.
• COPY is done by dedicated ‘walsender’ and
sync worker. These processes exit after
COPY is done.
Initial table sync
WAL
backend
process
wal
sender
Publisher
write
read
apply
worker
Subscriber
TableTableTable
sync
worker
wal
sender write
(COPY)
Copyright©2018 NTT Corp. All Rights Reserved.
20
• PostgreSQL doesn’t have merge agents for
conflict resolution. If there are multiple
changes for the same data at one time, the
last change is reflected.
(Not) Conflict
Publisher Subscriber
id name
1 ‘A’
2 ‘B’
id name
1 ‘A’
2 ‘B’
Copyright©2018 NTT Corp. All Rights Reserved.
21
• PostgreSQL doesn’t have merge agents for
conflict resolution. If there are multiple
changes for the same data at one time, the
last change is reflected.
(Not) Conflict
Publisher Subscriber
2. UPDATE table SET name = ‘Y‘
WHERE id = 2
id name
1 ‘A’
2 ‘Y’
1. UPDATE table SET name = ‘X‘
WHERE id = 2
id name
1 ‘A’
2 ‘X’
Copyright©2018 NTT Corp. All Rights Reserved.
22
• PostgreSQL doesn’t have merge agents for
conflict resolution. If there are multiple
changes for the same data at one time, the
last change is reflected.
(Not) Conflict
Publisher Subscriber
2. UPDATE table SET name = ‘Y‘
WHERE id = 2
id name
1 ‘A’
2 ‘X’
1. UPDATE table SET name = ‘X‘
WHERE id = 2
3. replicate
id name
1 ‘A’
2 ‘X’
Copyright©2018 NTT Corp. All Rights Reserved.
23
• If replicating data causes an error at
subscriber side, the replication stops.
Conflict
Publisher Subscriber
id
1
2
1. INSERT INTO table VALUES (2);
id
1
2
2. INSERT INTO table VALUES (2);
Copyright©2018 NTT Corp. All Rights Reserved.
24
• If replicating data causes an error at
subscriber side, the replication stops.
Conflict
Publisher Subscriber
id
1
2
1. INSERT INTO table VALUES (2);
id
1
2
2. INSERT INTO table VALUES (2);
3. replicate
Copyright©2018 NTT Corp. All Rights Reserved.
25
• If replicating data causes an error at
subscriber side, the replication stops.
Conflict
Publisher Subscriber
id
1
2
2. INSERT INTO table VALUES (2);
id
1
2
1. INSERT INTO table VALUES (2);
3. replicate 4. conflict
Copyright©2018 NTT Corp. All Rights Reserved.
26
• Users must resolve conflict manually.
• After the conflict is resolved, replication is
resumed.
Conflict
Publisher Subscriber
id
1
2
2. INSERT INTO table VALUES (2);
id
1
2
1. INSERT INTO table VALUES (2);
3. replicate 4. conflict
Copyright©2018 NTT Corp. All Rights Reserved.
27
PITFALLS
Copyright©2018 NTT Corp. All Rights Reserved.
28
Q1. How does ‘walsender’ deal with WAL
which are NOT target of replication?
Copyright©2018 NTT Corp. All Rights Reserved.
29
A1. ‘walsender’ decodes most of
the WAL.
Copyright©2018 NTT Corp. All Rights Reserved.
30
• behavior: 'walsender’ decodes *all* of the
changes to the target database, NOT just
the changes to subscribed tables.
1. ‘walsender’ decodes most of the WAL
Copyright©2018 NTT Corp. All Rights Reserved.
31
• pitfall: Changes in non-subscribed tables
even consume resources, such as CPU and
memory.
1. ‘walsender’ decodes most of the WAL
perf visualization of walsender updating only non-subscribed tables
DecodeDelete DecodeInsert DecodeCommit
Copyright©2018 NTT Corp. All Rights Reserved.
32
• Lesson: ‘walsender’ consumes resources
depending on the whole amount of changes
on the publisher database database, NOT
only on the amount of changes on
subscribed tables.
1. ‘walsender’ decodes most of the WAL
Copyright©2018 NTT Corp. All Rights Reserved.
33
Q2. Does keeping changes on walsender
cause issues?
Copyright©2018 NTT Corp. All Rights Reserved.
34
A2. Yes, It may consume a lot of memory.
Copyright©2018 NTT Corp. All Rights Reserved.
35
• behavior: ‘walsender’ keeps each change of
a transaction in memory until COMMIT or
ROLLBACK.
2. ‘walsender’ may consume a lot of memory
Copyright©2018 NTT Corp. All Rights Reserved.
36
• pitfall: It may cause ‘walsender’ to
consume a lot of memory.
2. ‘walsender’ may consume a lot of memory
Type of manipulation Measures to prevent memory use
many changes in
one transaction
walsender’ has a feature to spill
out changes to disk, when the
number of changes in one
transaction exceeds 4096.
changes which
modifies much data
There are no feature to avoid using
memory.
many transactions
many savepoints
※ Patches changing this behavior are under discussion.
Copyright©2018 NTT Corp. All Rights Reserved.
37
• lesson: If possible, it’s better to avoid the
manipulations which have no measures to
prevent consuming a lot of memory.
Monitoring memory usage at publisher may
be a good idea.
2. ‘walsender’ may consume a lot of memory
Copyright©2018 NTT Corp. All Rights Reserved.
38
Q3. Can we use synchronous replication in
Logical Replication?
Copyright©2018 NTT Corp. All Rights Reserved.
39
A3. Yes, but the response time may
be quite long.
Copyright©2018 NTT Corp. All Rights Reserved.
40
• behavior: Under synchronous replication,
before replying to the client, publishers
wait for the COMMIT responses from all the
subscribers.
3. The response time may be quite long
Publisher
table
2
table
1
Client
BEGIN;
INSERT INTO Table1 VALUES (‘a’);
COMMIT;
(1)
(4)
Subscriber
table
1
BEGIN;
INSERT INTO Table1 VALUES (‘a’);
COMMIT;
(2)
(3)
Table1
Copyright©2018 NTT Corp. All Rights Reserved.
41
• pitfall: Under synchronous replication,
Publishers wait for COMMIT responses from
all the subscribers, even when there are no
changes to those subscribers.
3. The response time may be quite long
Publisher
table
2
table
1 Subscriber2
table
2
Client
BEGIN;
INSERT INTO Table1 VALUES (‘a’);
COMMIT;
Sends only
BEGIN and COMMIT
(1)
(2)
(3)
(4)
Subscriber1
table
1
BEGIN;
INSERT INTO Table1 VALUES (‘a’);
COMMIT;
(2)
(3)
Table1
Copyright©2018 NTT Corp. All Rights Reserved.
42
• lesson: The response time to clients
depends on the slowest subscriber.
• Also, as we’ve seen it on Q2, ‘walsender‘
sends changes to ‘apply worker’ after
COMMIT, it also tends to make response
time longer.
• It may also be beneficial to confirm you
really need synchronous replication.
3. The response time may be quite long
Copyright©2018 NTT Corp. All Rights Reserved.
43
Q4. Is the way to monitor the status of
replication the same as Physical
Replication?
Copyright©2018 NTT Corp. All Rights Reserved.
44
A4. Only monitoring pg_stat_replication
might not be enough.
Copyright©2018 NTT Corp. All Rights Reserved.
45
• behavior: Initial table sync is done by
dedicated processes, sync worker and
walsender.
4. pg_stat_replication might not be enough
WAL
backend
process
wal
sender
Publisher
write
read
apply
worker
Subscriber
TableTableTable
sync
worker
wal
sender write
(COPY)
Copyright©2018 NTT Corp. All Rights Reserved.
46
• pitfall: Even if ‘sync worker’ failed to start
and nothing has been replicated yet,
pg_stat_replication.state is ‘streaming’.
4. pg_stat_replication might not be enough
Copyright©2018 NTT Corp. All Rights Reserved.
47
• lesson: We should also monitor
pg_subscription_rel and check ‘srsubstate’
is ‘r’, meaning ready.
4. pg_stat_replication might not be enough
Copyright©2018 NTT Corp. All Rights Reserved.
48
Q5. How should we resolve the conflict?
Copyright©2018 NTT Corp. All Rights Reserved.
49
A5. We can use
pg_replication_origin_advance(),
but it may skip some data.
Copyright©2018 NTT Corp. All Rights Reserved.
50
• behavior: pg_replication_origin_advance()
enables us to set the LSN up to which data
has been replicated.
5. pg_replication_origin_advance() may skip data
| |
10 20
remote lsn
Here
Copyright©2018 NTT Corp. All Rights Reserved.
51
• behavior: pg_replication_origin_advance()
enables us to set the LSN up to which data
has been replicated.
5. pg_replication_origin_advance() may skip data
| |
10 20
remote lsn
pg_replication_origin_advance(‘node_name’, 20)
Here
Copyright©2018 NTT Corp. All Rights Reserved.
52
• behavior: pg_replication_origin_advance()
enables us to set the LSN up to which data
has been replicated.
5. pg_replication_origin_advance() may skip data
| |
10 20
remote lsn
pg_replication_origin_advance(‘node_name’, 20)
Here
Conflict point
Copyright©2018 NTT Corp. All Rights Reserved.
53
• pitfalls: If there are some changes on the
publisher after the conflict,
pg_replication_origin_advance(‘current wal
lsn on publisher’) skips applying that
changes.
5. pg_replication_origin_advance() may skip data
| |
10 20
remote lsn
pg_replication_origin_advance(‘node_name’, 20)
INSERT
UPDATEConflict point
Copyright©2018 NTT Corp. All Rights Reserved.
54
• lessons: Changing conflicting data on the
subscriber may be usually a better choice.
5. pg_replication_origin_advance() may skip data
Copyright©2018 NTT Corp. All Rights Reserved.
55
Q6. Can backup be performed usual?
Copyright©2018 NTT Corp. All Rights Reserved.
56
A6. Backup DB under Logical Replication
may need additional procedure.
Copyright©2018 NTT Corp. All Rights Reserved.
57
• behavior: pg_dump doesn't backup
pg_subscription_rel, which keeps the state
of initial table sync.
6. Logical Replication may need additional procedure
Copyright©2018 NTT Corp. All Rights Reserved.
58
• pitfalls: Restoring data backed up by
pg_dump at a subscriber causes initial table
sync again.
It usually makes the replication stop due to
key duplication error.
6. Logical Replication may need additional procedure
Publisher Subscriber
pg_dump
TableTableTable
Copyright©2018 NTT Corp. All Rights Reserved.
59
• pitfalls: Restoring data backed up by
pg_dump at a subscriber causes initial table
synchronization again.
It usually makes the replication stop due to
key duplication error.
6. Logical Replication may need additional procedure
Publisher Subscriber
(1)restore
pg_dump
TableTableTable TableTableTable
Copyright©2018 NTT Corp. All Rights Reserved.
60
• pitfalls: Restoring data backed up by
pg_dump at a subscriber causes initial table
synchronization again.
It usually makes the replication stop due to
key duplication error.
6. Logical Replication may need additional procedure
Publisher Subscriber
(1)restore
pg_dump
TableTableTable TableTableTable
(2)replication
Copyright©2018 NTT Corp. All Rights Reserved.
61
• pitfalls: Restoring data backed up by
pg_dump at a subscriber causes initial table
synchronization again.
It usually makes the replication stop due to
key duplication error.
6. Logical Replication may need additional procedure
Publisher Subscriber
(1)restore
pg_dump
TableTableTable TableTableTable
(3)conflict
(2)replication
Copyright©2018 NTT Corp. All Rights Reserved.
62
• lessons: We can avoid this resyncing by
refresh subscription with 'copy_data =
false‘.
But if a subscription has tables which have
not completed the initial sync, we need
more work..
It's better to consider well what data is
really necessary and how to prevent data
loss.
In some cases it may be better to start
replication from scratch.
6. Logical Replication may need additional procedure
Copyright©2018 NTT Corp. All Rights Reserved.
63
SUMMARY
Copyright©2018 NTT Corp. All Rights Reserved.
64
Design
Take into account some counterintuitive
behaviors which cause performance impact.
• ‘walsender’ keeps changes in memory
• In sync replication, publishers wait for COMMIT
from all the subscribers even which have no
change.
• Changes on non-subscribed tables are also
decoded.
How should we manage Logical Replication?
Copyright©2018 NTT Corp. All Rights Reserved.
65
Monitoring
• Monitor memory usage on publisher.
• Monitor not only pg_stat_replication but
pg_subscription_rel.
How should we manage Logical Replication?
Copyright©2018 NTT Corp. All Rights Reserved.
66
Operation
• pg_replication_origin_advance() may skip
some data.
• Backup and restore need some extra
procedures, It's better to consider well
what data is really necessary and how to
prevent data loss.
How should we manage Logical Replication?
Copyright©2018 NTT Corp. All Rights Reserved.
67
Thank you !
torikoshi_atsushi_z2@lab.ntt.co.jp
@atorik_shi

More Related Content

What's hot

PostgreSQLをKubernetes上で活用するためのOperator紹介!(Cloud Native Database Meetup #3 発表資料)
PostgreSQLをKubernetes上で活用するためのOperator紹介!(Cloud Native Database Meetup #3 発表資料)PostgreSQLをKubernetes上で活用するためのOperator紹介!(Cloud Native Database Meetup #3 発表資料)
PostgreSQLをKubernetes上で活用するためのOperator紹介!(Cloud Native Database Meetup #3 発表資料)NTT DATA Technology & Innovation
 
Introduction VAUUM, Freezing, XID wraparound
Introduction VAUUM, Freezing, XID wraparoundIntroduction VAUUM, Freezing, XID wraparound
Introduction VAUUM, Freezing, XID wraparoundMasahiko Sawada
 
速習!論理レプリケーション ~基礎から最新動向まで~(PostgreSQL Conference Japan 2022 発表資料)
速習!論理レプリケーション ~基礎から最新動向まで~(PostgreSQL Conference Japan 2022 発表資料)速習!論理レプリケーション ~基礎から最新動向まで~(PostgreSQL Conference Japan 2022 発表資料)
速習!論理レプリケーション ~基礎から最新動向まで~(PostgreSQL Conference Japan 2022 発表資料)NTT DATA Technology & Innovation
 
フックを使ったPostgreSQLの拡張機能を作ってみよう!(第33回PostgreSQLアンカンファレンス@オンライン 発表資料)
フックを使ったPostgreSQLの拡張機能を作ってみよう!(第33回PostgreSQLアンカンファレンス@オンライン 発表資料)フックを使ったPostgreSQLの拡張機能を作ってみよう!(第33回PostgreSQLアンカンファレンス@オンライン 発表資料)
フックを使ったPostgreSQLの拡張機能を作ってみよう!(第33回PostgreSQLアンカンファレンス@オンライン 発表資料)NTT DATA Technology & Innovation
 
押さえておきたい、PostgreSQL 13 の新機能!!(Open Source Conference 2021 Online/Hokkaido 発表資料)
押さえておきたい、PostgreSQL 13 の新機能!!(Open Source Conference 2021 Online/Hokkaido 発表資料)押さえておきたい、PostgreSQL 13 の新機能!!(Open Source Conference 2021 Online/Hokkaido 発表資料)
押さえておきたい、PostgreSQL 13 の新機能!!(Open Source Conference 2021 Online/Hokkaido 発表資料)NTT DATA Technology & Innovation
 
Keycloak入門-OpenID ConnectによるAPIセキュリティ
Keycloak入門-OpenID ConnectによるAPIセキュリティKeycloak入門-OpenID ConnectによるAPIセキュリティ
Keycloak入門-OpenID ConnectによるAPIセキュリティYuichi Nakamura
 
コンテナ未経験新人が学ぶコンテナ技術入門
コンテナ未経験新人が学ぶコンテナ技術入門コンテナ未経験新人が学ぶコンテナ技術入門
コンテナ未経験新人が学ぶコンテナ技術入門Kohei Tokunaga
 
PGOを用いたPostgreSQL on Kubernetes入門(Open Source Conference 2023 Online/Hokkaido...
PGOを用いたPostgreSQL on Kubernetes入門(Open Source Conference 2023 Online/Hokkaido...PGOを用いたPostgreSQL on Kubernetes入門(Open Source Conference 2023 Online/Hokkaido...
PGOを用いたPostgreSQL on Kubernetes入門(Open Source Conference 2023 Online/Hokkaido...NTT DATA Technology & Innovation
 
NATS Streaming - an alternative to Apache Kafka?
NATS Streaming - an alternative to Apache Kafka?NATS Streaming - an alternative to Apache Kafka?
NATS Streaming - an alternative to Apache Kafka?Anton Zadorozhniy
 
Kvm performance optimization for ubuntu
Kvm performance optimization for ubuntuKvm performance optimization for ubuntu
Kvm performance optimization for ubuntuSim Janghoon
 
PostgreSQLのgitレポジトリから見える2022年の開発状況(第38回PostgreSQLアンカンファレンス@オンライン 発表資料)
PostgreSQLのgitレポジトリから見える2022年の開発状況(第38回PostgreSQLアンカンファレンス@オンライン 発表資料)PostgreSQLのgitレポジトリから見える2022年の開発状況(第38回PostgreSQLアンカンファレンス@オンライン 発表資料)
PostgreSQLのgitレポジトリから見える2022年の開発状況(第38回PostgreSQLアンカンファレンス@オンライン 発表資料)NTT DATA Technology & Innovation
 
PostgreSQL 13でのpg_stat_statementsの改善について(第12回PostgreSQLアンカンファレンス@オンライン 発表資料)
PostgreSQL 13でのpg_stat_statementsの改善について(第12回PostgreSQLアンカンファレンス@オンライン 発表資料)PostgreSQL 13でのpg_stat_statementsの改善について(第12回PostgreSQLアンカンファレンス@オンライン 発表資料)
PostgreSQL 13でのpg_stat_statementsの改善について(第12回PostgreSQLアンカンファレンス@オンライン 発表資料)NTT DATA Technology & Innovation
 
Patroni: Kubernetes-native PostgreSQL companion
Patroni: Kubernetes-native PostgreSQL companionPatroni: Kubernetes-native PostgreSQL companion
Patroni: Kubernetes-native PostgreSQL companionAlexander Kukushkin
 
DockerとPodmanの比較
DockerとPodmanの比較DockerとPodmanの比較
DockerとPodmanの比較Akihiro Suda
 
Solving PostgreSQL wicked problems
Solving PostgreSQL wicked problemsSolving PostgreSQL wicked problems
Solving PostgreSQL wicked problemsAlexander Korotkov
 
Grafana LokiではじめるKubernetesロギングハンズオン(NTT Tech Conference #4 ハンズオン資料)
Grafana LokiではじめるKubernetesロギングハンズオン(NTT Tech Conference #4 ハンズオン資料)Grafana LokiではじめるKubernetesロギングハンズオン(NTT Tech Conference #4 ハンズオン資料)
Grafana LokiではじめるKubernetesロギングハンズオン(NTT Tech Conference #4 ハンズオン資料)NTT DATA Technology & Innovation
 
祝!PostgreSQLレプリケーション10周年!徹底紹介!!
祝!PostgreSQLレプリケーション10周年!徹底紹介!!祝!PostgreSQLレプリケーション10周年!徹底紹介!!
祝!PostgreSQLレプリケーション10周年!徹底紹介!!NTT DATA Technology & Innovation
 
CNIふぉーびぎなーず
CNIふぉーびぎなーずCNIふぉーびぎなーず
CNIふぉーびぎなーずTomofumi Hayashi
 

What's hot (20)

HBase at LINE
HBase at LINEHBase at LINE
HBase at LINE
 
PostgreSQLをKubernetes上で活用するためのOperator紹介!(Cloud Native Database Meetup #3 発表資料)
PostgreSQLをKubernetes上で活用するためのOperator紹介!(Cloud Native Database Meetup #3 発表資料)PostgreSQLをKubernetes上で活用するためのOperator紹介!(Cloud Native Database Meetup #3 発表資料)
PostgreSQLをKubernetes上で活用するためのOperator紹介!(Cloud Native Database Meetup #3 発表資料)
 
Introduction VAUUM, Freezing, XID wraparound
Introduction VAUUM, Freezing, XID wraparoundIntroduction VAUUM, Freezing, XID wraparound
Introduction VAUUM, Freezing, XID wraparound
 
速習!論理レプリケーション ~基礎から最新動向まで~(PostgreSQL Conference Japan 2022 発表資料)
速習!論理レプリケーション ~基礎から最新動向まで~(PostgreSQL Conference Japan 2022 発表資料)速習!論理レプリケーション ~基礎から最新動向まで~(PostgreSQL Conference Japan 2022 発表資料)
速習!論理レプリケーション ~基礎から最新動向まで~(PostgreSQL Conference Japan 2022 発表資料)
 
フックを使ったPostgreSQLの拡張機能を作ってみよう!(第33回PostgreSQLアンカンファレンス@オンライン 発表資料)
フックを使ったPostgreSQLの拡張機能を作ってみよう!(第33回PostgreSQLアンカンファレンス@オンライン 発表資料)フックを使ったPostgreSQLの拡張機能を作ってみよう!(第33回PostgreSQLアンカンファレンス@オンライン 発表資料)
フックを使ったPostgreSQLの拡張機能を作ってみよう!(第33回PostgreSQLアンカンファレンス@オンライン 発表資料)
 
押さえておきたい、PostgreSQL 13 の新機能!!(Open Source Conference 2021 Online/Hokkaido 発表資料)
押さえておきたい、PostgreSQL 13 の新機能!!(Open Source Conference 2021 Online/Hokkaido 発表資料)押さえておきたい、PostgreSQL 13 の新機能!!(Open Source Conference 2021 Online/Hokkaido 発表資料)
押さえておきたい、PostgreSQL 13 の新機能!!(Open Source Conference 2021 Online/Hokkaido 発表資料)
 
Keycloak入門-OpenID ConnectによるAPIセキュリティ
Keycloak入門-OpenID ConnectによるAPIセキュリティKeycloak入門-OpenID ConnectによるAPIセキュリティ
Keycloak入門-OpenID ConnectによるAPIセキュリティ
 
コンテナ未経験新人が学ぶコンテナ技術入門
コンテナ未経験新人が学ぶコンテナ技術入門コンテナ未経験新人が学ぶコンテナ技術入門
コンテナ未経験新人が学ぶコンテナ技術入門
 
PGOを用いたPostgreSQL on Kubernetes入門(Open Source Conference 2023 Online/Hokkaido...
PGOを用いたPostgreSQL on Kubernetes入門(Open Source Conference 2023 Online/Hokkaido...PGOを用いたPostgreSQL on Kubernetes入門(Open Source Conference 2023 Online/Hokkaido...
PGOを用いたPostgreSQL on Kubernetes入門(Open Source Conference 2023 Online/Hokkaido...
 
NATS Streaming - an alternative to Apache Kafka?
NATS Streaming - an alternative to Apache Kafka?NATS Streaming - an alternative to Apache Kafka?
NATS Streaming - an alternative to Apache Kafka?
 
Kvm performance optimization for ubuntu
Kvm performance optimization for ubuntuKvm performance optimization for ubuntu
Kvm performance optimization for ubuntu
 
PostgreSQLのgitレポジトリから見える2022年の開発状況(第38回PostgreSQLアンカンファレンス@オンライン 発表資料)
PostgreSQLのgitレポジトリから見える2022年の開発状況(第38回PostgreSQLアンカンファレンス@オンライン 発表資料)PostgreSQLのgitレポジトリから見える2022年の開発状況(第38回PostgreSQLアンカンファレンス@オンライン 発表資料)
PostgreSQLのgitレポジトリから見える2022年の開発状況(第38回PostgreSQLアンカンファレンス@オンライン 発表資料)
 
PostgreSQL 13でのpg_stat_statementsの改善について(第12回PostgreSQLアンカンファレンス@オンライン 発表資料)
PostgreSQL 13でのpg_stat_statementsの改善について(第12回PostgreSQLアンカンファレンス@オンライン 発表資料)PostgreSQL 13でのpg_stat_statementsの改善について(第12回PostgreSQLアンカンファレンス@オンライン 発表資料)
PostgreSQL 13でのpg_stat_statementsの改善について(第12回PostgreSQLアンカンファレンス@オンライン 発表資料)
 
Patroni: Kubernetes-native PostgreSQL companion
Patroni: Kubernetes-native PostgreSQL companionPatroni: Kubernetes-native PostgreSQL companion
Patroni: Kubernetes-native PostgreSQL companion
 
DockerとPodmanの比較
DockerとPodmanの比較DockerとPodmanの比較
DockerとPodmanの比較
 
Solving PostgreSQL wicked problems
Solving PostgreSQL wicked problemsSolving PostgreSQL wicked problems
Solving PostgreSQL wicked problems
 
今さら聞けない人のためのKubernetes超入門
今さら聞けない人のためのKubernetes超入門今さら聞けない人のためのKubernetes超入門
今さら聞けない人のためのKubernetes超入門
 
Grafana LokiではじめるKubernetesロギングハンズオン(NTT Tech Conference #4 ハンズオン資料)
Grafana LokiではじめるKubernetesロギングハンズオン(NTT Tech Conference #4 ハンズオン資料)Grafana LokiではじめるKubernetesロギングハンズオン(NTT Tech Conference #4 ハンズオン資料)
Grafana LokiではじめるKubernetesロギングハンズオン(NTT Tech Conference #4 ハンズオン資料)
 
祝!PostgreSQLレプリケーション10周年!徹底紹介!!
祝!PostgreSQLレプリケーション10周年!徹底紹介!!祝!PostgreSQLレプリケーション10周年!徹底紹介!!
祝!PostgreSQLレプリケーション10周年!徹底紹介!!
 
CNIふぉーびぎなーず
CNIふぉーびぎなーずCNIふぉーびぎなーず
CNIふぉーびぎなーず
 

Similar to PostgreSQL Logical Replication Architecture, Pitfalls & Best Practices

Vacuum more efficient than ever
Vacuum more efficient than everVacuum more efficient than ever
Vacuum more efficient than everMasahiko Sawada
 
OpenStackを利用したEnterprise Cloudを支える技術 - OpenStack最新情報セミナー 2016年5月
OpenStackを利用したEnterprise Cloudを支える技術 - OpenStack最新情報セミナー 2016年5月OpenStackを利用したEnterprise Cloudを支える技術 - OpenStack最新情報セミナー 2016年5月
OpenStackを利用したEnterprise Cloudを支える技術 - OpenStack最新情報セミナー 2016年5月VirtualTech Japan Inc.
 
Media processing with serverless architecture
Media processing with serverless architectureMedia processing with serverless architecture
Media processing with serverless architectureKensaku Komatsu
 
Kirin User Story: Migrating Mission Critical Applications to OpenStack Privat...
Kirin User Story: Migrating Mission Critical Applications to OpenStack Privat...Kirin User Story: Migrating Mission Critical Applications to OpenStack Privat...
Kirin User Story: Migrating Mission Critical Applications to OpenStack Privat...Motoki Kakinuma
 
NTTドコモ様 導入事例 OpenStack Summit 2015 Tokyo 講演「After One year of OpenStack Cloud...
NTTドコモ様 導入事例 OpenStack Summit 2015 Tokyo 講演「After One year of OpenStack Cloud...NTTドコモ様 導入事例 OpenStack Summit 2015 Tokyo 講演「After One year of OpenStack Cloud...
NTTドコモ様 導入事例 OpenStack Summit 2015 Tokyo 講演「After One year of OpenStack Cloud...VirtualTech Japan Inc.
 
training report on embedded system and AVR
training report on embedded system and AVRtraining report on embedded system and AVR
training report on embedded system and AVRUrvashi Khandelwal
 
OpenStack Summit Tokyo - Know-how of Challlenging Deploy/Operation NTT DOCOMO...
OpenStack Summit Tokyo - Know-how of Challlenging Deploy/Operation NTT DOCOMO...OpenStack Summit Tokyo - Know-how of Challlenging Deploy/Operation NTT DOCOMO...
OpenStack Summit Tokyo - Know-how of Challlenging Deploy/Operation NTT DOCOMO...Masaaki Nakagawa
 
Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive

Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive

Cloudera, Inc.
 
Lessons Learned from Leveraging Real-Time Power Consumption Data with Apache ...
Lessons Learned from Leveraging Real-Time Power Consumption Data with Apache ...Lessons Learned from Leveraging Real-Time Power Consumption Data with Apache ...
Lessons Learned from Leveraging Real-Time Power Consumption Data with Apache ...Hitachi, Ltd. OSS Solution Center.
 
Sensor Data in InfluxDB by David Simmons, IoT Developer Evangelist | InfluxData
Sensor Data in InfluxDB by David Simmons, IoT Developer Evangelist | InfluxDataSensor Data in InfluxDB by David Simmons, IoT Developer Evangelist | InfluxData
Sensor Data in InfluxDB by David Simmons, IoT Developer Evangelist | InfluxDataInfluxData
 
YugaByte DB Internals - Storage Engine and Transactions
YugaByte DB Internals - Storage Engine and Transactions YugaByte DB Internals - Storage Engine and Transactions
YugaByte DB Internals - Storage Engine and Transactions Yugabyte
 
NFV Infrastructure Manager with High Performance Software Switch Lagopus
NFV Infrastructure Manager with High Performance Software Switch Lagopus NFV Infrastructure Manager with High Performance Software Switch Lagopus
NFV Infrastructure Manager with High Performance Software Switch Lagopus Hirofumi Ichihara
 
How YugaByte DB Implements Distributed PostgreSQL
How YugaByte DB Implements Distributed PostgreSQLHow YugaByte DB Implements Distributed PostgreSQL
How YugaByte DB Implements Distributed PostgreSQLYugabyte
 
The Principle Of Ultrasound Imaging System
The Principle Of Ultrasound Imaging SystemThe Principle Of Ultrasound Imaging System
The Principle Of Ultrasound Imaging SystemMelissa Luster
 
Lagopus presentation on 14th Annual ON*VECTOR International Photonics Workshop
Lagopus presentation on 14th Annual ON*VECTOR International Photonics WorkshopLagopus presentation on 14th Annual ON*VECTOR International Photonics Workshop
Lagopus presentation on 14th Annual ON*VECTOR International Photonics WorkshopLagopus SDN/OpenFlow switch
 
Migrating Airflow-based Apache Spark Jobs to Kubernetes – the Native Way
Migrating Airflow-based Apache Spark Jobs to Kubernetes – the Native WayMigrating Airflow-based Apache Spark Jobs to Kubernetes – the Native Way
Migrating Airflow-based Apache Spark Jobs to Kubernetes – the Native WayDatabricks
 
Bloat and Fragmentation in PostgreSQL
Bloat and Fragmentation in PostgreSQLBloat and Fragmentation in PostgreSQL
Bloat and Fragmentation in PostgreSQLMasahiko Sawada
 
FIAT/IFTA MMC Seminar May 2015. Key Points for a Successful Migration. Fikriy...
FIAT/IFTA MMC Seminar May 2015. Key Points for a Successful Migration. Fikriy...FIAT/IFTA MMC Seminar May 2015. Key Points for a Successful Migration. Fikriy...
FIAT/IFTA MMC Seminar May 2015. Key Points for a Successful Migration. Fikriy...FIAT/IFTA
 
Getting Started: Intro to Telegraf - July 2021
Getting Started: Intro to Telegraf - July 2021Getting Started: Intro to Telegraf - July 2021
Getting Started: Intro to Telegraf - July 2021InfluxData
 
Labqazwsxedcrfvtgbyhnujmqazwsxedcrfvtgbyhnujmqazwsx.pptx
Labqazwsxedcrfvtgbyhnujmqazwsxedcrfvtgbyhnujmqazwsx.pptxLabqazwsxedcrfvtgbyhnujmqazwsxedcrfvtgbyhnujmqazwsx.pptx
Labqazwsxedcrfvtgbyhnujmqazwsxedcrfvtgbyhnujmqazwsx.pptxMostafaKhaled78
 

Similar to PostgreSQL Logical Replication Architecture, Pitfalls & Best Practices (20)

Vacuum more efficient than ever
Vacuum more efficient than everVacuum more efficient than ever
Vacuum more efficient than ever
 
OpenStackを利用したEnterprise Cloudを支える技術 - OpenStack最新情報セミナー 2016年5月
OpenStackを利用したEnterprise Cloudを支える技術 - OpenStack最新情報セミナー 2016年5月OpenStackを利用したEnterprise Cloudを支える技術 - OpenStack最新情報セミナー 2016年5月
OpenStackを利用したEnterprise Cloudを支える技術 - OpenStack最新情報セミナー 2016年5月
 
Media processing with serverless architecture
Media processing with serverless architectureMedia processing with serverless architecture
Media processing with serverless architecture
 
Kirin User Story: Migrating Mission Critical Applications to OpenStack Privat...
Kirin User Story: Migrating Mission Critical Applications to OpenStack Privat...Kirin User Story: Migrating Mission Critical Applications to OpenStack Privat...
Kirin User Story: Migrating Mission Critical Applications to OpenStack Privat...
 
NTTドコモ様 導入事例 OpenStack Summit 2015 Tokyo 講演「After One year of OpenStack Cloud...
NTTドコモ様 導入事例 OpenStack Summit 2015 Tokyo 講演「After One year of OpenStack Cloud...NTTドコモ様 導入事例 OpenStack Summit 2015 Tokyo 講演「After One year of OpenStack Cloud...
NTTドコモ様 導入事例 OpenStack Summit 2015 Tokyo 講演「After One year of OpenStack Cloud...
 
training report on embedded system and AVR
training report on embedded system and AVRtraining report on embedded system and AVR
training report on embedded system and AVR
 
OpenStack Summit Tokyo - Know-how of Challlenging Deploy/Operation NTT DOCOMO...
OpenStack Summit Tokyo - Know-how of Challlenging Deploy/Operation NTT DOCOMO...OpenStack Summit Tokyo - Know-how of Challlenging Deploy/Operation NTT DOCOMO...
OpenStack Summit Tokyo - Know-how of Challlenging Deploy/Operation NTT DOCOMO...
 
Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive

Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive


 
Lessons Learned from Leveraging Real-Time Power Consumption Data with Apache ...
Lessons Learned from Leveraging Real-Time Power Consumption Data with Apache ...Lessons Learned from Leveraging Real-Time Power Consumption Data with Apache ...
Lessons Learned from Leveraging Real-Time Power Consumption Data with Apache ...
 
Sensor Data in InfluxDB by David Simmons, IoT Developer Evangelist | InfluxData
Sensor Data in InfluxDB by David Simmons, IoT Developer Evangelist | InfluxDataSensor Data in InfluxDB by David Simmons, IoT Developer Evangelist | InfluxData
Sensor Data in InfluxDB by David Simmons, IoT Developer Evangelist | InfluxData
 
YugaByte DB Internals - Storage Engine and Transactions
YugaByte DB Internals - Storage Engine and Transactions YugaByte DB Internals - Storage Engine and Transactions
YugaByte DB Internals - Storage Engine and Transactions
 
NFV Infrastructure Manager with High Performance Software Switch Lagopus
NFV Infrastructure Manager with High Performance Software Switch Lagopus NFV Infrastructure Manager with High Performance Software Switch Lagopus
NFV Infrastructure Manager with High Performance Software Switch Lagopus
 
How YugaByte DB Implements Distributed PostgreSQL
How YugaByte DB Implements Distributed PostgreSQLHow YugaByte DB Implements Distributed PostgreSQL
How YugaByte DB Implements Distributed PostgreSQL
 
The Principle Of Ultrasound Imaging System
The Principle Of Ultrasound Imaging SystemThe Principle Of Ultrasound Imaging System
The Principle Of Ultrasound Imaging System
 
Lagopus presentation on 14th Annual ON*VECTOR International Photonics Workshop
Lagopus presentation on 14th Annual ON*VECTOR International Photonics WorkshopLagopus presentation on 14th Annual ON*VECTOR International Photonics Workshop
Lagopus presentation on 14th Annual ON*VECTOR International Photonics Workshop
 
Migrating Airflow-based Apache Spark Jobs to Kubernetes – the Native Way
Migrating Airflow-based Apache Spark Jobs to Kubernetes – the Native WayMigrating Airflow-based Apache Spark Jobs to Kubernetes – the Native Way
Migrating Airflow-based Apache Spark Jobs to Kubernetes – the Native Way
 
Bloat and Fragmentation in PostgreSQL
Bloat and Fragmentation in PostgreSQLBloat and Fragmentation in PostgreSQL
Bloat and Fragmentation in PostgreSQL
 
FIAT/IFTA MMC Seminar May 2015. Key Points for a Successful Migration. Fikriy...
FIAT/IFTA MMC Seminar May 2015. Key Points for a Successful Migration. Fikriy...FIAT/IFTA MMC Seminar May 2015. Key Points for a Successful Migration. Fikriy...
FIAT/IFTA MMC Seminar May 2015. Key Points for a Successful Migration. Fikriy...
 
Getting Started: Intro to Telegraf - July 2021
Getting Started: Intro to Telegraf - July 2021Getting Started: Intro to Telegraf - July 2021
Getting Started: Intro to Telegraf - July 2021
 
Labqazwsxedcrfvtgbyhnujmqazwsxedcrfvtgbyhnujmqazwsx.pptx
Labqazwsxedcrfvtgbyhnujmqazwsxedcrfvtgbyhnujmqazwsx.pptxLabqazwsxedcrfvtgbyhnujmqazwsxedcrfvtgbyhnujmqazwsx.pptx
Labqazwsxedcrfvtgbyhnujmqazwsxedcrfvtgbyhnujmqazwsx.pptx
 

Recently uploaded

Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 

PostgreSQL Logical Replication Architecture, Pitfalls & Best Practices

  • 1. Copyright©2018 NTT Corp. All Rights Reserved. Architecture & Pitfalls
 of Logical Replication NTT OSS Center Atsushi Torikoshi PGConf.US 2018
  • 2. 2 Who am I ➢Atsushi Torikoshi ➢@atorik_shi ➢torikoshi_atsushi_z2@lab.ntt.co.jp ➢NTT Open Source Software Center ➢PostgreSQL technical support ➢PostgreSQL performance verification Copyright©2018 NTT Corp. All Rights Reserved.
  • 3. 3 About NTT • Who we are – NTT(Nippon Telegraph and Telephone Corporation) – Japanese telecommunications company • What NTT OSS Center does – Promotes the adoption of OSS by the group companies • Total support – support desk, Introduction support, Product maintenance • R&D – developing OSS and related tools with the communities • Deals about 60 OSS products – developing OSS and related tools with the communities NTT NTT OSS Center Copyright©2018 NTT Corp. All Rights Reserved.
  • 4. Copyright©2018 NTT Corp. All Rights Reserved. 4 •Background of Logical Replication •Architecture and Behavior •Pitfalls •Summary INDEX
  • 5. Copyright©2018 NTT Corp. All Rights Reserved. 5 BACKGROUND OF LOGICAL REPLICATION
  • 6. Copyright©2018 NTT Corp. All Rights Reserved. 6 PostgreSQL has built-in Physical Replication since 2010. It replicates a whole DB by sending WAL. Suitable for load balancing and high availability. Physical Replication Upstream Downstream sendTable Table Table WALWAL WALWAL Table Table Table replay
  • 7. Copyright©2018 NTT Corp. All Rights Reserved. 7 Physical Replication cannot do things like: • partial replication • replication between different major version PostgreSQL Logical Replication has added flexibility to built-in replication and made these things possible! Logical Replication Upstream Downstream decode, sendTable Table Table WALWAL WALWAL Table Table apply write
  • 8. Copyright©2018 NTT Corp. All Rights Reserved. 8 Comparison between Logical and Physical Replication Physical Logical way of the replication Sending and replaying all WAL decoding WAL and extracting changes downstream DB copy of the upstream DB not necessarily the same as upstream DB up/downstream DB can be different PostgreSQL version manipulations for downstream DB SELECT only No restriction, but some manipulations may lead to conflict What is replicated ALL views, partition root tables, large objects and some manipulations including DDL are NOT replicated
  • 9. Copyright©2018 NTT Corp. All Rights Reserved. 9 Logical Replication enables flexible data replication. 1. Replicating partial data for analytical purpose 2. Consolidating multiple DBs into a single one 3. Online version up Expected use cases of Logical Replication (1) (2) (3)
  • 10. Copyright©2018 NTT Corp. All Rights Reserved. 10 ARCHITECTURE
 AND
 BEHAVIOR
  • 11. Copyright©2018 NTT Corp. All Rights Reserved. 11 • ‘walsender’ and ‘apply worker’ do most of the work for Logical Replication. • ‘sync worker’ and corresponding ‘walsender’ run only at initial table sync. Basics of the architecture WAL wal sender Publisher (upstream) write wal sender apply worker launcher sync worker launch launch Subscriber(downstream) backend process read decode backend process
  • 12. Copyright©2018 NTT Corp. All Rights Reserved. 12 • ‘walsender’ reads WAL and decodes it. Then sends it to subscriber. • ‘apply worker’ applies that change. Basics of the architecture ~replication WAL backend process wal sender Publisher write read apply worker Subscriber TableTableTable write decode send change
  • 13. Copyright©2018 NTT Corp. All Rights Reserved. 13 • ‘walsender’ reassembles queries by its transaction. • When WAL is INSERT, UPDATE or DELETE, ‘walsender’ keeps the change in memory. Basics of the architecture ~replication WAL walsender INSERT UPDATE UPDATE DELETE UPDATE apply worker Publisher Subscriber :transaction
  • 14. Copyright©2018 NTT Corp. All Rights Reserved. 14 • ‘walsender’ reassembles queries by its transaction. • When WAL is INSERT, UPDATE or DELETE, ‘walsender’ keeps the change in memory. Basics of the architecture ~replication WAL walsender INSERT UPDATE UPDATE DELETE UPDATE 1. read WAL apply worker Publisher Subscriber :transaction
  • 15. Copyright©2018 NTT Corp. All Rights Reserved. 15 • ‘walsender’ reassembles queries by its transaction. • When WAL is INSERT, UPDATE or DELETE, ‘walsender’ keeps the change in memory. Basics of the architecture ~replication WAL walsender INSERT INSERT UPDATE UPDATE DELETE UPDATE 1. read WAL 2. decode apply worker Publisher Subscriber :transaction
  • 16. Copyright©2018 NTT Corp. All Rights Reserved. 16 • ‘walsender’ reassembles queries by its transaction. • When WAL is INSERT, UPDATE or DELETE, ‘walsender’ keeps the change in memory. Basics of the architecture ~replication WAL walsender INSERT INSERT UPDATE UPDATE DELETE UPDATE 1. read WAL 2. decode 3. reassemble by transaction apply worker Publisher Subscriber :transaction INSERT
  • 17. Copyright©2018 NTT Corp. All Rights Reserved. 17 • When WAL is COMMIT, ‘walsender’ sends all the changes for that transaction to subscriber. Basics of the architecture ~replication :transaction WAL apply worker walsender COMMIT INSERT UPDATE UPDATE DELETE UPDATE 1. read WAL 2. decode 4. send Publisher Subscriber 3. reassemble by transaction COMMIT
  • 18. Copyright©2018 NTT Corp. All Rights Reserved. 18 • When WAL is ROLLBACK, ‘walsender’ just throws away the changes for that transaction. Basics of the architecture ~replication :transaction WAL walsender ROLLBACK INSERT UPDATE UPDATE DELETE UPDATE ROLLBACK 1. read WAL 2. decode 4. cleanup apply worker Publisher Subscriber 3. reassemble by transaction
  • 19. Copyright©2018 NTT Corp. All Rights Reserved. 19 • At initial table sync, COPY runs. • COPY is done by dedicated ‘walsender’ and sync worker. These processes exit after COPY is done. Initial table sync WAL backend process wal sender Publisher write read apply worker Subscriber TableTableTable sync worker wal sender write (COPY)
  • 20. Copyright©2018 NTT Corp. All Rights Reserved. 20 • PostgreSQL doesn’t have merge agents for conflict resolution. If there are multiple changes for the same data at one time, the last change is reflected. (Not) Conflict Publisher Subscriber id name 1 ‘A’ 2 ‘B’ id name 1 ‘A’ 2 ‘B’
  • 21. Copyright©2018 NTT Corp. All Rights Reserved. 21 • PostgreSQL doesn’t have merge agents for conflict resolution. If there are multiple changes for the same data at one time, the last change is reflected. (Not) Conflict Publisher Subscriber 2. UPDATE table SET name = ‘Y‘ WHERE id = 2 id name 1 ‘A’ 2 ‘Y’ 1. UPDATE table SET name = ‘X‘ WHERE id = 2 id name 1 ‘A’ 2 ‘X’
  • 22. Copyright©2018 NTT Corp. All Rights Reserved. 22 • PostgreSQL doesn’t have merge agents for conflict resolution. If there are multiple changes for the same data at one time, the last change is reflected. (Not) Conflict Publisher Subscriber 2. UPDATE table SET name = ‘Y‘ WHERE id = 2 id name 1 ‘A’ 2 ‘X’ 1. UPDATE table SET name = ‘X‘ WHERE id = 2 3. replicate id name 1 ‘A’ 2 ‘X’
  • 23. Copyright©2018 NTT Corp. All Rights Reserved. 23 • If replicating data causes an error at subscriber side, the replication stops. Conflict Publisher Subscriber id 1 2 1. INSERT INTO table VALUES (2); id 1 2 2. INSERT INTO table VALUES (2);
  • 24. Copyright©2018 NTT Corp. All Rights Reserved. 24 • If replicating data causes an error at subscriber side, the replication stops. Conflict Publisher Subscriber id 1 2 1. INSERT INTO table VALUES (2); id 1 2 2. INSERT INTO table VALUES (2); 3. replicate
  • 25. Copyright©2018 NTT Corp. All Rights Reserved. 25 • If replicating data causes an error at subscriber side, the replication stops. Conflict Publisher Subscriber id 1 2 2. INSERT INTO table VALUES (2); id 1 2 1. INSERT INTO table VALUES (2); 3. replicate 4. conflict
  • 26. Copyright©2018 NTT Corp. All Rights Reserved. 26 • Users must resolve conflict manually. • After the conflict is resolved, replication is resumed. Conflict Publisher Subscriber id 1 2 2. INSERT INTO table VALUES (2); id 1 2 1. INSERT INTO table VALUES (2); 3. replicate 4. conflict
  • 27. Copyright©2018 NTT Corp. All Rights Reserved. 27 PITFALLS
  • 28. Copyright©2018 NTT Corp. All Rights Reserved. 28 Q1. How does ‘walsender’ deal with WAL which are NOT target of replication?
  • 29. Copyright©2018 NTT Corp. All Rights Reserved. 29 A1. ‘walsender’ decodes most of the WAL.
  • 30. Copyright©2018 NTT Corp. All Rights Reserved. 30 • behavior: 'walsender’ decodes *all* of the changes to the target database, NOT just the changes to subscribed tables. 1. ‘walsender’ decodes most of the WAL
  • 31. Copyright©2018 NTT Corp. All Rights Reserved. 31 • pitfall: Changes in non-subscribed tables even consume resources, such as CPU and memory. 1. ‘walsender’ decodes most of the WAL perf visualization of walsender updating only non-subscribed tables DecodeDelete DecodeInsert DecodeCommit
  • 32. Copyright©2018 NTT Corp. All Rights Reserved. 32 • Lesson: ‘walsender’ consumes resources depending on the whole amount of changes on the publisher database database, NOT only on the amount of changes on subscribed tables. 1. ‘walsender’ decodes most of the WAL
  • 33. Copyright©2018 NTT Corp. All Rights Reserved. 33 Q2. Does keeping changes on walsender cause issues?
  • 34. Copyright©2018 NTT Corp. All Rights Reserved. 34 A2. Yes, It may consume a lot of memory.
  • 35. Copyright©2018 NTT Corp. All Rights Reserved. 35 • behavior: ‘walsender’ keeps each change of a transaction in memory until COMMIT or ROLLBACK. 2. ‘walsender’ may consume a lot of memory
  • 36. Copyright©2018 NTT Corp. All Rights Reserved. 36 • pitfall: It may cause ‘walsender’ to consume a lot of memory. 2. ‘walsender’ may consume a lot of memory Type of manipulation Measures to prevent memory use many changes in one transaction walsender’ has a feature to spill out changes to disk, when the number of changes in one transaction exceeds 4096. changes which modifies much data There are no feature to avoid using memory. many transactions many savepoints ※ Patches changing this behavior are under discussion.
  • 37. Copyright©2018 NTT Corp. All Rights Reserved. 37 • lesson: If possible, it’s better to avoid the manipulations which have no measures to prevent consuming a lot of memory. Monitoring memory usage at publisher may be a good idea. 2. ‘walsender’ may consume a lot of memory
  • 38. Copyright©2018 NTT Corp. All Rights Reserved. 38 Q3. Can we use synchronous replication in Logical Replication?
  • 39. Copyright©2018 NTT Corp. All Rights Reserved. 39 A3. Yes, but the response time may be quite long.
  • 40. Copyright©2018 NTT Corp. All Rights Reserved. 40 • behavior: Under synchronous replication, before replying to the client, publishers wait for the COMMIT responses from all the subscribers. 3. The response time may be quite long Publisher table 2 table 1 Client BEGIN; INSERT INTO Table1 VALUES (‘a’); COMMIT; (1) (4) Subscriber table 1 BEGIN; INSERT INTO Table1 VALUES (‘a’); COMMIT; (2) (3) Table1
  • 41. Copyright©2018 NTT Corp. All Rights Reserved. 41 • pitfall: Under synchronous replication, Publishers wait for COMMIT responses from all the subscribers, even when there are no changes to those subscribers. 3. The response time may be quite long Publisher table 2 table 1 Subscriber2 table 2 Client BEGIN; INSERT INTO Table1 VALUES (‘a’); COMMIT; Sends only BEGIN and COMMIT (1) (2) (3) (4) Subscriber1 table 1 BEGIN; INSERT INTO Table1 VALUES (‘a’); COMMIT; (2) (3) Table1
  • 42. Copyright©2018 NTT Corp. All Rights Reserved. 42 • lesson: The response time to clients depends on the slowest subscriber. • Also, as we’ve seen it on Q2, ‘walsender‘ sends changes to ‘apply worker’ after COMMIT, it also tends to make response time longer. • It may also be beneficial to confirm you really need synchronous replication. 3. The response time may be quite long
  • 43. Copyright©2018 NTT Corp. All Rights Reserved. 43 Q4. Is the way to monitor the status of replication the same as Physical Replication?
  • 44. Copyright©2018 NTT Corp. All Rights Reserved. 44 A4. Only monitoring pg_stat_replication might not be enough.
  • 45. Copyright©2018 NTT Corp. All Rights Reserved. 45 • behavior: Initial table sync is done by dedicated processes, sync worker and walsender. 4. pg_stat_replication might not be enough WAL backend process wal sender Publisher write read apply worker Subscriber TableTableTable sync worker wal sender write (COPY)
  • 46. Copyright©2018 NTT Corp. All Rights Reserved. 46 • pitfall: Even if ‘sync worker’ failed to start and nothing has been replicated yet, pg_stat_replication.state is ‘streaming’. 4. pg_stat_replication might not be enough
  • 47. Copyright©2018 NTT Corp. All Rights Reserved. 47 • lesson: We should also monitor pg_subscription_rel and check ‘srsubstate’ is ‘r’, meaning ready. 4. pg_stat_replication might not be enough
  • 48. Copyright©2018 NTT Corp. All Rights Reserved. 48 Q5. How should we resolve the conflict?
  • 49. Copyright©2018 NTT Corp. All Rights Reserved. 49 A5. We can use pg_replication_origin_advance(), but it may skip some data.
  • 50. Copyright©2018 NTT Corp. All Rights Reserved. 50 • behavior: pg_replication_origin_advance() enables us to set the LSN up to which data has been replicated. 5. pg_replication_origin_advance() may skip data | | 10 20 remote lsn Here
  • 51. Copyright©2018 NTT Corp. All Rights Reserved. 51 • behavior: pg_replication_origin_advance() enables us to set the LSN up to which data has been replicated. 5. pg_replication_origin_advance() may skip data | | 10 20 remote lsn pg_replication_origin_advance(‘node_name’, 20) Here
  • 52. Copyright©2018 NTT Corp. All Rights Reserved. 52 • behavior: pg_replication_origin_advance() enables us to set the LSN up to which data has been replicated. 5. pg_replication_origin_advance() may skip data | | 10 20 remote lsn pg_replication_origin_advance(‘node_name’, 20) Here Conflict point
  • 53. Copyright©2018 NTT Corp. All Rights Reserved. 53 • pitfalls: If there are some changes on the publisher after the conflict, pg_replication_origin_advance(‘current wal lsn on publisher’) skips applying that changes. 5. pg_replication_origin_advance() may skip data | | 10 20 remote lsn pg_replication_origin_advance(‘node_name’, 20) INSERT UPDATEConflict point
  • 54. Copyright©2018 NTT Corp. All Rights Reserved. 54 • lessons: Changing conflicting data on the subscriber may be usually a better choice. 5. pg_replication_origin_advance() may skip data
  • 55. Copyright©2018 NTT Corp. All Rights Reserved. 55 Q6. Can backup be performed usual?
  • 56. Copyright©2018 NTT Corp. All Rights Reserved. 56 A6. Backup DB under Logical Replication may need additional procedure.
  • 57. Copyright©2018 NTT Corp. All Rights Reserved. 57 • behavior: pg_dump doesn't backup pg_subscription_rel, which keeps the state of initial table sync. 6. Logical Replication may need additional procedure
  • 58. Copyright©2018 NTT Corp. All Rights Reserved. 58 • pitfalls: Restoring data backed up by pg_dump at a subscriber causes initial table sync again. It usually makes the replication stop due to key duplication error. 6. Logical Replication may need additional procedure Publisher Subscriber pg_dump TableTableTable
  • 59. Copyright©2018 NTT Corp. All Rights Reserved. 59 • pitfalls: Restoring data backed up by pg_dump at a subscriber causes initial table synchronization again. It usually makes the replication stop due to key duplication error. 6. Logical Replication may need additional procedure Publisher Subscriber (1)restore pg_dump TableTableTable TableTableTable
  • 60. Copyright©2018 NTT Corp. All Rights Reserved. 60 • pitfalls: Restoring data backed up by pg_dump at a subscriber causes initial table synchronization again. It usually makes the replication stop due to key duplication error. 6. Logical Replication may need additional procedure Publisher Subscriber (1)restore pg_dump TableTableTable TableTableTable (2)replication
  • 61. Copyright©2018 NTT Corp. All Rights Reserved. 61 • pitfalls: Restoring data backed up by pg_dump at a subscriber causes initial table synchronization again. It usually makes the replication stop due to key duplication error. 6. Logical Replication may need additional procedure Publisher Subscriber (1)restore pg_dump TableTableTable TableTableTable (3)conflict (2)replication
  • 62. Copyright©2018 NTT Corp. All Rights Reserved. 62 • lessons: We can avoid this resyncing by refresh subscription with 'copy_data = false‘. But if a subscription has tables which have not completed the initial sync, we need more work.. It's better to consider well what data is really necessary and how to prevent data loss. In some cases it may be better to start replication from scratch. 6. Logical Replication may need additional procedure
  • 63. Copyright©2018 NTT Corp. All Rights Reserved. 63 SUMMARY
  • 64. Copyright©2018 NTT Corp. All Rights Reserved. 64 Design Take into account some counterintuitive behaviors which cause performance impact. • ‘walsender’ keeps changes in memory • In sync replication, publishers wait for COMMIT from all the subscribers even which have no change. • Changes on non-subscribed tables are also decoded. How should we manage Logical Replication?
  • 65. Copyright©2018 NTT Corp. All Rights Reserved. 65 Monitoring • Monitor memory usage on publisher. • Monitor not only pg_stat_replication but pg_subscription_rel. How should we manage Logical Replication?
  • 66. Copyright©2018 NTT Corp. All Rights Reserved. 66 Operation • pg_replication_origin_advance() may skip some data. • Backup and restore need some extra procedures, It's better to consider well what data is really necessary and how to prevent data loss. How should we manage Logical Replication?
  • 67. Copyright©2018 NTT Corp. All Rights Reserved. 67 Thank you ! torikoshi_atsushi_z2@lab.ntt.co.jp @atorik_shi