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

BCDA-7655: Update SSAS for resiliency / connection management improvements. #152

Merged
merged 4 commits into from
Jan 2, 2024

Conversation

alex-dzeda
Copy link
Contributor

@alex-dzeda alex-dzeda commented Dec 29, 2023

🎫 Ticket

https://jira.cms.gov/browse/BCDA-7655

🛠 Changes

Updated maximum number of DB connections from 40 -> 60
Added idle connection timeout
Updated from go 1.18-> 1.19 concurrent with updating to latest versions of dependencies.
Removed ioutil references (deprecation caused issues going from 1.18-> 1.19)

ℹ️ Context for reviewers

There are inefficiencies in connection handling for the go postgres / sql libraries that we use, leading to issues with stability. While bcda-app is locked to an old version of pgx due to the queuing package used, there’s no such restriction for SSAS, so we can use the latest version of the packages (with connection pooling improvements).

✅ Acceptance Validation

Manual verification of information in the commit, unit tests pass.

🔒 Security Implications

  • This PR adds a new software dependency or dependencies.
  • This PR modifies or invalidates one or more of our security controls.
  • This PR stores or transmits data that was not stored or transmitted before.
  • This PR requires additional review of its security implications for other reasons.

If any security implications apply, add Jason Ashbaugh (GitHub username: StewGoin) as a reviewer and do not merge this PR without his approval.

@laurenkrugen-navapbc
Copy link
Contributor

This PR adds a new software dependency or dependencies. - should we add a platform or sec team member to this PR since we are upgrading to 1.19?

@alex-dzeda
Copy link
Contributor Author

This PR adds a new software dependency or dependencies. - should we add a platform or sec team member to this PR since we are upgrading to 1.19?

Sure thing, adding @gsf as well for a quick look-see.
NB, the only mandated change with 1.18-> 1.19 was removal of ioutil references, which was simple enough.

@alex-dzeda alex-dzeda requested a review from gsf January 2, 2024 16:03
Copy link
Contributor

@kyeah kyeah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you!

@@ -31,9 +31,10 @@ func createDB() (*gorm.DB, error) {

// TODO: Allow connection settings to be configured by env vars
// https://jira.cms.gov/browse/BCDA-7109
sqlDB.SetMaxOpenConns(40)
sqlDB.SetMaxOpenConns(60)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, I checked production and the database-level max connections is pretty high:

bcda=> show max_connections;
 max_connections 
-----------------
 1709

sqlDB.SetMaxIdleConns(40)
sqlDB.SetConnMaxLifetime(time.Duration(5) * time.Minute)
sqlDB.SetConnMaxIdleTime(time.Duration(30) * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't realize this was a method, thank you!

@alex-dzeda alex-dzeda merged commit 4076ed2 into master Jan 2, 2024
1 check passed
@alex-dzeda alex-dzeda deleted the alex/bcda-7655-2 branch January 2, 2024 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants