Commit Graph
9 Commits
Author SHA1 Message Date
Wez Furlong a029b44d1c add systemd service to .deb 2023-03-29 09:23:45 -07:00
Wez Furlong a4d321cd82 docs: generate the changelog section
Add reverse sort so that we always show the latest at the top
2023-03-11 22:46:07 -07:00
Wez Furlong f0c893582e switch from mdbook to mkdocs 2023-03-11 20:13:54 -07:00
Mike Hillyer a4918b9eeb VSCode is trying to use the repo to sync settings, adding it to the ignore. 2023-03-11 10:06:25 -05:00
Wez Furlong 722876a144 first pass at memory awareness
This commit introduces awareness of memory limits that may
have been established for the process.

The idea is that the hard/soft limits are read from the active
cgroup, falling back to classic ulimit hard/soft limits, falling
back to the system RAM size.

In the absence of an explicitly configured hard limit, the RAM size
is used for the hard limit.

In the absence of an explicitly configured soft limit, 75% of the
hard limit is used for the soft limit.

A background thread monitors the memory usage and (potentially
adjusted) memory limits.

A low memory state is when the usage is within 10% of the soft limit.
In this state, we start to trim back memory usage, shrinking loaded
data when messages are placed into the ready queue.

A more severe memory state is when the usage exceeds the soft limit.
In this state, new message reception is rejected until the usage
recovers.

kumod doesn't do anything directly with the hard limit, but assumes
that the system will terminate the process with no opportunity to
safely clean up if that value is reached.

In order to reduce the memory usage, the allocator has been switched
to jemalloc which has superior management of fragmentation and
a control interface to request release of various memory caches.

We make use of jemalloc specific functions in the tokio thread pools;
when they park (idle), we release the thread local cache, and when
we reach the soft limit we aggressively flush the caches until
memory usage falls below the limit.

There's like some room for tuning of the thresholds around this,
but this is a reasonable start.

Note that there are no explicit config options in kumod to set
the soft and hard limits: those are taken from the process
environment and can be simply set either via ulimit in a calling
shell script, or via systemd service configuration.

We may introduce some knobs for the low memory state threshold
in the future.
2023-03-09 18:50:24 -07:00
Wez Furlong bfe1d5f94b docs: add some basic reference info
The content here needs to be fleshed out some more, but this commit
is intended to get the skeleton in place.
2023-02-25 14:59:20 -07:00
Wez Furlong 831bfe9aab docs: skeleton for building the docs
Rather than edit SUMMARY.md, you edit docs/generate-toc.py
and it will flesh out sections based on the list of files
in a directory.
2023-02-25 10:50:58 -07:00
Wez Furlong bda38adf90 restructure docker build bits
This makes it a bit easier to add other docker images
for other things in the future
2023-02-20 02:47:59 +00:00
Wez Furlong 3287523d84 Skeleton tokio server for kumod 2023-02-10 16:44:10 -07:00