Commit Graph
20 Commits
Author SHA1 Message Date
Wez Furlong 8029d6051f throttle: more redis limit diagnostics 2025-01-06 08:39:08 -07:00
Wez Furlong 62672a2fbd deps: upgrade mlua to 0.10
This is a reasonably significant upgrade, as it allows for
async functions to be Send, which could unlock more efficiencies
in our overall scheduling.

This commit is just the basic changes required to get the updated
mlua version compiling, it doesn't change anything else.
2024-12-07 09:17:54 -07:00
Wez Furlong f637db6b36 misc: fix some warnings with rust 1.83 2024-12-03 08:44:32 -07:00
Dirkjan Ochtman 93ae00482e Simplify LazyLock construction where possible 2024-09-24 06:31:21 -07:00
Dirkjan Ochtman bf896f5365 Replace once_cell with LazyLock/OnceLock 2024-09-24 06:31:21 -07:00
Dirkjan Ochtman db43aa2ffd mod-redis: derive Debug for RedisConnection 2024-09-23 14:11:56 -07:00
Wez Furlong a4fe44e272 redis/throttle/limit: surface connectivity issues better
I recently noted that an issue relating to failing redis auth
was not being surfaced in the diagnostic log.

It was being logged at debug level so wasn't visible by default.

This commit does two things to improve this:

* Surface that error at error level, but keeps "regular" over-limit
  events at debug level
* Explicitly pings the configured redis server on startup, so that
  connectivity can be validated at `--validate` time and not be
  an issue that is deferred until after the service is up and running.
2024-08-10 06:14:22 -07:00
Wez Furlong e2759de5b9 redis: replace mobc with deadpool
Per commentary in b1330171be, move
away from mobc and standardize on deadpool.

This means that a couple of the newly added pool parameters
are no longer present, but nobody has had a chance to embrace
those yet anyway.

Make a note in the changelog about the recent changes: I fixed a bug
that no one had noticed before, which was that the username/password
parameters for single node redis were ignored.  This was fixed by
52ca4d8be0
2024-08-09 20:56:05 -07:00
Wez Furlong 61c8e22d92 redis tests: check for redis-cli 7.x and later
Tests are failing on rocky8 because its redis-cli doesn't
understand the --cluster-yes option.

Let's just skip running the tests there; the client
coverage is sufficient on the other more modern platforms.
2024-08-06 21:27:52 -07:00
Wez Furlong 52ca4d8be0 redis: embrace the async interface in updated redis crate
Remove the r2d2 dep (which is synchronous only) and replace with
mobc which is a bit easier to use, async, and seems more developed.

Update the interface to expose more of mobc's connection pool
options.

Add explicit redis cluster integration tests.
2024-08-06 19:41:00 -07:00
Wez Furlong ece321774f bump redis 0.22 -> 0.26
This is sufficient to compile only, needs a bit more validation.
2024-08-05 17:52:11 -07:00
Wez Furlong 3261d1517f redis: add connect_timeout option
closes: https://github.com/KumoCorp/kumomta/issues/168
2024-04-19 12:33:23 -07:00
Wez Furlong 808464e713 mod-redis: skip tests if redis server isn't present 2023-09-17 10:26:29 -07:00
Wez Furlong 5538655fd5 allow building on macos
NOTE: macos is NOT a platform supported for production use!

This commit just enables basic build and test to facilitate
offline work when I'm travelling with a mac laptop.

There are important systems functions that are not implemented
in the macOS build.
2023-09-17 08:48:59 -07:00
Wez Furlong d9e4057f6b fix redis tests on centos7 2023-07-03 09:31:41 -07:00
Wez Furlong d3ba5ccd2c connection_limit: implement using leases
To support distributed connection limits, adjust the way that
connection limits are handled.

Previously, we'd do a simple in-memory comparison with the limit to
guide whether we had reached the limit.

In a distributed/clustered scenario we need a shared understanding
of the state of the connections, so we're moving to a lease-based
model.

Each connection is associated with a UUID.
Each egress path maintains a set of connections and their UUIDs.

When attempting to make a new connection, we can only proceed if the
number of connections associated with an egress path is below the limit.

When a connection is closed, its UUID is removed from the associated
set.

To handle crashes, kills and netsplits, the path -> uuid association is
also accompanied by an expiration time beyond which it can be assumed
that the lease is no longer valid.  We compute that time based on the
worst case timeout value for a single message send on the given pathway.
Each time a connection is ready to obtain a new message, it will try
to extend its lease by that same duration.

This commit introduces these concepts and models them using an in-memory
store for the single node case, and using redis for the cluster case.
When your policy enables `kumo.configure_redis_throttles`, that same
redis configuration is used to back to the connection limiting
functionality.

refs: https://github.com/KumoCorp/kumomta/issues/41
2023-06-30 15:39:09 -07:00
Wez Furlong 0c70ab2c52 improve error message when converting lua -> rust types
refs: https://github.com/KumoCorp/kumomta/issues/56
2023-06-14 20:14:14 -07:00
Wez Furlong 8e0583b6cf adopt tokio::task::Builder to label tasks 2023-03-06 09:38:18 -07:00
Wez Furlong 0ca585bd5a Optionally use redis for throttles 2023-03-05 10:39:56 -07:00
Wez Furlong eaaddbb6b6 add redis client 2023-03-05 09:57:03 -07:00