Ubuntu server out of box is not optimized to make full use of available hardware. This means “out-of-box” setup might fail under high load.
So we need to tweak system configuration for maximum concurrancy.
What limits the maximum number of connections on a Linux server?
function mean(numbers) {
// mean of [3, 5, 4, 4, 1, 1, 2, 3] is 2.875
var total = 0,
i;
for (i = 0; i < numbers.length; i += 1) {
total += numbers[i];
}
return total / numbers.length;
}
function median(numbers) {
// median of [3, 5, 4, 4, 1, 1, 2, 3] = 3
var median = 0,
numsLen = numbers.length;
numbers.sort();
if (numsLen % 2 === 0) { // is even
// average of two middle numbers
median = (numbers[numsLen / 2 - 1] + numbers[numsLen / 2]) / 2;
} else { // is odd
// middle number only
median = numbers[(numsLen - 1) / 2];
}
return median;
}
function mode(numbers) {
// as result can be bimodal or multimodal,
// the returned result is provided as an array
// mode of [3, 5, 4, 4, 1, 1, 2, 3] = [1, 3, 4]
var modes = [],
count = [],
i,
number,
maxIndex = 0;
for (i = 0; i < numbers.length; i += 1) {
number = numbers[i];
count[number] = (count[number] || 0) + 1;
if (count[number] > maxIndex) {
maxIndex = count[number];
}
}
for (i in count) if (count.hasOwnProperty(i)) {
if (count[i] === maxIndex) {
modes.push(Number(i));
}
}
return modes;
}
function range(numbers) {
// range of [3, 5, 4, 4, 1, 1, 2, 3] is [1, 5]
numbers.sort();
return [numbers[0], numbers[numbers.length - 1]];
}
A curated list of awesome tutorials and other resources for the Slim micro framework.
Since most of the time you can fix broken file systems with an fsck
, try..
$ sudo fsck /dev/mmcblk0p2
...if this fails continue here
10 Linux Fsck Command Examples to Check and Repair Filesystem