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

Dataloader slows performance considerably. #6

Open
woh-dev opened this issue Jan 21, 2019 · 3 comments
Open

Dataloader slows performance considerably. #6

woh-dev opened this issue Jan 21, 2019 · 3 comments

Comments

@woh-dev
Copy link

woh-dev commented Jan 21, 2019

Are there any setup mistakes that I could be making that would result in Dataloader causing a massive performance hit for queries?

For the below query I am seeing average response times of 350ms without Dataloader and a huge increase to 5.9s - 11s with Dataloader:

query{
  userChats {
    _id
    participants {
      user {
        _id
        username
      }
    }
    buckets(last: 1) {
      edges {
        node {
          _id
          messages {
            author {
              name                        // the author field 'refs' the user collection 
            }
            text
            contentType
            systemMsg
            album {
              user {
                _id
                name
              }
              images {
                medium {
                  url
                }
              }
            }
            website {
              user {
                _id
                name
              }
              caption
              images {
                medium {
                  url
                }
              }
            }
            post {
              user {
                name
              }
              caption
              images {
                medium {
                  url
                }
              }
            }
            list {
              _id
              _teaser {
                large {
                  _sourceImage
                }
              }
            }
          }
        }
      }
    }
  }
}

I am setting up Dataloader by wrapping each TC composeWithDataLoader() and I'm not setting any options for cacheExpiration or removeProjection.

When I enable debug I see the following for the above query

New db request (findMany)
New db request (findOne)
New db request (connection)
New db request (findOne)
New db request (findOne)
New db request (findOne)
New db request (findOne)
New db request (findOne)
New db request (findOne)
New db request (findOne)
New db request (findOne)
New db request (findOne)
New db request (findOne)
New db request (findOne)

Any thoughts on what I might be doing wrong here or where to continue debugging?

I would expect that this kind of query would represent HUGE performance gains via dataloader given that we are loading the same user records over and over for each chat message.

@Marcvander
Copy link

I'm having the exact same problem. I'm wrapping composeWithDataLoader() around my composeWithMongoose() (composeWithDataLoader(composeWithMongoose(HumanAssignment))) and it considerably slows down my request

@SnidelyWhiplash
Copy link

Hello, is there any update here? Thanks!

@ddzyan
Copy link

ddzyan commented Jul 17, 2020

I also encountered this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants