• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Server Stability of kf2 server in Windows vs Linux

anotherDSH

Grizzled Veteran
Dec 24, 2017
64
11
64
Hi group,

Curious if anyone can comment as to which is the most stable platform to run a kf2 server. I picked up a used pc (Intel NUC i5-7567u, 8GB ram) which I installed Windows 11 and created a kf2 server. However it crashed after the first hour. Not sure if that was a one-off or it's what I can expect moving forward.

My past experience was good with Windows 7, awful with Windows 10 (many crashes) and have not run on Windows 11 except for the above described fail.

I have experimented a bit with running one on Ubuntu a few years ago but my Linux skills were weak. I got it working but preferred to have the PC on windows because the remote desktop was more reliable.

I would appreciate any thoughts and comments on stability from anyone who has run the servers on multiple platforms. Also if anyone has had success in Window 11.

Regards,

David
 
You will quickly discover it is irrelevant what platform you use. KF2 dedicated servers are not stable. Especially if you add mutators.

Here is a generic Windows Powershell script to monitor and restart KF2 instances. The $Processlist variable needs to be updated to have all of your server details. The hardcoded wait time and number of players can also be adjusted as required.

Code:
Function New-TitleObject(){
    #Create a object for holding server titles and player count
    $LDefaultObject = New-Object -TypeName psobject
    $LDefaultObject | Add-Member -type NoteProperty -name Title                     -value "NOTSET"
    $LDefaultObject | Add-Member -type NoteProperty -name PlayerCount               -value "NOTSET"
    return $LDefaultObject
}
Function Write-LogHost(){
[CmdletBinding()]
param (
    $LMessage
)
    write-host "$(get-date -UFormat "%d%m%y %H%M") $($LMessage)"
    "$(get-date -UFormat "%d%m%y %H%M") $LMessage" | Out-File -Append -FilePath c:\bin\log.txt
}

#windows only
#Gets the currently running KF2 windows titles which has the count of players in the game. Returns array of users and titles
Function Get-WindowTitalsAndPlayers(){
    $WindowTitles = Get-Process |where {$_.mainWindowTItle} | where { $_.name -eq "KFServer" } | select mainwindowtitle
    $WindowTitalsAndPlayers=@()
    foreach ($WindowTitle in $WindowTitles){
        $TempTitle=New-TitleObject
        $TempTitle.Title=$WindowTitle.MainWindowTitle -replace ":.*",''
        $TempTitle.PlayerCount=$WindowTitle.MainWindowTitle -replace ".*?\(",'' -replace " players.*",''
        $WindowTitalsAndPlayers+=$TempTitle
    }
    $WindowTitalsAndPlayers=$WindowTitalsAndPlayers  | sort title
    return $WindowTitalsAndPlayers
}


#Server name,Binary location,commandline parameters
#Server name is the name of the server in the config file. This will appear in the title of the window.
#Binary location is the location of the kf2 Binary
#commandline parameters are the parameters you wish to pass to the kf2 binary.
$Processlist=@(
@("BAz | HOE | RANKED | Endless | Server1","C:\KF2Server\Binaries\Win64\KFServer.exe"," KF-HorzineArena-B1-v5?Mutator=xxxx?Game=KFGameContent.KFGameInfo_VersusSurvival?Difficulty=3?AllowSeasonalSkins=0?ConfigSubDir=yyyyyy -QueryPort=xxxxx -Port=xxxx -WebAdminPort=xxxx"),
@("BAz | HOE | RANKED | Endless | Server2","C:\KF2Server\Binaries\Win64\KFServer.exe"," KF-HorzineArena-B1-v5?Mutator=xxxx?Game=KFGameContent.KFGameInfo_VersusSurvival?Difficulty=3?AllowSeasonalSkins=0?ConfigSubDir=yyyyyy -QueryPort=xxxxx -Port=xxxx -WebAdminPort=xxxx"),
@("BAz | HOE | RANKED | Endless | Server3","C:\KF2Server\Binaries\Win64\KFServer.exe"," KF-HorzineArena-B1-v5?Mutator=xxxx?Game=KFGameContent.KFGameInfo_VersusSurvival?Difficulty=3?AllowSeasonalSkins=0?ConfigSubDir=yyyyyy -QueryPort=xxxxx -Port=xxxx -WebAdminPort=xxxx")
)




