mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
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:
parent
f32f5e58a8
commit
8e2cd57cb9
1 changed files with 1 additions and 1 deletions
|
@ -331,7 +331,7 @@ const loadTcpServer = net.createServer(function (socket) {
|
||||||
const freeLoad = availableWorkingCpus - currentLoad
|
const freeLoad = availableWorkingCpus - currentLoad
|
||||||
let freeLoadPercentage = Math.round((freeLoad / availableWorkingCpus) * 100)
|
let freeLoadPercentage = Math.round((freeLoad / availableWorkingCpus) * 100)
|
||||||
if (freeLoadPercentage <= 0) {
|
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')
|
socket.write(`up, ${freeLoadPercentage}%\n`, 'ASCII')
|
||||||
return socket.end()
|
return socket.end()
|
||||||
|
|
Loading…
Reference in a new issue