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

Performance Issue with withTransaction API Causing Prolonged Execution and 502 Errors #14939

Open
2 tasks done
deepsangani97271 opened this issue Oct 7, 2024 · 1 comment
Open
2 tasks done
Labels
needs clarification This issue doesn't have enough information to be actionable. Close after 14 days of inactivity

Comments

@deepsangani97271
Copy link

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Mongoose version

8.7.0

Node.js version

20.11.1

MongoDB server version

8.0.0

Typescript version (if applicable)

5.5.3

Description

When using the withTransaction API with Mongoose to handle transactions, I’m encountering significant delays that ultimately result in 502 errors. However, when I handle transactions manually (starting, committing, and aborting), the same operations complete successfully and within expected timeframes. This suggests an inefficiency or potential bug within withTransaction.

Steps to Reproduce

  1. Start a transaction using session.withTransaction.
  2. Perform multiple database operations within the transaction, including create, update, and delete across various collections.
  3. Observe that the transaction takes considerably longer than expected, sometimes leading to a 502 error in the backend.

Expected Behavior

The withTransaction API should handle transactions efficiently, ensuring all operations are either committed or rolled back in a timely manner without introducing unexpected delays.

Observed Behavior

Prolonged transaction times, resulting in 502 errors.
The issue does not occur with manual transaction handling (startTransaction, commitTransaction, and abortTransaction).
Delays are more noticeable under higher loads or with concurrent transactions.

@vkarpov15
Copy link
Collaborator

Without code samples, there's no way we'll be able to repro this issue. The issue report is too vague.

One thing you could try to narrow this down would be to try running your workload without transactions, and see if you still observe the same performance degradation. The performance degradation could in theory be within withTransaction(), but it may also be due to other Mongoose internals, or even in the MongoDB server itself.

@vkarpov15 vkarpov15 added the needs clarification This issue doesn't have enough information to be actionable. Close after 14 days of inactivity label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs clarification This issue doesn't have enough information to be actionable. Close after 14 days of inactivity
Projects
None yet
Development

No branches or pull requests

2 participants