How does Ember Data manage a large number of records?

I work with Ember Data and I am trying to understand some concepts. I have a pretty heavy data-intensive application, my back-end has endpoints that return a lot of records.

So basically, I have a Route that has something like this.store.findAll('places') , which can return thousands of places, each of which contains several text fields, such as services or description . This is only one of the resources, there are several more that process this amount of data.

My main problem is that the application falls into some kind of limit or becomes immune. So my question is this: how does Ember Data manage a large number of records? Is there any best practice for handling such scenarios?

+7
ember-data
source share
1 answer

How does Ember Data manage a large number of records?

Just like it handles a small number of records. This will not do anything special for performance if you try to load / extract a large number of records. You need to handle it yourself.

Is there any best practice for handling such scenarios?

Unfortunately not. Any specific binding is the only way to achieve this. But, as you can see in this thread , the β€œbest” way to do this is being discussed. There are adapters and plugins designed to handle this scenario, as well as a server template designed to simplify. But there is really no canonical way to do pagination with Ember Data.

In my opinion, the best way to process large amounts of data is to create a request endpoint and implement it on your server, independently processing everything. This will be the most adapted to your application and the easiest to understand. If that sounds complicated, it is. Dataset segmentation / pagination is not an easy problem to solve, you will probably encounter problems along the way. That is why there is no agreed best practice yet.

Update: Javier Cadiz mentioned the JSON API in the comments, so I thought I mentioned this. The JSON API seems to be the new defacto standard for Ember Data, and it defines the way paging is done. However, the JSON API is fairly new and not yet widely adopted. I believe that only recently Ember Data switched to the default JSON API adapter. Using this pagination is likely to require you to comply with the entire API, not just the pagination aspect. (Although you can always steal certain ideas from him.) Because of this, I am not sure that I would call it best practice yet.

Bottom line: the JSON API pagination method may be the way of the future, but at the moment it is not very popular. (Although this is only my opinion, it is based on what I see / read. It does not say how many people use it privately.)

+3
source share

All Articles