Reputation: 8153
We are facing some memory issues with HTTP requests and was asked to do pagination in our clients. As a client side developer I would like to understand if the pagination could be internally handled inside our Ruby on Rails server because our case is that all results are always fetched.
Could someone explain the memory handling of RoR in following cases:
5000 items queried in one request
5000 items queried in 5 requests, (1000, 1000, 1000, 1000, 1000)
Thanks.
Upvotes: 0
Views: 77
Reputation: 8898
You should use server side pagination, because when a request is completed, the objects allocated during the processing of that request become garbage, and will be garbage collected at some time.
Upvotes: 1
Reputation: 26842
Yes, you would use server side pagination with an offset parameter in your http request that would be used to populate the offset of a limited ActiveRecord query. If you post some code or further information I can give you a more specific example.
Upvotes: 0