How do I guarantee consistent endpoint performance with list filters?

Options
danielbevan_tinkso
danielbevan_tinkso Member
edited October 2023 in ❓Other questions

My app's endpoint performance is great across the board when there is less traffic. "Endpoint A" will take less than 1 second to run consistently.

However, when traffic increases for a 6 hour period, "Endpoint A" begins to take 40+ seconds to run.



The 2 biggest culprits contain list filtering on a table Query.

Example:
Post's list of Tags — OVERLAPS — User's list of Tags

Both lists have a maximum of 10 Tags.

Indexes don't seem to be a problem and the GIN INDEX doesn't seem to work for my use case. Pagination is enabled. We don't want to cache responses.

Any ideas?


Typical performance:

Performance during increased traffic:

Answers

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    Hi,

    is it normal that this endpoint is called so many times? In your screenshots I can see 7 times at 7:09am? If not then that would be my first thing to investigate and prevent since it affect your performance significantly.

  • danielbevan_tinkso
    danielbevan_tinkso Member
    edited October 2023
    Options

    Yes @Pawel Magdanski, that's as expected. I do have a change coming that will reduce the number of API requests across the board that I know will help. However, with more traffic expected over time, I would assume this problem to continue unless there I implement a long-term solution.

    For context, certain optimizations (caching, recurring tasks, etc…) on other endpoints have kept performance up and usage down without a hiccup.

    The list on list filtering specifically seems to be the issue here. Again, this isn't an issue during lower traffic.

  • danielbevan_tinkso
    Options

    Update, this spike on this specific endpoint seemed to be isolated to a 3 minute period on October 10th. from 7:07 - 7:10.

    Is it possible we hit max usage without the graph indicating it?

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    Does anything specific happened in that time period?