-
Notifications
You must be signed in to change notification settings - Fork 63
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
replace read async with read of SqlReader for perf #904
Conversation
[Trigger] Add release branch to PR build triggers (#734)
* add support for jobject and js, ps, python samples * use utils JsonSerializeObject + comment * Update src/TriggerBinding/SqlTriggerBindingProvider.cs Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> * fix unit test + pylint --------- Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
* Add link to privacy statement * Add privacy link to output message * add to output message * Fix typos (cherry picked from commit a9565f7)
* add sqltrigger attribute * add SqlChange type * enable oop test * add check * fix the null reference * use GetLogger
[Trigger] Add Privacy Statement to README and telemetry message (#751)
* enable debug logging for ps and python samples * enable debug logs for js samples
* add js, py, ps ProductsTriggerWithValidation test * fix test + missing file
* Further clarifications to trigger retry docs * Update description
* add more oop test samples * update logger
(cherry picked from commit d6ea6d7)
[Trigger] Filter out more default telemetry properties
# Conflicts: # README.md # builds/azure-pipelines/build-release.yml # src/Telemetry/Telemetry.cs
* add SQLTrigger annotation to java library * remove default values * use enum for commandtype
* add js, py, ps ProductsTriggerWithValidation test * fix test + missing file * add tests * remove extra comments + powershell compress * update comment
[Trigger] Merge latest from main
* Refactor SqlTriggerListener scaling to SqlTriggerMetricsProvider and SqlTriggerScaleMonitor * Create SqlTriggerTargetScaler * Refactor unit tests * Refactor to include common queries for scaling and listener class to SqlTriggerUtils * Add doc comments for scaling classes * Update src/TriggerBinding/SqlTriggerTargetScaler.cs Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> * Fix log statement * Update WebJobs package * Update nuget.config * Address review comments * Address review comments pt2 * Update src/TriggerBinding/SqlTriggerTargetScaler.cs Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> * Address comments, test failures * Fix packages lock file * Fix error message * Address comments and test failures * Apply suggestions from code review Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> * Change in documentation * Fix log level --------- Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
[Trigger] Merge latest from main
@cheenamalhotra This look good to you? |
src/SqlAsyncEnumerable.cs
Outdated
@@ -112,7 +112,7 @@ private async Task<bool> GetNextRowAsync() | |||
this._reader = await command.ExecuteReaderAsync(); |
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.
Since ExecuteReaderAsync has issues with cancellation - I would recommend changing that to ExecuteReader too. Do you plan to do that separately?
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.
That goes for any Async calls from SqlClient, right? @MaddyDev Make sure you're doing a search all for anything with "Async" in its name so we aren't missing any others.
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.
@MaddyDev You didn't update this one yet, is that on purpose?
src/SqlAsyncCollector.cs
Outdated
@@ -599,7 +599,7 @@ public static async Task<TableInformation> RetrieveTableInformationAsync(SqlConn | |||
{ | |||
string getPrimaryKeysQuery = GetPrimaryKeysQuery(table); | |||
var cmd = new SqlCommand(getPrimaryKeysQuery, sqlConnection); | |||
using (SqlDataReader rdr = await cmd.ExecuteReaderAsyncWithLogging(logger, CancellationToken.None)) | |||
using (SqlDataReader rdr = cmd.ExecuteReaderWithLogging(logger)) | |||
{ | |||
while (await rdr.ReadAsync()) |
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.
What about this ReadAsync (and the one above)?
src/SqlAsyncCollector.cs
Outdated
{ | ||
TelemetryInstance.TrackEvent(TelemetryEventName.TableInfoCacheMiss, props); | ||
// set the columnNames for supporting T as JObject since it doesn't have columns in the member info. | ||
tableInfo = await TableInformation.RetrieveTableInformationAsync(connection, fullTableName, this._logger, GetColumnNamesFromItem(rows.First()), this._serverProperties); | ||
tableInfo = TableInformation.RetrieveTableInformationAsync(connection, fullTableName, this._logger, GetColumnNamesFromItem(rows.First()), this._serverProperties); |
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.
Should we also remove the Async from the method names? (RetrieveTableInformation
)
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.
+1 - for any methods that no longer have await in them we should clean those up
How will we measure impact after this change? |
That would seem to fit nicely into the work we already have planned for perf baselines. @MaddyDev maybe you hold off on getting this in for now (since it's not actively blocking anyone AFAIK) and instead focus on getting the perf stuff figured out first so we can both test the usefulness of that along with validating that this is actually making an improvement? |
it's that mean the #903 will not fixed? |
Fixes #903
To preemptively address the below issues, we followed the fix made in sqltools service (microsoft/sqltoolsservice#2161)
dotnet/SqlClient#593
dotnet/SqlClient#44