← Back to team overview

mysql-proxy-discuss team mailing list archive

Re: problem with connection pooling?

 

Is the issue that mysql-proxy doesn't handle multiplexing issues like
connection-wide state, or does it simply not allow you to send queries from
1 connection over another connection?  I have no expectation of it
maintaining connection-wide state for me -- I can handle that issue myself
-- I just need the ability to send queries over another connection.

I am surprised this doesn't work -- I thought one of the stated functions of
mysql-proxy was connection pooling, and my understanding is that it isn't
really connection pooling if there's a 1-1 ratio of application connections
and backend connections (that's just load balancing).

Thanks much for the info, I'll check out the prototype multiplexer.

On Wed, Jul 15, 2009 at 12:42 AM, nick loeve <trickie@xxxxxxxxx> wrote:

> You cannot enforce that only one backend connection is created, as the
> proxy plugin does not do multiplexing. There is a bzr branch on the
> mysql-proxy launchpad project called 'funnel' which has a prototype
> multiplexer that can do what you require. Bear in mind that it has
> some caveats, such that it will not work with some workloads
> (transactions, queries relying on session state, etc etc), and is
> really only a 'prototype' although we use it in production.
>
> Cheers
>
> On Wed, Jul 15, 2009 at 7:00 AM, Adrienne Porter Felt<apf@xxxxxxxxxxxx>
> wrote:
> > Hi -
> > I am trying to set up connection pooling such that 2 applications connect
> to
> > the proxy and share 1 actual connection to the database.  I do this by
> > letting the first connection go through unaltered, and then setting the
> > second attempted connection to use the first connection.  I don't want
> the
> > second connection to need to re-authenticate to the actual database, I
> just
> > want to send its queries out over the existing authenticated backend
> > connection.
> > I keep getting this error during read_query() when the second tries to
> use
> > the first connection:
> > 2009-07-14 19:30:10: (critical) proxy-plugin.c.1129: I have no server
> > backend, closing connection
> > 2009-07-14 19:30:10: (critical) network-mysqld.c.1188:
> > plugin_call(CON_STATE_READ_QUERY) failed
> > Here is my code:
> > if proxy.global.client_counter == nil then
> > proxy.global.client_counter = 0
> > end
> > local proto = assert(require("mysql.proto"))
> > local order = 0
> > function connect_server()
> > proxy.global.client_counter = proxy.global.client_counter + 1
> > order = proxy.global.client_counter
> > if order ~= 1 then
> > proxy.response = {
> > type = proxy.MYSQLD_PACKET_RAW,
> > packets = {
> > proto.to_challenge_packet({
> > server_status     = 2,
> >    server_version    = 50132,
> >    thread_id         = 12345678922222
> > })
> > }
> > }
> > return proxy.PROXY_SEND_RESULT
> > end
> > end
> > function read_query(stmt)
> > if order ~= 1 then
> > proxy.connection.backend_ndx = 1
> > return proxy.PROXY_SEND_QUERY
> > end
> > end
> > What am I doing wrong?  And FYI I am using 0.7.2.
> > Thanks much for the help.
> > _______________________________________________
> > Mailing list: https://launchpad.net/~mysql-proxy-discuss
> > Post to     : mysql-proxy-discuss@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~mysql-proxy-discuss
> > More help   : https://help.launchpad.net/ListHelp
> >
> >
>
>
>
> --
> Nick Loeve
>

References