Logo
Shadow DB

Shadow DB #

Scenarios

SphereEx-DBPlusEngine focuses on solutions at the database level in the scenario of full link online pressure test. Launch the shadow DB function of pressure test, with the help of the powerful SQL parsing ability of SphereEx-DBPlusEngine. Perform shadow judgment on executing SQL. At the same time, the shadow algorithm is combined with flexible configuration. To meet the online pressure test requirements of complex business scenarios, the pressure test flow is routed to the shadow DB, and the online normal flow is routed to the production database.

Prerequisites

Take DBPlusEngine-Proxy as an example, download and unzip the proxy, refer to the following configuration, configure the corresponding configuration file in the conf directory, and then start the proxy.

Configuration Example

config-shadow.yaml

rules:
- !SHADOW
  dataSources:
    shadowDataSource:
      sourceDataSourceName: ds
      shadowDataSourceName: ds_shadow
  tables:
    t_user:
      dataSourceNames:
        - shadowDataSource
      shadowAlgorithmNames:
        - user_id_insert_value_match-algorithm
        - simple-hint-algorithm
  shadowAlgorithms:
    user_id_insert_value_match-algorithm:
      type: VALUE_MATCH
      props:
        operation: insert
        column: user_id
        value: 1
    simple-hint-algorithm:
      type: SIMPLE_HINT
      props:
        foo: bar

- !SQL_PARSER
  sqlCommentParseEnabled: true   

Relevant Reference

Shadow DB