-
Notifications
You must be signed in to change notification settings - Fork 21
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
Perf issues after m9 deployment #232
Comments
The issue is most visible in the new query page and appears to be reproducing for all the data sources in production. In stage the issue is only visible for the Athena data source. Here is a link for a profile for a query written for against the Athena data source: http://bit.ly/2vrU6Ag Also I have observed another issue that might be related. When writing a query the first letter introduced by the user is duplicated. This is only reproducing in production. Please view this screencast: |
I can reproduce slowness in prod on OS X in Nightly and 55.0.3 (64-bit). Nightly is giving a javascript error, though it's a minified variable name. I'm going to create/update a local test environment on my nightly machine. |
So... in nightly with postgres - current Mozilla master autocomplete works fine and has the drop-down on my local and production. Production misses the dropdown and has a speed issue on Athena and Presto. |
Just merged PR #233 to staging. Don't think it will fix the issue but it will be helpful for diagnostic purposes since Athena and Presto are the same on production and Athena is on staging and production. |
I did a quick profile yesterday of this, and it seems like the client-side lag is coming from some long-running javascript in angular's digest cycle: https://www.sitepoint.com/understanding-angulars-apply-digest/ Several possibilities here come to mind:
|
So the JS in redash has a 5000 token limit set right now to turn the auto completer on and off with a note about performance. Also this isn't reproducible in nightly on staging or prod for the metadata data source. I lowered the redash javascript token count check to 3000 as part of PR #234 and will see if that helps on staging. Given that the problem doesn't happen in Chrome (and at least 1 older version of Firefox), I currently think this was happening for a combination of:
|
This problem is totally reproducible in Chrome, so I think we can rule out (2). The problem is less grave there, but it's still definitely present. Losing autocompletion kind of sucks. :( Looking at a Firefox performance profile, it seems like much of the time is being spent in this function:
(I'm not sure why, but Chrome's profiler is refusing to give me more detail on this machine...) If you have time, it might be worth investigating where time is being spent using an unminified version of the site sources and see if there's anything that we could improve. In particular, I'm wondering if we're unnecessarily recomputing stuff every time the autocomplete callback is being executed -- in particular, why are we recreating
Could we not get away with only calling that function if it does not already exist? In addition to likely being expensive in itself, recreating it also requires us to rebuild the keywords property later in the function:
|
Hi @wlach. Thanks for continuing to investigate. This is what I ended up doing: https://github.com/mozilla/redash/compare/master@%7B1day%7D...master It seems to be working nicely on staging in Nightly with the Athena data source but it does eliminate autocomplete. FWIW: |
@alison985 have you verified that getCompletions is only being called once? It looked like it was being called multiple times from what I could tell in my profile. |
@wlach I tested again and it is getting called multiple times. Firefox organizes the dev console differently than Chrome (aggregates repeating prints) so I missed it first time around. However, if you print langTools before the langTools.addCompleter you see that it only stores the function call, not the values. I've tried changing that to no avail. I think this is the way the framework for autocomplete was built to work. It's also always been true. The thing that changed within redash related to the autocomplete was adding logic to take out the [P] (indicating partition key) and (column_type) characters for the auto-complete list. The things that would have changed in the data source was the number of tokens generated by the table and field count in a data source. I did find a line of code that was duplicating some tokens, but removing it still hasn't put us beneath the 5000 token mark for Athena. |
@alison985 So my suggestion was maybe we could cache some/all of what getCompletions returns, so subsequent calls to it don't have to regenerate a set of search suggestions from the schema. :) This might be as easy as putting in something like this logic in the function: getCompletions(state, session, pos, prefix, callback) {
if ($scope.autoCompleteSchema === undefined) {
// make a variable for the auto completion in the query editor
$scope.autoCompleteSchema = removeExtraSchemaInfo($scope.schema);
}
... Could you give that a try and see if it helps? It looks like whoever wrote this originally was trying to cache the result in |
I had actually already tried that if statement and many others. Regardless of what I do the framework stores the function call name, not the results. Have you seen the latest code? https://github.com/mozilla/redash/blob/master/client/app/pages/queries/query-editor.js#L37 |
Yeah, I think that's ok that the editor calls the function repeatedly -- that's probably just what it's designed to do. Your latest code looks like it should be fast though -- is the function still showing up in profiles? |
@wlach I have absolutely no idea how to check on a profile. It's on staging if you want to. |
Folks are reporting major lag and STMO performance issues that started conspicuously after the last deployment went out, in bugzilla (https://bugzilla.mozilla.org/show_bug.cgi?id=1394468) as well as multiple times in various IRC and slack channels. This is impacting people's work, so hopefully we can figure this out and get a 9.1 (or whatever the next minor rev is) out ASAP.
The text was updated successfully, but these errors were encountered: