-
Notifications
You must be signed in to change notification settings - Fork 292
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
PR #1001: Postgres Connection Pooling Control #1015
Conversation
I don't think this is a bad addition to have but I'd be interested in knowing why two connections are required. |
To put it another way, an even better solution would be to accept this patch but not error on 1 connection :-) |
Thanks @jefferai going to take another look at this and see if I can get some logs out of the DB driver for an explanation - Would be good to be able to minimise the number of connections for limited environments such as the ones provided by a managed Postgres option |
@jefferai Okay so I think I have traced the issue by littering logs everywhere for debugging - https://github.com/hashicorp/boundary/blob/main/internal/kms/repository_root_key.go#L141 this function call is not returning - I suspect it might have something to do with the reader used in list() function - Wondering if Gorm is creating a couple of connections for each emit of the read to run reads and writes concurrently? Boundary uses a reader and writer here https://github.com/hashicorp/boundary/blob/main/internal/kms/repository.go#L25. I found this in an article
Which suggests two different transactions (ie a read + write) would require independent connections and may explain the blocking problem |
@jefferai Any suggestions on how to proceed with this? Wondering if its a GORM bug more so than Boundary. Is it okay to set minimum required to 2? |
I'm milestoning this for 0.2.1 -- you may well be right in your assessment but we want to also dig into it and verify it, regarding the reason 1 connection doesn't work. Don't worry -- we want this feature! We just haven't been able to get to it in the runup to 0.2.0...sorry about that. |
Hi @jefferai Thanks for getting back to me :) No worries I'm curious as well as to why one connection does not work. In theory it should I do certainly suspect this will be a GORM limitation more than a Boundary one. We may just have to set the min connections to 2 and open an issue upstream for GORM - Let me know if you need any more tests in the meantime! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update the docs, now that we have a reason for the required two connections?
Changes made and re sync'd with main due to failing CI script |
@dylanrhysscott -> ty for the contribution! |
* test(e2e): Add test for minio * CR * test(e2e): Add session recording test with oRemoteCommand (#1032) * test(e2e): Add session recording test using oRemoteCommand * CR: Use io.Discard * test(e2e): Add session recording control master test (#1035) * test(e2e): Add session recording test with ssh certificate injection (#1033) * test(e2e): Add test for certificate injection with session recording * CR: Add test cases to use sign endpoint * test(e2e): Add session recording test with scp (#1036) * test(e2e): Add scp test for session recording * CR: Math
This closes #1001
It appears Boundary requires at least 2 connections to start correctly presumably a connection for a controller and one for the worker? If this was set to 1 Boundary just appears to hang and server never starts so I have added a check to throw an error if 1 is specified. Setting this value to 0 will allow Boundary to open as many connections as required. Testing this using current Boundary release we see 3 idle connections from one controller:
Setting the following config
The number of active connections is reduced
Setting the following config
Boundary correctly throws an error