MongoEngine / MongoEngine/mongoengine

Performance issue in 0.21+ with count()

Open
#2,470 15 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
4.3k
Forks
1.2k
Avg merge
4h 41m
Merged PRs (30d)
11

Description

I am currently on 0.20.0 for mongoengine.

I have a route /healthcheck which does something like Foo.object.count() to make sure mongo connection is valid.

When I try upgrading mongoengine to 0.21.0 my healthcheck started timing out. As a result, my app never looked healthy so docker killed it. I waited a couple months and noticed there was a new version.

With 0.22.x, I am still having the same issue.

I don't know how to go about debugging this and it is hard to reproduce locally because I only have 1% of production data. It seems like it just hangs.

Has this been issue for anybody else?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the count() behavior between MongoEngine 0.20.0, 0.21.0, and 0.22.x using a MongoDB dataset resembling production. Investigate why Foo.object.count() hangs during the /healthcheck route; done means the regression is reproducible, its cause is identified, and the issue has a verified fix or documented explanation.

Written by the indexing model from the issue text.

Assessment

Tech stack
mongodb, python
Domain
databases, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.