Comments - MariaDB Connector/J

8 years, 9 months ago Diego Dupin

Good question !

The value of the timeout socket option does not have to be related to the max time of a transaction.

The connector connects to the database with a socket. The socketTimeout option defined the Socket.setSoTimeout value. A read on that socket that take more time than this value will result as an exception, and kill the socket. This is an error that will be catched by the failover implementation.

Since aurora is design by default to be use as master / slave, socketTimeout has been set to 10s by default to permit failover. 10 seconds is already a lot, and to have an efficient failover, it is necessary that this value be as low as possible.

To be effective, the failover implementation need to detect the problem quickly. If not, new problem will arise : Assuming you are using a connection pool, it implies that the affected connections will not be released until the value of socketTimout . The appplication will not stop during that time, so the connection pool will create many new connections to meet the demands . This will cause a significant increase in resources used in your server and depending of the kind of problem possibly affect the database server. That may cause a lot more problems.

 
4 years, 8 months ago Gazal Gafoor

We do get socket timeout issues for queries that take longer to execute though. Like just queries that have a larger result set or ones that operate on large tables with TEXT columns with wildcard searches or CREATE INDEX statements.

Our understanding was also that socketTimeout should only impact the time for establishing the connection as opposed to the time it takes to execute a statement. Is this perhaps a bug in connectorj? Is there another connection parameter we can set along with socketTimeout to allow for longer queries?

 
8 years, 9 months ago Kyungseg Oh

Thanks for your answer!

We do have long running queries running around 3040 seconds. So we ended up overwriting default behavior with socketTimeout param to jdbc url.

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.