Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support long running queries #103

Open
tim-hm opened this issue Jan 30, 2025 · 0 comments
Open

Support long running queries #103

tim-hm opened this issue Jan 30, 2025 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@tim-hm
Copy link
Collaborator

tim-hm commented Jan 30, 2025

Background

Some aggregations/queries are long running, and before their completion, the http connection will timeout (e.g. ALB defaults to 60s). In these cases, there is no endpoint to retrieve the output after the connection is terminated.

As a first step to solving this issue, we should support adding indexes to increase query performance (re #102), however, some queries may still take longer than 60s to return.

To address this, we want to allow the queuing query execution in one request and retrieving the results in another. Below is a starting point straw man implementation.

Proposal

  1. Leave the existing /api/v1/queries/execute as is.
  2. Add an endpoint to queue a query for execution:
    # Request
    POST /api/v1/queries/queue
    
    {
      "id": "<query-id>",
      "variables": { ... }
    }
    
    # Response:
    {
        "data": "<job-id>"
    }
    
    
  3. Now the client should periodically check for the output:
    # Request
    GET /api/v1/queries/queue/:job-id
    
    # Pending response:
    {
      "data": {
        "status": "pending"
      }
    }
    
    # Finished response:
    {
      "data": {
        "status": "success" | "failure",
        "result": { ... }
      }
    }
    

Notes

  • Completed jobs would have a 1 hour TTL
@tim-hm tim-hm added this to the 0.5.0 milestone Jan 30, 2025
@tim-hm tim-hm added the enhancement New feature or request label Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant