Custom content searches using the REST API slows down as the search offset increases

XMLWordPrintable

    • 1
    • Major

      Issue Summary

      Custom content searches using the REST API slows down as the search offset increases.

      Steps to Reproduce

      1. Create a Confluence Cloud app that introduces its own custom content type.
      {
          "name": "Confluence Cloud Test App",
          "description": "Confluence Cloud Test App",
          "key": "k15t-confluence-cloud-test-app",
          "scopes": [
              "read",
              "write"
          ],
          "baseUrl": "https://confluence-test-app.eu.ngrok.io",
          "vendor": {
              "name": "K15t GmbH",
              "url": "http://www.k15t.com"
          },
          "authentication": {
              "type": "none"
          },
          "apiVersion": 2,
          "appVersion": "1",
          "apiMigrations": {
              "gdpr": true
          },
          "lifecycle": {},
          "modules": {
              "customContent": [
                  {
                      "key": "item",
                      "name": {
                          "value": "Test App"
                      },
                      "uiSupport": {
                          "listViewComponent": {
                              "moduleKey": "test-app-list-view"
                          },
                          "contentViewComponent": {
                              "moduleKey": "test-app-list-view"
                          },
                          "icons": {
                              "item": {
                                  "width": 16,
                                  "height": 16,
                                  "url": "/logo192.png"
                              },
                              "list": {
                                  "width": 16,
                                  "height": 16,
                                  "url": "/logo192.png"
                              }
                          }
                      },
                      "apiSupport": {
                          "bodyType": "raw",
                          "supportedContainerTypes": [
                              "space",
                              "page"
                          ]
                      }
                  }
              ],
              "generalPages": [
                  {
                      "key": "test-app-list-view",
                      "url": "/&spaceKey={space.key}",
                      "location": "none",
                      "name": {
                          "value": "Test App"
                      }
                  }
              ]
          }
      }
      1. Create ~1000 pages in a single space. Example:
      POST /rest/api/content
      
      {
          "type": "page",
          "title": "Page 1",
          "space": {
              "key": "LT"
          }
      }
      1. Create one custom content item underneath each of these pages. Example:
      {
          "type": "ac:k15t-confluence-cloud-test-app:item",
          "title": "Test Item New",
          "space": {
              "key": "LT"
          },
          "container": {
              "type": "page",
              "id": "123"
          },
          "body": {
              "raw": {
                  "value": {},
                  "representation": "raw"
              }
          }
      }
      1. Fetch all content items, 200 at a time:
      GET /rest/api/content?type=ac:k15t-confluence-cloud-test-app:item&spaceKey=LT&start=0&limit=200
      GET /rest/api/content?type=ac:k15t-confluence-cloud-test-app:item&spaceKey=LT&start=200&limit=200
      GET /rest/api/content?type=ac:k15t-confluence-cloud-test-app:item&spaceKey=LT&start=400&limit=200
      GET /rest/api/content?type=ac:k15t-confluence-cloud-test-app:item&spaceKey=LT&start=600&limit=200
      GET /rest/api/content?type=ac:k15t-confluence-cloud-test-app:item&spaceKey=LT&start=800&limit=200

      Expected Results

      Each query takes takes less than a few seconds.

      Actual Results

      The duration of each query increases such that the first request takes 2 seconds to complete. The second one 5 seconds. The third one 10 seconds. The fourth one 16 seconds. The fifth one 25 seconds.

      This means, each pagination request gets slower and slower. Fetching all 1000 custom content items takes 58 seconds in sum. Adding some expands, like we do in our app, worsens the performance even more.

      Workaround

      None

            Assignee:
            Dhiral Pandya
            Reporter:
            Dugald Morrow
            Votes:
            4 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: