Uploaded image for project: 'Red Hat 3scale API Management'
  1. Red Hat 3scale API Management
  2. THREESCALE-8337

enable testing for N+1 database queries

    XMLWordPrintable

Details

    • Task
    • Resolution: Done
    • Major
    • 2.13.0 GA
    • SaaS
    • System
    • False
    • None
    • False
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started

    Description

      We need to create tests for N+1 database queries.

      Proactive reporting

      One of the items is to proactively detect them in CI with bullet or Prosopite. We better do that although we will have to handle false positives/negatives as well.

      Enabling test writing for N+1 queries

      This is tests for issues like https://github.com/3scale/porta/pull/2954

      I have tried writing with `n_plus_one_control` gem but it didn't work. `db-query-matchers` and `rspec-sqlimit` seem to only support rspec at the time of writing.

      One side issue here is that in the above example, the extra queries were handled by DB cache. But this still resulted in 3x API call performance loss. So I'm not so sure whether these query counting gems would catch that.

      This is a nice article with overview of most of the available options:
      https://bhserna.com/tools-to-help-you-detect-n-1-queries.html

      Attachments

        Activity

          People

            Unassigned Unassigned
            akostadi1@redhat.com Aleksandar Kostadinov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: