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

Reduce number of history requests to database. #2111

Closed
7 tasks
kvaps opened this issue May 22, 2018 · 5 comments · Fixed by OpenNebula/docs#3060
Closed
7 tasks

Reduce number of history requests to database. #2111

kvaps opened this issue May 22, 2018 · 5 comments · Fixed by OpenNebula/docs#3060

Comments

@kvaps
Copy link
Contributor

kvaps commented May 22, 2018

Enhancement Request

Description

Hi I just found that i have a lot requests to my database like:

SELECT body FROM history WHERE vid = 1234 AND seq = 200;
SELECT body FROM history WHERE vid = 1234 AND seq = 199;
SELECT body FROM history WHERE vid = 1234 AND seq = 198;
SELECT body FROM history WHERE vid = 1234 AND seq = 197;
SELECT body FROM history WHERE vid = 1234 AND seq = 196;
...

I not understand why just not use:

SELECT body FROM history WHERE vid = 1234 AND seq <= 200;

Use case

Only one request instead of many will greatly increase the productivity of operations.
It should bring more performance for db connection with less load.

Progress Status

  • Branch created
  • Code committed to development branch
  • Testing - QA
  • Documentation
  • Release notes - resolved issues, compatibility, known issues
  • Code committed to upstream release/hotfix branches
  • Documentation committed to upstream release/hotfix branches
@kvaps kvaps changed the title Reduce history requests number from database. Reduce number of history requests to database. May 22, 2018
@stale
Copy link

stale bot commented May 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. The OpenNebula Dev Team

@kvaps
Copy link
Contributor Author

kvaps commented May 29, 2019

up

@stale stale bot removed the Status: Abandoned label May 29, 2019
@stale
Copy link

stale bot commented May 29, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. The OpenNebula Dev Team

@stale
Copy link

stale bot commented Jun 28, 2020

This issue has been automatically closed due to lack of activity/feedback. Please reopen if you have further input or need to bump this. The OpenNebula Dev Team

@paczerny
Copy link
Member

Not only that we use slow method to read the history, but we read it very often. E.g. for onevm undeploy we read all history records 9 times :-(

Possible improvements:

  • use SELECT body FROM history WHERE vid = 1234 AND seq <= 200; to read history here
  • Do some kind of lazy loading of history records, we usually don't need them, load just last 2 records. Use explicit call to load all records when needed
  • Review code for subsequent calls of vm_pool->get or vm_pool->get_ro. basic_authorization method is a good candidate by replacing the first parameter id by pointer to object.

@paczerny paczerny reopened this Sep 13, 2024
@stale stale bot removed the Status: Abandoned label Sep 13, 2024
@paczerny paczerny added this to the Release 6.10.1 milestone Sep 13, 2024
@paczerny paczerny self-assigned this Sep 13, 2024
paczerny added a commit to OpenNebula/docs that referenced this issue Sep 24, 2024
rsmontero pushed a commit that referenced this issue Oct 4, 2024
- oned load only last 2 history records (not the full list)
- Dump all history records only if needed in VirtualMachine::to_xml.
- Dump conforms XML schecam and removes VM template from history records.

Speed up of onevm show command:
  - for small SQLite DB is for VM with 500 histories: 130 ms down to 5 ms
  - for big MySQL DB VM with 687 histories: 1000 ms down to 200 ms
feldsam pushed a commit to FELDSAM-INC/one that referenced this issue Dec 20, 2024
- oned load only last 2 history records (not the full list)
- Dump all history records only if needed in VirtualMachine::to_xml.
- Dump conforms XML schecam and removes VM template from history records.

Speed up of onevm show command:
  - for small SQLite DB is for VM with 500 histories: 130 ms down to 5 ms
  - for big MySQL DB VM with 687 histories: 1000 ms down to 200 ms

Signed-off-by: Kristian Feldsam <[email protected]>
feldsam added a commit to FELDSAM-INC/one that referenced this issue Dec 20, 2024
rsmontero pushed a commit that referenced this issue Jan 13, 2025
- oned load only last 2 history records (not the full list)
- Dump all history records only if needed in VirtualMachine::to_xml.
- Dump conforms XML schecam and removes VM template from history records.

Speed up of onevm show command:
  - for small SQLite DB is for VM with 500 histories: 130 ms down to 5 ms
  - for big MySQL DB VM with 687 histories: 1000 ms down to 200 ms

(cherry picked from commit e13c329)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants