Skip to content

improve performance of related entities retrieval #62

@jmfeurprier

Description

@jmfeurprier

Hi,

we encounter performance issues with related entities.

Given we make this API call:

GET https://api/articles/12345678-4792-11e7-88db-f23c9124c2b0

Which returns :

{
    "@context": "\/contexts\/Article",
    "@id": "\/articles\/12345678-4792-11e7-88db-f23c9124c2b0",
    "@type": "Article",
    "id": "12345678-4792-11e7-88db-f23c9124c2b0",
    "title": "foo bar",
    "tags": [
        "\/tags\/331a2c47-164a-11e7-8a8a-f23c9124c2b0",
        "\/tags\/331a658c-164a-11e7-8a8a-f23c9124c2b0",
        "\/tags\/331a71cc-164a-11e7-8a8a-f23c9124c2b0",
        "\/tags\/9c828580-75f3-11e7-8820-f23c9124c2b0",
        "\/tags\/9c82e2b1-75f3-11e7-8820-f23c9124c2b0",
        "\/tags\/9c834c02-75f3-11e7-8820-f23c9124c2b0",
        "\/tags\/9c850c8b-75f3-11e7-8820-f23c9124c2b0",
        "\/tags\/9c86ca17-75f3-11e7-8820-f23c9124c2b0",
        "\/tags\/9cc9f244-75f3-11e7-8820-f23c9124c2b0",
        "\/tags\/9cd4d60e-75f3-11e7-8820-f23c9124c2b0",
        "\/tags\/9d186137-75f3-11e7-8820-f23c9124c2b0",
        "\/tags\/9d194643-75f3-11e7-8820-f23c9124c2b0",
        "\/tags\/9d1f1245-75f3-11e7-8820-f23c9124c2b0",
        "\/tags\/9d1fe224-75f3-11e7-8820-f23c9124c2b0",
        "\/tags\/9d33f4f4-75f3-11e7-8820-f23c9124c2b0",
        "\/tags\/9d37d44d-75f3-11e7-8820-f23c9124c2b0",
        "\/tags\/9d4353fe-75f3-11e7-8820-f23c9124c2b0",
        "\/tags\/9d5d71fd-75f3-11e7-8820-f23c9124c2b0",
        "\/tags\/9da0e8d6-75f3-11e7-8820-f23c9124c2b0"
    ]
}

When we iterate over the entity tags collection ($article->getTags()), each iteration makes an API call to retrieve the tag entity:

GET https://api/tags/331a2c47-164a-11e7-8a8a-f23c9124c2b0
GET https://api/tags/331a658c-164a-11e7-8a8a-f23c9124c2b0
GET https://api/tags/331a71cc-164a-11e7-8a8a-f23c9124c2b0
GET https://api/tags/9c828580-164a-11e7-8a8a-f23c9124c2b0
...

Which kills the performances of our application.

Embedding the tags in the article API response is not an option in our case (for a lot of reasons).

So my question is: is there a way to tell the API client to retrieve all the tags at once instead of retrieving them one by one ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions