Replies: 6 comments 12 replies
-
Well, this is a light-duty application (unless you have a very different use case for lldap than what I had in mind). But it seems that setting a |
Beta Was this translation helpful? Give feedback.
-
Note that you can also enable debug mode and see for each query what takes time. |
Beta Was this translation helpful? Give feedback.
-
Some findings and suggestions. Short version:Make it configurable. If you don't fancy that, or need defaults, I would suggest min_connections(4 + #cores) for embedded/SQLite and (8 + #cores) for anything else, and max_connections of twice the minimum. Plus sensible timeouts for remote servers to reflect the high connection costs. Long version:With the current settings, I was reaching the max_connections(5) very quickly. When I lifted this to max_connections(16), I peaked at 8 quickly. It might need another 1 or 2 when the scheduler kicks in. I'm not sure why it needs all these connections though. I'm certainly not trying to authenticate 8 users in parallel. Connections not being released in time / waiting to be GC'ed, maybe? As I said, I don't know Rust... Could it be related to pooled LDAP connections holding on to DB connections? I'm using the Authelia feature build with 4 pooled LDAP connections. This is what I get:
In general, I would suggest that at least min/max is configurable. It may not matter much for an embedded SQLite instance with minimal overheads, but for an SSL secured server, consider: it's 3 round trips to establish the SSL connection, at least one round-trip to authenticate with the DB and another for the actual query. Add to that processing, crypto, hashing, load balancers, etc. It was enough for LLDAP to show warnings when simple queries took longer than one second... We don't need to optimize for throughput and LLDAP is unlikely to saturate the DB engine (and if it does, it's time to upgrade). When optimizing for latency, I want to make sure that no query has to wait for a connection to be established or returned to the pool. The resource overhead for keeping an established connection around is neglectable. So I rather have a few too many connections, unless there are limits server side that would starve other apps. The below works well for me, for example. Connections would time-out after 5 minutes and be forcefully recycled each hour, just in case. I think PgBouncer uses similar timeouts.
|
Beta Was this translation helpful? Give feedback.
-
Naa. These "docker build" runs take forever. Adding more than those 3 lines
would require setting up a Rust dev environment first.
…On Fri, May 10, 2024, 12:26 nitnelave ***@***.***> wrote:
Do you want to send a PR with this?
—
Reply to this email directly, view it on GitHub
<#910 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA6CUVI4FDAC5NNEXL76W7TZBSVHLAVCNFSM6AAAAABHLL33T2VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TGOBRGYYDG>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
That's okay with me. I have a working image now and can share it here if
someone else runs into this issue.
Learning Rust is on my list - but it won't be this month or next and
probably not this year either 😆😭
…On Fri, May 10, 2024, 12:45 nitnelave ***@***.***> wrote:
I'm saying that because I don't have much time behind a computer to write
code, so it probably won't be done for a long time unless you do it. But I
can help with questions and reviews.
—
Reply to this email directly, view it on GitHub
<#910 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA6CUVMTU47LH4ZNYL66YJDZBSXNVAVCNFSM6AAAAABHLL33T2VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TGOBRG42DS>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Let's revisit this when Authelia releases the LDAP pooling and I update my
own setup.
…On Fri, May 10, 2024, 12:59 Jens ***@***.***> wrote:
That's okay with me. I have a working image now and can share it here if
someone else runs into this issue.
Learning Rust is on my list - but it won't be this month or next and
probably not this year either 😆😭
On Fri, May 10, 2024, 12:45 nitnelave ***@***.***> wrote:
> I'm saying that because I don't have much time behind a computer to write
> code, so it probably won't be done for a long time unless you do it. But I
> can help with questions and reviews.
>
> —
> Reply to this email directly, view it on GitHub
> <#910 (reply in thread)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AA6CUVMTU47LH4ZNYL66YJDZBSXNVAVCNFSM6AAAAABHLL33T2VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TGOBRG42DS>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
|
Beta Was this translation helpful? Give feedback.
-
Hi
I've started to play around with a (serverless, SSL secured) Postgres as DB backend. Queries seem to be awfully slow. Is it possible that connections aren't kept open? I'm no Rust programmer, but I was wondering if this might need e.g. min_connections(2) and a decent idle_timeout(60)?
https://docs.rs/sqlx/latest/sqlx/struct.Pool.html
My understanding from the above and a bit snooping around the code is that the default "pool" is quite dry, i.e.
(I tried a docker build with min_connections and idle_timeout but couldn't get past
error: failed to compile 'wasm-pack v0.12.1'
)Beta Was this translation helpful? Give feedback.
All reactions