Memory limits in Seq 2023.1 on Windows

It's been a month since Seq 2023.1 was released, and in that time we've seen a great uptake of the new version for Seq installations large and small.

One recurring theme in support has been the cache.systemRamTarget setting and SEQ_CACHE_SYSTEMRAMTARGET environment variable, or more precisely, its absence!

Seq 2023.1 has better support for memory usage limiting on Windows; here's how it works.

What was cache.systemRamTarget?

Earlier versions of Seq managed memory directly: Seq would allocate objects on the .NET heap to cache recent events, and when total system memory consumption surpassed the limit set in cache.systemRamTarget, the oldest events would be dropped and cleaned up by the garbage collector.

Seq 2023.1 relies instead on the operating system to move data in and out of RAM based on usage patterns and overall memory pressure. This has some great advantages, but also means that cache.systemRamTarget is obsolete - Seq doesn't manage the cache and so the limit is ignored.

Why limit working set?

Most of the time, it's safe to trust Windows with virtual memory management. You'll see very high memory utilization on your Seq server, but most of that will be file pages that can be dropped readily when more space is required. Keeping those file pages cached in RAM will reduce

Windows doesn't always have the same priorities as you do. If you're here because your Seq instance is no longer playing nicely with other services on the same host, you might need to apply Seq's new working set limit to leave some headroom free.

Introducing process.workingSetLimitBytes

The process.workingSetLimitBytes setting is the maximum size, in bytes, allowed for Seq's working set.

Using the command line, setting a limit of 16 GB looks like:

seq config set -k process.workingSetLimitBytes -v 16000000000
seq service restart

The same setting is also available as an environment variable, SEQ_PROCESS_WORKINGSETLIMITBYTES:

SEQ_PROCESS_WORKINGSETLIMITBYTES=16000000000

After restarting, the process's working set ("Memory" in Task Manager) will not exceed the number of bytes specified.

Required permissions

Under the hood, Seq uses Windows Job Objects to apply the working set limit.

If your Seq instance was a fresh 2023.1 install, then the Seq Service Administration app likely configured the SeqDefaultInstance service account with the permissions required for job control.

If not, and unless Seq is running as an account with administrative permissions on the local machine, you'll need to give the service account the "Increase a process working set" and "Increase scheduling priority" permissions in Local Group Policy Editor (gpedit.msc).

Nicholas Blumhardt

Read more posts by this author.