You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@zeppelin.apache.org by Prasad Wagle <pr...@gmail.com> on 2016/09/30 19:45:03 UTC

Paragraph text editor is very slow when number of notes is large (> 1000)

Hi,

I just created ZEPPELIN-1513
<https://issues.apache.org/jira/browse/ZEPPELIN-1513> - Paragraph text
editor is very slow when number of notes is large (> 1000). The screenshot
attached to the Jira issue with profiler information indicates that the
problem is with the digest function. How do we fix this problem and is
there a short-term workaround?

Thanks,
Prasad

Re: Paragraph text editor is very slow when number of notes is large (> 1000)

Posted by moon soo Lee <mo...@apache.org>.
Thanks Prasad for sharing and investigating the problem.
Let me also try to reproduce and find the solution.

Thanks,
moon

On Thu, Oct 6, 2016 at 8:01 AM Prasad Wagle <pr...@gmail.com> wrote:

> Thanks DuyHai and Damien.
>
> I dug deeper and found that for every note or folder, there are 5 watchers
> in the navbar Notebook dropdown menu. There are 5 more in the home page
> only if the note or folder is displayed.
>
> At Twitter, most of the notes are in folders. The Notebook dropdown menu
> was creating more than 5000 watchers. Our temporary workaround is to remove
> the Notebook dropdown menu from the navbar. This has brought down the
> number of watchers to less than 1000 and fixed the ace editor performance
> problem.
>
> Are there ways to reduce the number of watchers created by the Notebook
> dropdown menu? What is the timeline for moving to Angular 2?
>
> *Javascript code to find watchers*
> From
> http://blog.yodersolutions.com/angularjs-count-the-number-of-watchers-on-a-page/
>
>   elementsWithScope = document.querySelectorAll('.ng-scope');
>   for (i = 0, len = elementsWithScope.length; i < len; i++) {
>     scope = angular.element(elementsWithScope[i]).scope();
>     if (scope.$$watchers) {
>       if (scope.$$watchers.length != 0) {
>         console.log(elementsWithScope[i]);
>         console.log(scope.$$watchers.length);
>       }
>     }
>   }
>
> *Watchers in the notebook menu in the navbar:*
> [image: image.png]
> *Watchers in the home page:*
> [image: image.png]
>
>
> You need 1000 notes to see slowdown in editor. You can investigate watcher
> count issue with any number of notes. Here's a script I used to create 1000
> notes:
>
> for i in $(seq 1 1000)
> do
>   echo $i
>   echo "{\"name\": \"Test$i\"}" > my-file.txt
>   curl --form "fileupload=@my-file.txt" localhost:8080/api/notebook
>  sleep 1
> done
>
>
>
> On Sat, Oct 1, 2016 at 7:05 PM, Corneau Damien <co...@gmail.com>
> wrote:
>
> Might be hard to reproduce if we need to have 1000 notes.
> And its also difficult to figure it out without more informations.
>
> I don't think there is a real short-term workaround, If the issue is from
> the notebook list, then using bind-once on that list could maybe have an
> impact.
> Otherwise things will get better as the code get cleaned up.
>
> On Sun, Oct 2, 2016 at 6:58 AM, DuyHai Doan <do...@gmail.com> wrote:
>
> The digest function is an Angular stuff and is a well known perf issue
> related to the way how Angular detects changes in UI components.
>
> This perf issue should be fixed with Angular2, which is using native
> functions for change detection:
> http://blog.thoughtram.io/angular/2016/02/22/angular-2-change-detection-explained.html
>
> On Fri, Sep 30, 2016 at 9:45 PM, Prasad Wagle <pr...@gmail.com>
> wrote:
>
> Hi,
>
> I just created ZEPPELIN-1513
> <https://issues.apache.org/jira/browse/ZEPPELIN-1513> - Paragraph text
> editor is very slow when number of notes is large (> 1000). The screenshot
> attached to the Jira issue with profiler information indicates that the
> problem is with the digest function. How do we fix this problem and is
> there a short-term workaround?
>
> Thanks,
> Prasad
>
>
>
>
>

Re: Paragraph text editor is very slow when number of notes is large (> 1000)

Posted by Prasad Wagle <pr...@gmail.com>.
Thanks DuyHai and Damien.

I dug deeper and found that for every note or folder, there are 5 watchers
in the navbar Notebook dropdown menu. There are 5 more in the home page
only if the note or folder is displayed.

At Twitter, most of the notes are in folders. The Notebook dropdown menu
was creating more than 5000 watchers. Our temporary workaround is to remove
the Notebook dropdown menu from the navbar. This has brought down the
number of watchers to less than 1000 and fixed the ace editor performance
problem.

Are there ways to reduce the number of watchers created by the Notebook
dropdown menu? What is the timeline for moving to Angular 2?

