From 6449c910da1c348c1ae56a8118f46c22b986ec22 Mon Sep 17 00:00:00 2001 From: siddharth2411 <43139012+siddharth2411@users.noreply.github.com> Date: Wed, 24 Jul 2024 13:43:40 +0530 Subject: [PATCH] best practice (#8) --- .../best-practices.md | 28 +++++++++++++++++++ .../cdc-best-practices.md | 12 -------- 2 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 docs/content/preview/explore/change-data-capture/using-logical-replication/best-practices.md delete mode 100644 docs/content/preview/explore/change-data-capture/using-logical-replication/cdc-best-practices.md diff --git a/docs/content/preview/explore/change-data-capture/using-logical-replication/best-practices.md b/docs/content/preview/explore/change-data-capture/using-logical-replication/best-practices.md new file mode 100644 index 000000000000..6f5214be54b1 --- /dev/null +++ b/docs/content/preview/explore/change-data-capture/using-logical-replication/best-practices.md @@ -0,0 +1,28 @@ +--- +title: Best Practices +headerTitle: Best Practices +linkTitle: Best Practices +description: Best Practices for Change Data Capture in YugabyteDB. +menu: + preview: + parent: explore-change-data-capture-logical-replication + identifier: best-practices-cdc + weight: 60 +type: docs +--- + +This section mentions best practices to achieve scalability and performance while using CDC with logical replication. + +## Parallel consumption + +The recommended approach towards addressing the requirement of consuming changes in parallel from different tables is to use multiple replication slots. One replication slot per table could be used. Each replication slot is independent of the other and the changes from the tables can be consumed in parallel. + +## Fan out + +Consider the requirement where there are multiple applications, all of them requiring to consume changes from the same table. The recommended approach to address this requirement is to use one replication slot to consume the changes from the table and write the changes to a system like Kafka. The fan out can then be implemented with the multiple applications consuming from Kafka. + +## Load balancing consumption + +An application can connect to any of the tserver nodes to consume from a replication slot. Furthermore, even in case of an interruption, a fresh connection can be made to a different node (different from the node from which consumption was previously happening) to continue consumption from the same replication slot. + +When there are multiple consuming applications each consuming from a different replication slot, it is best that the applications connect to different tserver nodes in the cluster. This ensures better load balancing. The [YugabyteDB smart driver](../../../drivers) does this automatically, so it is recommended that applications use this smart driver. diff --git a/docs/content/preview/explore/change-data-capture/using-logical-replication/cdc-best-practices.md b/docs/content/preview/explore/change-data-capture/using-logical-replication/cdc-best-practices.md deleted file mode 100644 index a2e5ab485373..000000000000 --- a/docs/content/preview/explore/change-data-capture/using-logical-replication/cdc-best-practices.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Best Practices -headerTitle: Best Practices -linkTitle: Best Practices -description: Best Practices for Change Data Capture in YugabyteDB. -menu: - preview: - parent: explore-change-data-capture-logical-replication - identifier: best-practices-cdc - weight: 60 -type: docs ---- \ No newline at end of file