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

Mongodb slow query #5805

Closed
chain312 opened this issue Nov 15, 2022 · 8 comments
Closed

Mongodb slow query #5805

chain312 opened this issue Nov 15, 2022 · 8 comments

Comments

@chain312
Copy link
Contributor

SUMMARY

Mongodb slow query

STACKSTORM VERSION

st2 3.7.8, on python 3.8.10

OS, environment, install method

docker deployment

Steps to reproduce the problem

When I input 20,000 pieces of data at a time in a short time, the problem of slow query by mongodb occurs. It takes more than ten seconds to read a piece of data. The cpu of the host where the mongodb container is located is 32G, the memory is 128G, and the utilization rate is not high.
The remaining 80% cpu.
image
Memory remaining 90%
image
Query time
image
Size and number of action _ execution _ scheduling _ queue _ item _ d _ b tables
3f0eb2c465156d3ef40d50ea3e55a01

Expected Results

Mongo read time is reduced so that I can run more action.

Actual Results

I entered 20,000 pieces of data into the playbook.

Thanks!

@chain312
Copy link
Contributor Author

I changed mongodb to fix this problem

@nzlosh
Copy link
Contributor

nzlosh commented Nov 22, 2022

Would you mind sharing what you changed to resolve this issue so that other people who encounter the same problem have an hint on how to resolve it?

@chain312
Copy link
Contributor Author

Would you mind sharing what you changed to resolve this issue so that other people who encounter the same problem have an hint on how to resolve it?

I have optimized the mongo sql index by creating an index in the [sort] field

@arm4b
Copy link
Member

arm4b commented Nov 22, 2022

@chain312 Good to hear! Is it something you could contribute to StackStorm as a PR?

It would save you from doing the same operation for every new st2 installation and also make the community benefit from the enhancement.

@chain312
Copy link
Contributor Author

@chain312 Good to hear! Is it something you could contribute to StackStorm as a PR?

It would save you from doing the same operation for every new st2 installation and also make the community benefit from the enhancement.

Hello, mongodb tuning is not written code. Can I write it in https://github.com/StackStorm/st2docs project?

@arm4b
Copy link
Member

arm4b commented Nov 23, 2022

The index creation in MongoDB is part of StackStorm initialization.
See examples of the past PRs adding DB schema/index changes:

What was the index you've added?

@chain312
Copy link
Contributor Author

The index creation in MongoDB is part of StackStorm initialization. See examples of the past PRs adding DB schema/index changes:

What was the index you've added?

Thank you. I will submit the merge request later

@chain312
Copy link
Contributor Author

The index creation in MongoDB is part of StackStorm initialization. See examples of the past PRs adding DB schema/index changes:

What was the index you've added?
I have submitted the code for your review
Add a federated index to resolve mongo slow queries

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

No branches or pull requests

3 participants