*Javascript code to find watchers*
From http://blog.yodersolutions.com/angularjs-count-the-
number-of-watchers-on-a-page/

  elementsWithScope = document.querySelectorAll('.ng-scope');
  for (i = 0, len = elementsWithScope.length; i < len; i++) {
    scope = angular.element(elementsWithScope[i]).scope();
    if (scope.$$watchers) {
      if (scope.$$watchers.length != 0) {
        console.log(elementsWithScope[i]);
        console.log(scope.$$watchers.length);
      }
    }
  }

*Watchers in the notebook menu in the navbar:*
[image: Inline image 1]
*Watchers in the home page:*
[image: Inline image 2]


You need 1000 notes to see slowdown in editor. You can investigate watcher
count issue with any number of notes. Here's a script I used to create 1000
notes:

for i in $(seq 1 1000)
do
  echo $i
  echo "{\"name\": \"Test$i\"}" > my-file.txt
  curl --form "fileupload=@my-file.txt" localhost:8080/api/notebook
 sleep 1
done



On Sat, Oct 1, 2016 at 7:05 PM, Corneau Damien <co...@gmail.com> wrote:

> Might be hard to reproduce if we need to have 1000 notes.
> And its also difficult to figure it out without more informations.
>
> I don't think there is a real short-term workaround, If the issue is from
> the notebook list, then using bind-once on that list could maybe have an
> impact.
> Otherwise things will get better as the code get cleaned up.
>
> On Sun, Oct 2, 2016 at 6:58 AM, DuyHai Doan <do...@gmail.com> wrote:
>
>> The digest function is an Angular stuff and is a well known perf issue
>> related to the way how Angular detects changes in UI components.
>>
>> This perf issue should be fixed with Angular2, which is using native
>> functions for change detection: http://blog.thought
>> ram.io/angular/2016/02/22/angular-2-change-detection-explained.html
>>
>> On Fri, Sep 30, 2016 at 9:45 PM, Prasad Wagle <pr...@gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> I just created ZEPPELIN-1513
>>> <https://issues.apache.org/jira/browse/ZEPPELIN-1513> - Paragraph text
>>> editor is very slow when number of notes is large (> 1000). The screenshot
>>> attached to the Jira issue with profiler information indicates that the
>>> problem is with the digest function. How do we fix this problem and is
>>> there a short-term workaround?
>>>
>>> Thanks,
>>> Prasad
>>>
>>
>>
>

Re: Paragraph text editor is very slow when number of notes is large (> 1000)

Posted by Corneau Damien <co...@gmail.com>.
Might be hard to reproduce if we need to have 1000 notes.
And its also difficult to figure it out without more informations.

I don't think there is a real short-term workaround, If the issue is from
the notebook list, then using bind-once on that list could maybe have an
impact.
Otherwise things will get better as the code get cleaned up.

On Sun, Oct 2, 2016 at 6:58 AM, DuyHai Doan <do...@gmail.com> wrote:

> The digest function is an Angular stuff and is a well known perf issue
> related to the way how Angular detects changes in UI components.
>
> This perf issue should be fixed with Angular2, which is using native
> functions for change detection: http://blog.thoughtram.io/angular/2016/02/
> 22/angular-2-change-detection-explained.html
>
> On Fri, Sep 30, 2016 at 9:45 PM, Prasad Wagle <pr...@gmail.com>
> wrote:
>
>> Hi,
>>
>> I just created ZEPPELIN-1513
>> <https://issues.apache.org/jira/browse/ZEPPELIN-1513> - Paragraph text
>> editor is very slow when number of notes is large (> 1000). The screenshot
>> attached to the Jira issue with profiler information indicates that the
>> problem is with the digest function. How do we fix this problem and is
>> there a short-term workaround?
>>
>> Thanks,
>> Prasad
>>
>
>

Re: Paragraph text editor is very slow when number of notes is large (> 1000)

Posted by DuyHai Doan <do...@gmail.com>.
The digest function is an Angular stuff and is a well known perf issue
related to the way how Angular detects changes in UI components.

This perf issue should be fixed with Angular2, which is using native
functions for change detection:
http://blog.thoughtram.io/angular/2016/02/22/angular-2-change-detection-explained.html

On Fri, Sep 30, 2016 at 9:45 PM, Prasad Wagle <pr...@gmail.com> wrote:

> Hi,
>
> I just created ZEPPELIN-1513
> <https://issues.apache.org/jira/browse/ZEPPELIN-1513> - Paragraph text
> editor is very slow when number of notes is large (> 1000). The screenshot
> attached to the Jira issue with profiler information indicates that the
> problem is with the digest function. How do we fix this problem and is
> there a short-term workaround?
>
> Thanks,
> Prasad
>