Skip to content

nestRemoting causes huge performance changes #3079

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

Closed
Undrium opened this issue Jan 9, 2017 · 3 comments
Closed

nestRemoting causes huge performance changes #3079

Undrium opened this issue Jan 9, 2017 · 3 comments
Assignees
Labels

Comments

@Undrium
Copy link

Undrium commented Jan 9, 2017

Our project has Users which need access to models further away than one step from them in relationship. A User is part of a group which in its turn has other items.

/Users/uid/Groups/gid/Items/iid

The above URI shouldn't be a problem, right? The users are connected to the groups through another model, otherwise this uses normal relations. Since we only got access to /Users/uid/Groups/gid by default we had to use nestRemoting().

app.models.User.nestRemoting('groups');
app.models.Group.nestRemoting('items');

This worked, but also added 6 seconds of loading time for our application (one request to /Users/uid/Groups/gid/Items/). Now we have pageloads at 7-8 seconds instead of 1-2. Is there any known issues here? We are using the absolutely most simple type of relationship here. Only thing that might cause a problem is the relationship between User and Group which is a simple through model.

@Undrium
Copy link
Author

Undrium commented Jan 9, 2017

After some deep diving into the wonderful world of debugging of NodeJS I found the perpertrator to be another Boot-script (getCurrentContext-quickfix) used from here: https://gist.github.com/ebarault/fdc39c5d07cc40f08664256f9e00905a

I know alot of people use this as a patch, so might be helpful in the future. Also, I hope this is not patched into the official version (#1495) as it really slows down Loopback.

@davidcheung
Copy link
Contributor

@Undrium interesting and thanks for bringing this up, it would be great help if you could try to upgrade to the latest LB with 4de3aa7, (the implementation is different from the one offered from the gist) and see if there are any performance degradation, or a sandbox so we could have a reference point.

@davidcheung davidcheung self-assigned this Jan 11, 2017
@Undrium
Copy link
Author

Undrium commented Jan 16, 2017

It seems fine since it does not go through every available model-function injecting the context but lets you do it manually. What should be tested is when this is done to a larger amount of model functions or measure the difference on a single function getting it assigned. This occured to us when we started using the nestRemoting() so should probably be a model which is indirectly related as a child to another from a parent-middlechild-child perspective.

At first glance this looks fine, not entirely sure how much more juice it demands, though.

@stale stale bot added the stale label Aug 23, 2017
@stale stale bot closed this as completed Sep 6, 2017
@0candy 0candy removed the triaging label Sep 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants