{"action":"closed","issue":{"url":"https://api.github.com/repos/felixge/node-mysql/issues/1229","labels_url":"https://api.github.com/repos/felixge/node-mysql/issues/1229/labels{/name}","comments_url":"https://api.github.com/repos/felixge/node-mysql/issues/1229/comments","events_url":"https://api.github.com/repos/felixge/node-mysql/issues/1229/events","html_url":"https://github.com/felixge/node-mysql/issues/1229","id":108862306,"number":1229,"title":"Open new connections to keep pool \"warm\"","user":{"login":"acorbi","id":384894,"avatar_url":"https://avatars.githubusercontent.com/u/384894?v=3","gravatar_id":"","url":"https://api.github.com/users/acorbi","html_url":"https://github.com/acorbi","followers_url":"https://api.github.com/users/acorbi/followers","following_url":"https://api.github.com/users/acorbi/following{/other_user}","gists_url":"https://api.github.com/users/acorbi/gists{/gist_id}","starred_url":"https://api.github.com/users/acorbi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acorbi/subscriptions","organizations_url":"https://api.github.com/users/acorbi/orgs","repos_url":"https://api.github.com/users/acorbi/repos","events_url":"https://api.github.com/users/acorbi/events{/privacy}","received_events_url":"https://api.github.com/users/acorbi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/felixge/node-mysql/labels/question","name":"question","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":{"login":"dougwilson","id":67512,"avatar_url":"https://avatars.githubusercontent.com/u/67512?v=3","gravatar_id":"","url":"https://api.github.com/users/dougwilson","html_url":"https://github.com/dougwilson","followers_url":"https://api.github.com/users/dougwilson/followers","following_url":"https://api.github.com/users/dougwilson/following{/other_user}","gists_url":"https://api.github.com/users/dougwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/dougwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougwilson/subscriptions","organizations_url":"https://api.github.com/users/dougwilson/orgs","repos_url":"https://api.github.com/users/dougwilson/repos","events_url":"https://api.github.com/users/dougwilson/events{/privacy}","received_events_url":"https://api.github.com/users/dougwilson/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-09-29T12:50:32Z","updated_at":"2015-10-25T02:11:31Z","closed_at":"2015-10-25T02:11:31Z","body":"Here is my scenario: \r\n\r\nOn a multi-instance nodejs server application I am expecting high traffic peaks in which it would be beneficial to have a Connection Pool with many **open** and **free** connections waiting for the request bursts to come. By doing that, the requests would be served instantaneously without having the CPU overhead of opening them all of a sudden. In my scenario, the **connectionLimit** is rather high ( ~400 per node instance ) and opening that big number of connections at once can cause high CPU peaks on the database instance.\r\n\r\nOn the Pool module https://github.com/felixge/node-mysql/blob/master/lib/Pool.js#L22-L70 I can see the getConnection method which first checks if free/released connections are available and acquires them before creating new ones, but what I am actually interested in is to create a max of **connectionLimit** number of free connections to be acquired by threads running actual queries on the mentioned high traffic situations. \r\n\r\nMy approach:\r\n\r\nOn https://github.com/acorbi/node-mysql/commit/f7e10e1efeb77b188759c1f896daf4f75ae4c72f you can see my approach. In a nutshell, it consists on adding a new function to the Pool module which allows to create those connections (as long as the limit allows it) without checking first if there are free connections available.\r\n\r\nAfter calling getNewConnection method I am releasing the connection by calling connection.release():\r\n\r\n```\r\nthis.getNewConnection(function(err, connection) {\r\n     connection.release();\r\n});\r\n```\r\n\r\nMy questions:\r\n\r\nDoes my approach actually make sense? Would you suggest other alternatives to achieve this warm-up without tweaking the actual node-mysql implementation? In case you \"like\" this feature, would you suggest any other \"more elegant\" way of implementing this. Would you be interested in a PR?\r\n\r\nGreetings"}}