In this blog post, we talk about how query connections are handled by the Tungsten Connector, especially read-only connections.
There are multiple ways to configure session handling in the Connector. The three main modes are Bridge, Proxy/Direct and Proxy/SmartScale.
In Bridge mode, the data source to connect to is chosen ONCE for the lifetime of the connection, which means that the selection of a different node will only happen if a NEW connection is opened through the Connector.
So if your application reuses its connections, all traffic sent through that session will continue to land on the selected read slave, i.e., when using connection pooling.
The key difference is in how the slave latency checking is handled:
- In Bridge mode, the latency is checked at connection time, and you will stick to the slave for the connection lifetime (which will be ended if the slave goes offline).
- In Proxy modes, the latency is re-evaluated before each query, which can bring the connection to another slave if the latency becomes too high during the life of the connection.
If you have long-lasting, read-only connections that should not read from stale slaves, then use a Proxy mode.
If your connection lifetime is short (i.e make/break - one transaction then disconnect), or your application is not sensitive to reasonably outdated data for reads, then use Bridge mode and its optional read-only port.
In future articles, we will continue to cover more advanced subjects of interest!
Questions? Contact us.