In this blog post, we describe the new Read Affinity tuning feature of the Tungsten Connector.
Tungsten Connector read affinity now supports multiple dataservices with ordering and exclusion (only one was previously allowed).
You may now fine-tune the affinity per user in user.map
and via the global tpm configuration option connector-affinity
.
Affinity is defined as the host (single cluster only) or dataservice (composite clusters) to prefer for reads, or in the case of Composite Multimaster, writes as well.
For example, consider a deployment with four sites world-wide consisting of a composite dataservice global
, and four member dataservices (i.e. one cluster per site): east
, west
, north
and south
.
An application server at site west
ideally will pull read data from a local cluster slave node because that would be faster than fetching it from another site. This is especially important when using the Primary/DR topology, where all writes are sent to a single Master in the Primary site cluster.
If the database layer at site west
were to become unavailable, the the Connector will consult the affinity list and attempt to contact the next service configured. Having the Connector installed locally on the application servers further insulates the application from an outage, because the Connector is able to read and write data using other sites upon sensing a local cluster-wide failure.
This concept will apply to both Active/Active Composite Multimaster clusters as well as Active/Passive Composite Primary/DR clusters.
The affinity feature routes both reads and writes when using a Multimaster topology.
The affinity string is an ordered list of dataservice names, separated by commas, where the first dataservice entry will be the one used by default. If the first dataservice in the list is not available, the connector will use the next one listed, and so forth.
Dataservices not specified in the list, if any, will be used last and randomly.
It is also possible to exclude one or more dataservices by adding a hyphen ("-") in front of the dataservice name.
When using Bridge mode, set affinity via the tpm
option --connector-affinity
, and when using Proxy mode, this is the syntax in the user.map
file:
{User} {Password} {DataServiceName-or-CompositeDataServiceName} [Affinity]
For example, to exclude site south
from servicing read requests in user.map
:
sales secret global east,west,north,-south
or in tungsten.ini
:
connector-affinity=east,west,north,-south
The above affinity string east,west,north,-south
will try east
, then west
, then north
. If none of the first three are available, a connection request would not succeed since south
has been excluded by the negation ("-").
In the following user.map
example, dataservices north
and south
would be available as random candidates if the first two (east
and west
) were unavailable:
sales secret global east,west
or in tungsten.ini
:
connector-affinity=east,west
In future articles, we will continue to cover more advanced subjects of interest!
Questions? Contact us.
Comments
Add new comment