JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources
Has many linkage performance improvement
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.3k
- Forks
- 546
- PR merge metrics
- No merged PRs in 30d
Description
Hi @lgebhardt,
We've encountered the issue with performance during include has many relations.
While we are including has many relations our resource is referencing to records_for(association_name) method which fetches all the relation data and then serializer while fetching links in relation (resource_serializer.rb:300) hits again the same has many relation which referrers again to records_for(association_name) code.
It seems to be redundant and it has an impact on the performance of the end-point.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing records_for(association_name) and the has-many path in resource_serializer.rb around line 300. Confirm where the included relation is fetched and where link serialization fetches it again; done means the redundant fetch is removed and endpoint performance is improved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- backend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100