jlouis' Ramblings

Musings on tech, software, and other things

  • Js is Weird in Ocaml

    The web site jsisweird contains puzzling things from Javascript and runs a multiple choice test over them, to test if people understand the logic. Here, we do the same, but translate each of the questions into likewise OCaml: Questions Q1 # true + false;; Error: This expression has type bool but an expression was expected of type int First question is a type error. The + operator isn’t defined for boolean values.

    Read more…
  • On Observability

    The hard part is not debugging the code. The hard part is figuring out where the bug is. This is what observability is. — Charity Majors I really like the notion of “observability”, which stems from Control Theory. The idea is that we have some system, with inputs, some internal state and some outputs. A system is observable if we can determine its internal state, solely from a finite set of outputs (in finite time).

    Read more…
  • Experience Report: Bidirectional type checking of GraphQL

    The core idea of GraphQL is this: let clients have a small, typed, total, functional (declarative) language where they can push programs to the server side. The server then interprets these programs and provides data to the client. The natural core for this is a lambda calculus: a GraphQL fragment is a lambda over the free variables of that fragment, for instance. A query is also a lambda, but no variables are free, and it is “exported” for others to use.

    Read more…
  • {'EXIT', joe, goodbye}

    Jesper, I have this idea in which we’ll connect all of the worlds Erlang systems to each other, imagine if every process could talk to every other process, world-wide! — Joe Armstrong Joe was never short on ideas when you spoke to him. At conferences, he would engage people with his newest idea, or he would find people across the room and connect them. This often resulted in new acquaintances, interesting conversations, and new insights.

    Read more…
  • An Erlang/OTP 20.0 optimization

    An Erlang/OTP 20.0 optimization Edit: some word choices have been altered slightly in order to make some parts more clear. This is a short blurb about a specific optimization present in Erlang 20.0 which is scheduled for release in June 2017. The README file mentions the following: OTP-13529 Application(s): erts Erlang literals are no longer copied during process to process messaging. And there have been a couple of questions as to what that is and means.

    Read more…
  • Full Queues and Their Woes

    Suppose you have a bounded queue of size 10. In a normal setting, you system may load this queue with up to 5 elements. Under load, the queue might increase to say 7 or 8 elements, but you are not going to reach the bound of the queue. Typically the queue is empty, some elements gets added to the queue and then drained again by processing. In contrast, suppose the queue is full at 10 elements, and that the load increases on the queue.

    Read more…
  • How to Build Stable Systems

    — An incomplete opinionated guide. Preparation The first decision is easily the most important. It is one of ideology: the developers are in control of the software. Not the other way around. Managers are not in control of the software. Product Owners are not in control of the software. Developers are. The only people who control the software are they who write it. The second decision is to have small units of work which you can control.

    Read more…
  • Systems in Production

    You embark upon the journey. You build the system. You test the system. The system seems to work. You spend time deploying the system into production. And then what? The maintenance period of a project is often measured in years, whereas the time to build the project is measured in months. Thus, the maintenance period by far dwarf the initial construction period. And modern software is dynamically updated all the time: new customers, new uses of the software nobody thought of, operational change around the software, and new patches adding or fixing functionality.

    Read more…
  • Testing a Parallel map implementation

    Erlang programs, often have a a list comprehension which implements the ubiquitous serial map of functional programming: map(F, Xs) -> [F(X) || X <- Xs] If, however, the function given as F blocks, then the map function blocks as well. This is not a desirable situation if the elements in Xs are truly independent. We could run all of the comprehension in parallel and then collect the data afterwards. This is the purpose of the pmap function:

    Read more…
  • Erlang Dirty Scheduler Overhead

    Using DTrace to figure out what calls cost Due to heroic efforts by Steve Vinoski, Rickard Green, and Sverker Eriksson, we have an (experimental) so-called dirty-scheduler (DS) NIF API in the Erlang runtime, which has been somewhat stable since release 17.3. What is a NIF? It is a Natively-Implemented-Function, which is a shorthand for replacing Erlang code with C. A NIF library has access to a number of helper functions in the Erlang VM which makes their implementation easy, and their overhead in the interpreter is fairly low.

    Read more…