When to sideload with embeded data and when do load async


Hi, I finally understood how ember does the relationships between the models. Now I’m facing the big question: should I embed all relationships with the first request or should I load them asynchronously?

I have a model ‘Institute’ which has many ‘Cases’ and also many 'Slides’ The model ‘Case’ has many ‘Slides’ too. The ‘Slide’ belongs to ‘Case’ and the ‘Institute’

The number of slides per institute or case can get really really high. So if might not want to embed the slides with the institutes and the cases but load them only if needed. Now I don’t understand what ‘needed’ means… If the view touches the actual model or if the controller does? And how many at a time are actually requested then, because I would only like to load like a 100 and request the other 100 if really needed.

I thought about embedding the first 100 slides, sideloading them and somehow lazyload the rest if needed, but I guess that’s not really an option.

I just can’t really find any productive example where the performance is a concern and what the best practice is for related data which can get really really big… :slight_smile: Maybe you have some advise in how to something like this… I have also been thinking about pagination and if I should link the pagination to actually loading/requesting the data from the API.

I also don’t like to add the id-array of the related slides as a get parameter, do you know how to change that into a body/POST request with the id’s in the body. And I was also trying to figure out if I could load the slides async but not by the slide-id-array but by the institute or case-id given… But it seems like that’s not good practice? (The API I’m requesting is designed like that, but can be changed as well)

Thanks for any advise on my many unsorted questions, tell me if you need any more information for a solid answer.


This was obviously a too long and unsorted post/question, I understand and realize that…

I got a couple if things sorted out by myself by now:

  • I set the relationships up properly and see there the client would pull the parent first and then request all related children.
  • I decided on not to embed the children with the parent but requesting the data asynchronously
  • Pulling data from a RESTful API should always be done with a GET request, not a POST - that’s used to add data to a REST api

So by now I down to a few questions:

  • Can ember-data actually really handle data where relationships are like a 100 parent with at least a million children each. Has anyone made performance experience with big data in ember-data?
  • How to stop the app from loading all children at once, but only load a chunk and request the next if really needed by the view - what’s the best practice here?
  • What are the drawbacks if I don’t use relationships at all, even if the models are actually somehow related?

Edit: And I would really like to know what it means “ember loads the hasmany relationsship if needed” - what does needed mean, really? I read this everywhere but I have a hard time understanding this washy sentence “if needed” :smiley:


+1 for this, have you found an answer?


Honestly, no, not really… I have not found a answer which would really answer my above questions in detail, but here is what I found out:

  • My current project is still lacking a test with milions of models and I haven’t found any real figures about ember data performance with high numbers
  • Currently I still load all children asynchronously at once - it works for the moment, we put the chunk loading feature on a later milestone. I kind of have it in my head already, but I would need to play it through once, haven’t found time yet
  • The relationships in ember are working like a charme, I wouldn’t wanna miss them anymore!
  • The lazy loading actually is really true, it only loads children or parents if you access the properties either in a controller or a view…