Skip to content

Instantly share code, notes, and snippets.

View john-kurkowski's full-sized avatar

John Kurkowski john-kurkowski

View GitHub Profile
@john-kurkowski
john-kurkowski / Fault-Tolerance.md
Last active October 22, 2015 01:17 — forked from pixelhandler/Fault-Tolerance.md
Fault Tolerance: Software is ruining the human experience

Fault Tolerance: Software is Ruining the Human Experience

Mostly a rant on a few bad experiences that could have been prevented in real life if engineers did a good job instead of a good enough job. We have no oath to "Do no harm!" So, we take license to ship whatever. This is bad for humans.

Intro: Fault Tolerance and Bad Human Experiences

Pumping Up the Tires

  1. Wow look new technology, pumping up tires is way better now
  2. Not so much, they added software to the process, oops
class SlidingWindowMap(keys: Set[String], maxCount: Int, periodMs: Int) {
val times = new collection.mutable.HashMap[String, Vector[Long]]() with collection.mutable.SynchronizedMap[String, Vector[Long]]
times ++= keys.map(k => (k, Vector[Long]()))
def nextKey: Option[String] = {
val now = System.currentTimeMillis
times.synchronized {
val trimmedTimes = times.toStream map { case (k, usage) =>
val trimmedUsage = usage dropWhile (_ < now - periodMs)