graphql-compose / graphql-compose/graphql-compose-dataloader

Dataloader slows performance considerably.

Open
#6 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
18
Forks
6
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.