Tungsten Connector, the highly customizable, intelligent database proxy for the Tungsten Stack, provides finely-grained options for selecting the right data source to execute SQL requests against.
These options include:
- Quality of Service: request a primary or a replica
- Maximum replica latency: select replica that are most up-to-date
- Site-Affinity: specify which AZ or site the node should be part of, by order of preference
- Node selection: point a specific node that should be picked if available
- Negative affinity: exclude a whole site or given node
For customers that have a hand on their application and wish to add intelligence and fine-grain tuning in node selection, we provide a way to specify these options through the connection string.
The problem is that application interfaces, MySQL command line interface, perl DBI or Java JDBC driver to name a few, only have a fixed set of arguments, or flags, and don’t provide a way to pass arguments to the underlying layer (the database proxy in our case). Take JDBC URLs for example, and specifically with the MySQL JDBC driver URL parameters (jdbc:mysql://host:port/db?parameter=value
) are caught by the driver to be interpreted – and any options that are not recognized by the MySQL driver will be silently dropped/ignored.
Explained with an example, wishing to pass a maximum latency to the Proxy, one would intuitively go ahead and use the url: jdbc:mysql://connector-host:3306/mydatabase?maxAppliedLatency=5
.
That won’t work, because the Connector will never see this maxAppliedLatency
parameter.
The solution we provide is to use the database name as an option conveyor. Instead of passing options through regular URL placeholders or command line flags, these are moved in the database name using a special tag, the “@” (at sign) by default – this tag can of course be configured if needed. MySQL specific parameters remain unchanged, so the URL becomes: jdbc:mysql://host:port/db@connector_param=value?mysql_param=value
.
Here are complete, identical and real life examples to illustrate this possibility:
jdbc:mysql://db1:3306/partners@qos=RO_RELAXED&affinity=asia,-europe?connectTimeout=10
mysql -hdb1 -P13306 --connect-timeout=10 -Dpartners@qos=RO_RELAXED&affinity=asia,-europe
- we want to read data from the partners database
- from a replica (
qos=RO_RELAXED
) - in asia data center (
affinity=asia
) - avoiding connections to europe data center (
-europe
appended to affinity) - with a connection timeout of 10 seconds on the application/MySQL driver side (connectTimeout=10)
In summary, Tungsten Connector Proxy provides an original means for selecting exactly the right Tungsten Cluster node for your application, for almost any kind of client application type!
Comments
Add new comment