Unverified Commit dbba7346 authored by Daniel Hiltgen's avatar Daniel Hiltgen Committed by GitHub
Browse files

runner: Set windows above normal priority (#6905)

When running the subprocess as a background service windows may
throttle, which can lead to thrashing and very poor token rate.
parent 6c2eb73a
...@@ -4,7 +4,10 @@ import ( ...@@ -4,7 +4,10 @@ import (
"syscall" "syscall"
) )
const CREATE_DEFAULT_ERROR_MODE = 0x04000000 const (
CREATE_DEFAULT_ERROR_MODE = 0x04000000
ABOVE_NORMAL_PRIORITY_CLASS = 0x00008000
)
var LlamaServerSysProcAttr = &syscall.SysProcAttr{ var LlamaServerSysProcAttr = &syscall.SysProcAttr{
// Wire up the default error handling logic If for some reason a DLL is // Wire up the default error handling logic If for some reason a DLL is
...@@ -12,5 +15,8 @@ var LlamaServerSysProcAttr = &syscall.SysProcAttr{ ...@@ -12,5 +15,8 @@ var LlamaServerSysProcAttr = &syscall.SysProcAttr{
// the user can either fix their PATH, or report a bug. Without this // the user can either fix their PATH, or report a bug. Without this
// setting, the process exits immediately with a generic exit status but no // setting, the process exits immediately with a generic exit status but no
// way to (easily) figure out what the actual missing DLL was. // way to (easily) figure out what the actual missing DLL was.
CreationFlags: CREATE_DEFAULT_ERROR_MODE, //
// Setting Above Normal priority class ensures when running as a "background service"
// with "programs" given best priority, we aren't starved of cpu cycles
CreationFlags: CREATE_DEFAULT_ERROR_MODE | ABOVE_NORMAL_PRIORITY_CLASS,
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment