Some time ago I have shown that the proxy can do connection pooling and can keep server-side connections open to be reused by another client later. The keepalive tutorial shows how this can be implemented.
When it comes to reusing a server-connection for multiple client connections we have to face a small problem:
SQL connections aren't stateless (temporary tables, session variables, ...)
We have to handle this somehow.
When you use this feature the proxy will clean up for you by
default, by issuing a COM_CHANGE_USER as the first
command that is sent to the server. It basicly resets the
connection and re-authenticates the user. You always get a clean
environment and can't really tell that the server-side connection
was open all the time.
But you don't really win performance either. A small benchmark shall give you an idea.
# connecting the client to the server ... 11:58:41.241956 …[Read more]