very basic mvp for shedding load

When the box is over 100% capacity start to shed load.

Use 5 min load average to make the system less likely to start moving
projects off after a temporary cpu spike
This commit is contained in:
Henry Oswald 2021-06-21 15:18:51 +01:00
parent f32f5e58a8
commit 8e2cd57cb9

View file

@ -331,7 +331,7 @@ const loadTcpServer = net.createServer(function (socket) {
const freeLoad = availableWorkingCpus - currentLoad
let freeLoadPercentage = Math.round((freeLoad / availableWorkingCpus) * 100)
if (freeLoadPercentage <= 0) {
freeLoadPercentage = 1 // when its 0 the server is set to drain and will move projects to different servers
freeLoadPercentage = 0 // when its 0 the server is set to drain and will move projects to different servers
}
socket.write(`up, ${freeLoadPercentage}%\n`, 'ASCII')
return socket.end()