while(1){

    $GWindowTitalsAndPlayers=Get-WindowTitalsAndPlayers
    #Check all servers are running and restart them. Only restart if there are less than 5 people in game as this causes lagg.
    $PlayerCount=0
    Get-WindowTitalsAndPlayers | % { $PlayerCount+=$_.playercount }   
    if($GWindowTitalsAndPlayers.count -lt $Processlist.count ){

        if($PlayerCount -lt 50){
            foreach ($KnownProcess in $Processlist){
                if(!($GWindowTitalsAndPlayers.title -contains $KnownProcess[0])){
                    Write-LogHost "Restarting process:$($KnownProcess[1]) $($knownProcess[2])"
                    & "$($KnownProcess[1])" "$($KnownProcess[2])"
                    sleep 30
                }
            }
        }else{
            Write-LogHost "--"
            Write-LogHost "$(get-date) Server count is $($GWindowTitalsAndPlayers.count) should be $($Processlist.count). Too many users to restart server instance."
            foreach ($KnownProcess in $Processlist){
                if(!($GWindowTitalsAndPlayers.title -contains $KnownProcess[0])){
                    Write-LogHost "Need to restart process:$($KnownProcess[1]) $($knownProcess[2])"
                }
            }           
            Write-LogHost "--"
        }
    }else{
        Write-LogHost "PlayerCount:$($PlayerCount)"
    }
    sleep 60
}
 
Upvote 0
I can say in the many years I had servers on Linux, it is very stable with default maps and custom maps.
When you add mods and other mutators I guess things can happen.
How much ram did you give your server instances on linux since im running 0 mutators on my instances and they still crash randomly every now and then and running around 90 custom maps on each of them. (1000mb ram per instance currently) which wasn't necessary untill the game kept getting bad updates :) i remember when 700 mb was enough and it would stick to 650mb max.
 
Upvote 0
You will quickly discover it is irrelevant what platform you use. KF2 dedicated servers are not stable. Especially if you add mutators.

Here is a generic Windows Powershell script to monitor and restart KF2 instances. The $Processlist variable needs to be updated to have all of your server details. The hardcoded wait time and number of players can also be adjusted as required.

Code:
Function New-TitleObject(){
    #Create a object for holding server titles and player count
    $LDefaultObject = New-Object -TypeName psobject
    $LDefaultObject | Add-Member -type NoteProperty -name Title                     -value "NOTSET"
    $LDefaultObject | Add-Member -type NoteProperty -name PlayerCount               -value "NOTSET"
    return $LDefaultObject
}
Function Write-LogHost(){
[CmdletBinding()]
param (
    $LMessage
)
    write-host "$(get-date -UFormat "%d%m%y %H%M") $($LMessage)"
    "$(get-date -UFormat "%d%m%y %H%M") $LMessage" | Out-File -Append -FilePath c:\bin\log.txt
}

#windows only
#Gets the currently running KF2 windows titles which has the count of players in the game. Returns array of users and titles
Function Get-WindowTitalsAndPlayers(){
    $WindowTitles = Get-Process |where {$_.mainWindowTItle} | where { $_.name -eq "KFServer" } | select mainwindowtitle
    $WindowTitalsAndPlayers=@()
    foreach ($WindowTitle in $WindowTitles){
        $TempTitle=New-TitleObject
        $TempTitle.Title=$WindowTitle.MainWindowTitle -replace ":.*",''
        $TempTitle.PlayerCount=$WindowTitle.MainWindowTitle -replace ".*?\(",'' -replace " players.*",''
        $WindowTitalsAndPlayers+=$TempTitle
    }
    $WindowTitalsAndPlayers=$WindowTitalsAndPlayers  | sort title
    return $WindowTitalsAndPlayers
}


