Add option to configure MARS on SqlServer Connections#20113
Merged
Conversation
As stated in this docs from Microsoft: https://github.com/Microsoft/msphpsql/wiki/Recommendations-for-improving-the-performance-of-PDO_SQLSRV-and-SQLSRV#1-multiple-active-result-sets-mars > MARS is enabled by default in both SQLSRV and PDO_SQLSRV drivers. There can be some performance drop when MARS is enabled. Existing code optimized to run in the non-MARS world may show a performance dip when run un-modified with MARS. This PR adds the ability to configure MARS on a SqlServer connection
deleugpn
reviewed
Jul 18, 2017
| $arguments['TrustServerCertificate'] = $config['trust_server_certificate']; | ||
| } | ||
|
|
||
| if (isset($config['multiple_active_resultsets']) && $config['multiple_active_resultsets'] === false) { |
Contributor
There was a problem hiding this comment.
$arguments['MultipleActiveResultSets'] = $config['multiple_active_resultsets'] ?? true;
Contributor
Author
There was a problem hiding this comment.
Hi, thanks for your observation, Laravel 5.4 still supports PHP 5.6 which does not have the null coalesce operator, so, unfortunately that cannot be used. I hope it gets merged on Laravel 5.4 because that is what I use in production.
Also the argument should only be set to the string value 'false' (not the false boolean value) only when explicitly disabled, because:
- MARS is enabled by default (see the Microsoft docs linked above)
- The
buildConnectString(...)method usessprintfso afalseboolean value would be outputted as the string'0', and if you look in Microsoft documentation linked above the added option to the connectiion string should beMultipleActiveResultSets=false - I used the
$config['pooling'](a few lines above) as an example on how to do it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As stated in this docs from Microsoft:
https://github.com/Microsoft/msphpsql/wiki/Recommendations-for-improving-the-performance-of-PDO_SQLSRV-and-SQLSRV#1-multiple-active-result-sets-mars
This PR adds the ability to disable MARS on a SqlServer connection