tag:blogger.com,1999:blog-14455177.post5483029293482408115..comments2024-03-07T18:57:25.977+01:00Comments on Mikael Ronstrom: MySQL Thread Pool vs. Connection PoolMikael Ronstromhttp://www.blogger.com/profile/07134215866292829917noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-14455177.post-63064593162012806252014-05-13T10:24:13.043+02:002014-05-13T10:24:13.043+02:00The first paragraph describes the connection pool....The first paragraph describes the connection pool. Here a connection is put into a pool of connections when it is closed.<br /><br />The thread pool is about how connections are treated on the MySQL server side. Traditionally the connections have had a separate thread. With thread pool the connections grabs a thread from the pool of threads when a query needs to be executed. Mikael Ronstromhttps://www.blogger.com/profile/07134215866292829917noreply@blogger.comtag:blogger.com,1999:blog-14455177.post-66967506723815921632014-05-13T10:14:55.523+02:002014-05-13T10:14:55.523+02:00If I understand this right:
- I connect to MySQL ...If I understand this right:<br /><br />- I connect to MySQL server<br />- execute some queries<br />- call MySqlConnection.Close()<br />- at this point connection is not closed, it is kept in connection pool of the client (application). When I execute again MySqlConnection.Open(connection string), connection will be created from the connection pool of the application (connection poll just returns instance of MySqlConnection class).<br /><br />Once the connection from the client to MySQL server has been established it means that as long as application is running socket is opened at client side and another socket and a thread are used on MySQL server. This means that MySQL server keeps socket and thread reserved for this client. Or is it better when client finishes its "sql work" that MySQL server closes socket and terminates client's thread, so this socket can become available/free for other clients. Also if client application does some other work (not sql), MySQL server just waits for client (idle process).<br />Miha Svalinahttps://www.blogger.com/profile/06045364175037560971noreply@blogger.com