#Server name,Binary location,commandline parameters
#Server name is the name of the server in the config file. This will appear in the title of the window.
#Binary location is the location of the kf2 Binary
#commandline parameters are the parameters you wish to pass to the kf2 binary.
$Processlist=@(
@("BAz | HOE | RANKED | Endless | Server1","C:\KF2Server\Binaries\Win64\KFServer.exe"," KF-HorzineArena-B1-v5?Mutator=xxxx?Game=KFGameContent.KFGameInfo_VersusSurvival?Difficulty=3?AllowSeasonalSkins=0?ConfigSubDir=yyyyyy -QueryPort=xxxxx -Port=xxxx -WebAdminPort=xxxx"),
@("BAz | HOE | RANKED | Endless | Server2","C:\KF2Server\Binaries\Win64\KFServer.exe"," KF-HorzineArena-B1-v5?Mutator=xxxx?Game=KFGameContent.KFGameInfo_VersusSurvival?Difficulty=3?AllowSeasonalSkins=0?ConfigSubDir=yyyyyy -QueryPort=xxxxx -Port=xxxx -WebAdminPort=xxxx"),
@("BAz | HOE | RANKED | Endless | Server3","C:\KF2Server\Binaries\Win64\KFServer.exe"," KF-HorzineArena-B1-v5?Mutator=xxxx?Game=KFGameContent.KFGameInfo_VersusSurvival?Difficulty=3?AllowSeasonalSkins=0?ConfigSubDir=yyyyyy -QueryPort=xxxxx -Port=xxxx -WebAdminPort=xxxx")
)




while(1){

    $GWindowTitalsAndPlayers=Get-WindowTitalsAndPlayers
    #Check all servers are running and restart them. Only restart if there are less than 5 people in game as this causes lagg.
    $PlayerCount=0
    Get-WindowTitalsAndPlayers | % { $PlayerCount+=$_.playercount }  
    if($GWindowTitalsAndPlayers.count -lt $Processlist.count ){

        if($PlayerCount -lt 50){
            foreach ($KnownProcess in $Processlist){
                if(!($GWindowTitalsAndPlayers.title -contains $KnownProcess[0])){
                    Write-LogHost "Restarting process:$($KnownProcess[1]) $($knownProcess[2])"
                    & "$($KnownProcess[1])" "$($KnownProcess[2])"
                    sleep 30
                }
            }
        }else{
            Write-LogHost "--"
            Write-LogHost "$(get-date) Server count is $($GWindowTitalsAndPlayers.count) should be $($Processlist.count). Too many users to restart server instance."
            foreach ($KnownProcess in $Processlist){
                if(!($GWindowTitalsAndPlayers.title -contains $KnownProcess[0])){
                    Write-LogHost "Need to restart process:$($KnownProcess[1]) $($knownProcess[2])"
                }
            }          
            Write-LogHost "--"
        }
    }else{
        Write-LogHost "PlayerCount:$($PlayerCount)"
    }
    sleep 60
}
Thank you baz. I had already made a jump to linux so I haven't had a chance to try this out but expect to later on.
 
Upvote 0
I'm running two instances and they are working well and I've had no crashes so I'm happy with the ubuntu platform. The second instance is launched with the configsubdir switch and a subfolder was created automatically to contain the new server "ini" files which I've edited as needed. However I can't figure out how to make the second instance create a launch.log file or if it has done it automatically then where to find it. Can anyone advise me about the log files for a second instance? Thank you.
 
Upvote 0
I'm running two instances and they are working well and I've had no crashes so I'm happy with the ubuntu platform. The second instance is launched with the configsubdir switch and a subfolder was created automatically to contain the new server "ini" files which I've edited as needed. However I can't figure out how to make the second instance create a launch.log file or if it has done it automatically then where to find it. Can anyone advise me about the log files for a second instance? Thank you.
My server instances use configsubdir aswell, but i only get a launch.log from the server which restarted the last time as i think it overwrites the launch.log since afaik it doesn’t create a subdirectory for the log files. -edit in my case the tools i use create specific container logs so i never really bothered figuring a way around
 
Upvote 0