-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Useful options and performance improvements for Pool #1779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't there a similar pull request previously? I believe the biggest ask them was to please split it up into multiple pull requests, rather than one giant one, because it's basically unreviewable as it is, or at least I definitely won't be able to review it in the new few weeks while on vacation with the amount of code changed.
Also, looks like some CI failure.
for (var flag in newFlags) { | ||
if (allFlags[flag] !== false) { | ||
allFlags[flag] = newFlags[flag]; | ||
for (var newFlagKey in newFlags) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why rename this variable? Seems unrelated to the pull request. Please undo or explain how it fits into changing the pool.
} | ||
} | ||
|
||
// Build flags | ||
var flags = 0x0; | ||
for (var flag in allFlags) { | ||
if (allFlags[flag]) { | ||
for (var key in allFlags) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why rename this variable? Seems unrelated to the pull request. Please undo or explain how it fits into changing the pool.
var flags = !Array.isArray(flagList) | ||
? String(flagList || '').toUpperCase().split(/\s*,+\s*/) | ||
: flagList; | ||
var flags = !Array.isArray(flagList) ? String(flagList || '').toUpperCase().split(/\s*,+\s*/) : flagList; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please undo the format change to this line.
So I did at least try to start reviewing, but quickly started to notice this is not backwards-compatible at all. I then noticed your note at the bottom of the pull request to consider it on the next major, so my bad! I deleted those comments :) |
I think it's too difficult to contribute a little big change. It seems to be prudent because many people use this module. I fully understand and agree on your thought. So, I guess it'd be better to create a new module that can operate independently without changing mysql module. I'll try on it. You can close this PR or refer to this concept later on for your next improvement. |
I would love to see this merged, the perf boost alone is 🔥 |
As far as I can tell, the biggest part of the perf boost is simply because with this PR, the connections are no longer always validated when you fetch them (the validation only happens every so often). Basically trading off some extra perf for a greater chance to end up with a bad connection from the pool. I'm not sure if that is a good trade off. |
BTW, isn't there already an independently operating pool module? generic-pool or somethibg like that? |
sequelize and knex both use generic-pool |
Ah, which based on help questions is a largr number of this module's users. I wonder: does it make sense for us to just use that module instead od trying to maintain out own pool implementation? For example:
|
oh if that is the tradeoff then that seems like a no go :P |
@dougwilson I agree with your opinion, but I don't think it's efficient to validate the connection every time. That's because it's very unlikely that expected problems with a recently used connection will occur. So some guys say that turning off this option is recommended in many cases. http://pubs.vmware.com/vfabric53/index.jsp?topic=/com.vmware.vfabric.tc-server.2.9/admin/manual-high-concurrency-jdbc.html I know about If there is a difference of opinion, we don't need to discuss further. |
mysql-pool-booster is for those who want to use experimental features of the pool. I'm going to try various improvements about the pool in this project. |
This is an improved version of the previous PR(#1591). It's more readable and offers useful options and improved performance. Please work with this PR when you're ready to merge this feature later.
Useful options
It offers more useful options like Commons DBCP.
See Readme.md
Improved performance
Performance is improved by over 80% without doing anything.
See benchmark code
More readable code
Focused on making the code easier to read and maintain for the following contributors, and tidy up wrong and unused logics.
I know that it's really hard to apply this right away because of people who use it in the wrong way such as accessing private underscore-prefix properties. Please consider it when major update is available later.