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

Improve database module cache performance #19546

Conversation

adfoster-r7
Copy link
Contributor

@adfoster-r7 adfoster-r7 commented Oct 10, 2024

Improves the database module cache performance from ~3 minutes to ~1 by performing bulk inserts of module metadata instead of multiple smaller inserts for every module/reference/author/etc.

Verification

  • Open msfconsole
  • Open IRB when inside of msfconsole
  • Run the migration
  • Verify the cache is correctly populated into the database

Before

The multiple DB inserts for each record takes 100 or so seconds

>> framework.db.purge_all_module_details; puts 'updating'; _, elapsed_time = Rex::Stopwatch.elapsed_time { framework.db.update_all_module_details }; puts elapsed_time
190.257881

After

The DB inserts take a 1-2 seconds

>> framework.db.purge_all_module_details; puts 'updating'; _, elapsed_time = Rex::Stopwatch.elapsed_time { framework.db.update_all_module_details }; puts elapsed_time
76.59721399999944

@adfoster-r7 adfoster-r7 marked this pull request as ready for review October 16, 2024 22:22
@cgranleese-r7 cgranleese-r7 self-assigned this Dec 13, 2024
@cgranleese-r7 cgranleese-r7 added enhancement rn-enhancement release notes enhancement labels Dec 13, 2024
@cgranleese-r7 cgranleese-r7 merged commit 2edbc6a into rapid7:master Dec 13, 2024
68 of 70 checks passed
@cgranleese-r7
Copy link
Contributor

Release Notes

Improves the database module cache performance from ~3 minutes to ~1 minute by performing bulk inserts of module metadata instead of multiple smaller inserts for every module/reference/author/etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement rn-enhancement release notes enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants