Primary - Mirror Distribution Strategies

This document describes three mirror distribution strategies in the YMatrix database system: Spread Mirroring, Group Mirroring, and Ring Mirroring.

YMatrix uses Ring Mirroring as the default mirror distribution strategy.

Note!
Mirror replication is strongly recommended for production environments.

Overview

When deploying a YMatrix database system, you can configure mirror segments on hosts alongside primary segments.

  • Functionality:

    • If a primary segment fails, its corresponding mirror segment can take over query processing.
    • Mirrors stay synchronized with their primaries through transaction log replication.
  • Best Practice:

    • Each mirror segment instance must be deployed on a different physical host than its corresponding primary segment to avoid single-point-of-failure risks.

Distribution Strategy Comparison

Spread Mirroring Group Mirroring Ring Mirroring
System Stability Unstable Stable Moderately stable
Load Balance Balanced Unbalanced Moderately balanced

1. Spread Mirroring

Spread Mirroring distributes the mirrors of each host across all other hosts in the cluster. This strategy requires that the number of hosts in the cluster be greater than the number of primary segments per host.

To ensure even distribution, the number of distinct hosts in the array must exceed the number of segment instances per host.

  • The figure below illustrates a Spread Mirroring configuration for a 4-host cluster with 3 primary segments per host.

2. Group Mirroring

Group Mirroring treats all mirrors of the primaries on a single host as a group and places the entire group on another host in the cluster.

  • The figure below shows a Group Mirroring configuration for a 4-host cluster with 4 primary segments per host.

3. Ring Mirroring

Ring Mirroring works with at least two hosts. It treats the sequence of primary segment IDs on a host as a one-dimensional tape, folds it in half, and then places mirrors starting from the fold point onto other hosts in a clockwise, evenly distributed manner.

When new primaries are added during scale-out, existing mirror rings remain unaffected; instead, a new mirror ring is created.

The figure below depicts a Ring Mirroring configuration for a 3-host cluster with 4 primary segments per host.

Note!
If you wish to use a mirror distribution strategy other than Ring Mirroring in YMatrix, you can implement it via custom configuration using mxaddmirrors.