Experience the Power of the Tungsten Connector, an Intelligent MySQL Proxy

In this blog post, we talk about the basic function and features of the Tungsten Connector.

The Tungsten Connector is an intelligent MySQL proxy that provides key high-availability and read-scaling features. This includes the ability to route MySQL queries by inspecting them in-flight.

The most important function of the Connector is failover handling. When the cluster detects a failed master because the MySQL server port is no longer reachable, the Connectors are signaled and traffic is re-routed to the newly-elected Master node.

Next is the ability to route MySQL queries based on various factors. In the default Bridge mode, traffic is routed at the TCP layer, and read-only queries must be directed to a different port (normally 3306 for writes and 3307 for reads).

There are additional modes, Proxy/Direct and Proxy/SmartScale. In both cases, queries are intercepted and inspected by the Connector. The decisions made are tunable based on configuration parameters.

MySQL must be configured for autocommit=1 (MySQL Docs) for this to work. Additionally, any query transaction wrapped with BEGIN and COMMIT will be sent to the Master directly.

In Proxy/Direct mode, a SELECT-only statement that does no writes will be sent to a read slave automatically. Unlike SmartScale, Direct routing pays no attention to the session state, or replicated data consistency.

This means that performing a write and immediately trying to read the information through a Direct routing connection may fail, because the Connector does not ensure that the written transaction exists on the selected slave.

Direct routing is therefore ideal in applications where:

  • Applications perform few writes, but a high number of reads.
  • High proportion of reads on 'old' data. For example, blogs, stores, or machine logging information

In Proxy/SmartScale mode, an additional check is made on the read slave to determine data "staleness". In this read-write splitting mode, the Connector intelligently determines if slaves are up-to-date with respect to the master, and selects them in such a way that reads are always strictly consistent with the last write of their current session. This is extremely useful when doing read-behind-write operations.

Configuration of Proxy and SmartScale modes relies upon a text file called which, at it's most basic, defines the users that are connecting through.

Each user has three required and one optional field:
{user} {password} {service} [affinity]

For example:

app_user secret global west

Without at least one user entry, communications via the Connector will fail.

Best of all, each Connector node may be configured differently, so that it is possible to have all of the following available at once using four separate node instances:

  • Bridge mode read/write (very fast)
  • Bridge mode read-only (very fast)
  • Proxy/Direct auto-r/w splitting (slower due to inspection)
  • Proxy/SmartScale automatic session and latency-sensitive r/w splitting (slower still due to slave status query)

In summary, the Connector allows for both proper failover handing as well as a variety of ways to route MySQL queries to read slaves.

In future articles, we will cover more advanced subjects like failover behavior tuning and other MySQL query routing methods, like SQL-based, port-based and hostname-based.

Questions? Contact Continuent

About the Author

Eric M. Stone

Eric is a veteran of fast-paced, large-scale enterprise environments with 35 years of Information Technology experience. With a focus on HA/DR, from building data centers and trading floors to world-wide deployments, Eric has architected, coded, deployed and administered systems for a wide variety of disparate customers, from Fortune 500 financial institutions to SMB’s.

Add new comment