[MXS-3505] option lazy_connect not fully effective Created: 2021-04-20  Updated: 2021-04-22  Resolved: 2021-04-22

Status: Closed
Project: MariaDB MaxScale
Component/s: readwritesplit
Affects Version/s: 2.5.9
Fix Version/s: 2.5.11

Type: Bug Priority: Major
Reporter: Pascal Merle Assignee: markus makela
Resolution: Fixed Votes: 0
Labels: None


 Description   

While setting lazy_connect=true helps, not to open connections to backend servers on session creation, one connection to backend server is always created at session end.

So if you have a high load of short-lived connections that can all be answered from a cache filter , e.g. session just doing one select that is answered from cache, the optimum would be not to open any backend connection at all.

Instead what happens is after the client already received its reply from the cache filter a backend connection is opened consuming cpu time on the backend server. First we were surprised by the load on the backend with the client getting the selected data so quickly. When we tried everything slowly with a sql command line client, and logging every connection and sql statement on the backend server we noticed that when leaving the session, a connection to the backend is made.

From looking at the source code we suspect that a QUIT packet gets routed to the backend, triggering opening the target connection.



 Comments   
Comment by markus makela [ 2021-04-20 ]

Your reasoning makes perfect sense as there's no special code for handling a COM_QUIT packet when lazy_connect is enabled and no connections are open. This should be an easy fix by adding that code that simply ignores the COM_QUIT if no connections are open.

Generated at Thu Feb 08 04:21:54 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.