← Back to team overview

mysql-proxy-discuss team mailing list archive

Re: advice/feedback on a mysqlproxy use case

 

Hi Kay,

On Tue, Jan 20, 2009 at 12:00 PM, Kay Röpke <Kay.Roepke@xxxxxxx> wrote:
> Hi!
>
> On Jan 19, 2009, at 4:54 PM, nick loeve wrote:
>

[snip]

>>
>> So, my question:
>>
>> Does mysqlproxy require a backend connection from the connection pool
>> for every query coming in the front-end or can it also handle a
>> 'backlog'?
>
> There is no "backlog" yet, so currently you have to have a free connection
> for each incoming connection, yes,
> since we cannot multiplex multiple queries onto one mysqld thread.
> IOW, each incoming connection will allocate a new or reuse an idle
> connection from the proxy to the server, up to the thread limit of the
> server (which is probably when you start seeing the connection lost errors).

Ok, makes sense. I had a closer look at the chassis/plugin source last
night, and we are currently evaluating what it would take to add this
'backlog' functionality, either as a patch for the proxy-plugin or a
stripped down proxy-plugin.

Our initial idea to get the multiplexing behaviour is:

A process similar to the query injection system, whereby we globally
queue a front-end connection with its pending query, and once an
active 'network_mysqld_con' passes the send_query_reponse phase
(including injected queries etc), we pop from the queue, swap out the
network_mysqld_con->client with the network_socket from the queue item
and inject the pending query. While there is a backlog this process
will be repeated.

I haven't thought this through entirely, but any suggestions would be helpful.


>
>> My lua script to do the query funneling is currently
>> returning 'Lost connection to MySQL server during query' errors to the
>> client if I have more clients connected and sending queries than I
>> have back-end connections open.
>
> Any chance you could share snippets of that script? Makes it a bit easier to
> discuss.
> also, which version of proxy are you using?

Im using 0.7.0 (well lp:mysql-proxy trunk)

I have attached, a cut down version of my test lua script, but I
understand the limitations I was confused about earlier.

>
> regarding your follow-up:
>>
>> (critical) proxy-plugin.c.1087: I have no server backend, closing
>> connection
>> (critical) network-mysqld.c.1181: plugin_call(CON_STATE_READ_QUERY) failed
>>
>> Yet i do not define a read_query_result in my lua script (and so I do
>> not play with backends/connections/proxy.* return status etc), which
>> leads me to ask if you need a connection available in the pool for a
>> back-end for every query coming in the front-end.
>
> the last message is not from the "proxy" itself, but the chassis which is
> handling the low-level network stuff.
> the CON_STATE_READ_QUERY is the state in the protocol, there doesn't
> necessarily has to be a lua callback for it. it's merely the place where
> proxy does the default behavior.

Yep, that is clear now also.

Thanks for your comments,

-- 
Nick Loeve

Attachment: mysqlproxy-pool-and-funnel.lua
Description: Binary data


References