Skip to content

Instantly share code, notes, and snippets.

@PatrickKalkman
Created January 8, 2023 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PatrickKalkman/0be935f94a6bfc50aa279488c51fd03b to your computer and use it in GitHub Desktop.
Save PatrickKalkman/0be935f94a6bfc50aa279488c51fd03b to your computer and use it in GitHub Desktop.
Very simple scaling algorithm
scalingEngine.getNumberOfNeededEncoders = (numberOfEncodingTasks, numberOfEncoders) => {
if (numberOfEncodingTasks >= 0 && numberOfEncodingTasks <= 10) {
if (numberOfEncoders >= 1 && numberOfEncodingTasks < 1) {
return 0;
}
return numberOfEncoders;
}
if (numberOfEncodingTasks > 10 && numberOfEncodingTasks <= 50) {
if (numberOfEncoders < 4) {
return 4;
}
return numberOfEncoders;
}
if (numberOfEncodingTasks > 50) {
return 6;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment