Skip to main content

One post tagged with "v0.1.1"

View All Tags

· 5 min read
Maxwell Miao
Jiandong Wu
Bo Wang
Zhuo Li

Pisanix v0.1.1 is now released three weeks after Pisanix v0.1.0 was released. This new version supports read/write splitting and fixes some problems of the old version.

Pisanix v0.1.1 Description

New Features

  • Pisa -Controller
    • Add ReadWriteSplitting configuration to TrafficStrategy CRD
  • Pisa-Proxy
    • Introduce MetricsManager and MetricsCollector, laying a foundation for processing Metrics later.
    • Add sql_under_processingmetric as Gauge, referring to the number of SQL under processing
    • Support static read-write splitting rules
    • Support TCL statement parsing
    • Add show databases,show tables, and create database statements parsing


  • Pisa-Controller
    • Fix ApiService json parsing error, resulting in that namespace cannot be deleted. #34
    • Support Regex array for CircuitBreak, ConcurrencyControl and ReadWriteSplitting. #123 #124
    • Rename sidecar name to pisa-proxy. #72
    • Add default host as and port as 3306 to MySQL type VirtualDatabase. #68
    • Add server_version to Pisa-Proxy, referring to the MySQL version. #111
  • Pisa-Proxy
    • Support default admin port as 5591, which can be used to obtain metrics. #121
    • Fix the packet processing exceptions when the PREPARE statement is too long. #73
    • Fix SQL parsing ability. #98 #104


Introducing Read-Write Splitting

Read-write splitting is one of the most commonly used MySQL solutions in the industry. In actual scenarios, it can improve query performance and reduce server load. The general structure is as follows:

Read-write splitting is part of the traffic strategies in Pisa-Proxy.

Currently, Pisa-Proxy supports two kinds of read-write splitting solutions:

  • Static read-write splitting: no backend awareness of database role change.
  • Dynamic read-write splitting (coming): backend awareness of the primary and secondary databases change.

Currently, both solutions require the configuration of read-write splitting rules. The read-write splitting rule refers to that Pisa-Proxy needs to match the SQL statement queried with the configured rule. If the match succeeds, the SQL statement is routed to the corresponding node according to the rule. If the match fails, the SQL statement is routed to the configured default node.

There are several concepts included:

  • Node: the backend database node.
  • RulesMatch: The RulesMatch engine matches the SQL query statements received by Pisa-Proxy by the compiled rule set.
  • TargetRole: The TargetRole group matched by the rule matching engine. Each TargetRole group may contain one or more nodes.
  • LoadBalance: The load balancer module will select an appropriate node from the TargetRole group according to corresponding algorithms.
  • TargetInstance: nodes selected from the LoadBalance module.

The implementation logic is as follows:

Read-Write Splitting Configuration

PropertyValue TypeDependency or notDefault ValueImplication
staticobjectNoNoStatic R/W splitting type
dynamicobjectNoNoDynamic R/W splitting configuration

Static read-write splitting configuration

PropertyValue TypeDependency or notDefault ValueImplication
defaultTargetenumNoNoThe target group of default routing
rulesarray{rule}YesNoRead-write splitting rule

Read-Write Splitting Rule Description

Currently, read-write splitting rules can only be matched through RegEx. The rule configuration description is as follows:

PropertyValue TypeDependency or notDefault ValueImplication
namestringYesNoRule name
typestringYesNoThe routing type belongs to RegEx, and the value here is regex.
regexarray{string}YesNoSpecific regex, used to match SQL statements
targetenumYesNoThe TargetRole group that is routed to, corresponding to the value of in DatabaseEndpoint Annotations.
algorithmNameenumYesNoThe name of the load balancer algorithm used for the machine lists that are routed to the role group.

Note: the Enum values above are respectively:

  • TargetRole Enum value
    • read
    • readwrite
  • algorithName Enum value
    • random
    • roundrobin


The configuration of a complete TrafficStrategy CRD is as follows:

kind: TrafficStrategy
name: test
namespace: default
source: test
defaultTarget: read # or readwrite
- name: read-rule
type: regex
- "^select"
target: read # readwrite
algorithmName: random # lb algorithm
- name: write-rule
type: regex
- "^insert"
target: readwrite
algorithmName: roundrobin

The configuration of a complete DatabaseEndpoint CRD is as follows:

kind: DatabaseEndpoint
annotations: read # or readwrite
source: test
name: mysql
namespace: default
db: test
host: mysql.default
password: root
port: 3306
user: root

Community Call

The new version contains 47 PRs and thanks to all the contributors:

  • mlycore
  • xuanyuan300
  • wbtlb
  • tuichenchuxin
  • windghoul
  • TeslaCN

🔗Download link:

Building an open source community needs help from everywhere, no matter it's code or documentation, issues or pull requests, community thanks all of your efforts.

At present, there are some ways to join the community:

Mailing List
Dev Meetings (Starting Feb 16th, 2022), Bi-weekly Wednesday 9:00AM PST
Dev Meetings APAC Friendly (Starting April 27th, 2022), Bi-weekly APAC Wednesday 9:00PM GMT+8
Wechat Brokerpisanix
Meetings Notes

Feel free to talk !