Last week I wrote about the problems with HTTP and how replacing it with RESP, the Redis Serialization Protocol, could eliminate some of those problems. After some more hacking, I am very proud to announce the end result of those efforts with Tino a very special and unique way to build APIs. Redis’ efficient protocol makes Tino over 10–20x faster in some cases compared with FastAPI, the fastest HTTP framework in Python.

Both Redis and MsgPack are extremely efficient and widely available across languages. If a language doesn’t have it, its pretty simple to write either by hand. …

Normally when you think of APIs, your mind goes directly to HTTP. While the protocol has dominated for good reason, it was primarily built for the web and can fit awkwardly in a server-to-server API where long-lived and authenticated connections are common. HTTP2 addresses some of the problems with multiplexing, header compression and more, but these added features make the protocol unwieldy. An alternative should at least be considered.

Why Redis Protocol?

It's hard to find a Request-Response protocol written in as many languages as Redis. Nearly every language has a client, either officially supported or not, and the protocol is simple enough…

A split bigger than the decade long transition from 2 to 3 is well underway in the Python community. Coroutines and async/await syntax have existed in Python since version 3.5 released in 2015, but tools and projects utilizing the feature were slow to be released. Mature libraries to build async applications are starting to become available and the libraries we love are moving in the async direction. Async is the future of Python.

Why it matters

Asyncio is the biggest change since the language’s introduction. It is a library and additional syntax that programmers use to mark their python code. The syntax tells…

Distributed programming isn’t the only area Elixir excels. One of the less advertised strengths of erlang’s little brother is that it contains one of the most elegant and compact ways to define binary parsers in a programming language. Code visually represents data structures making it easy to match and extract bytes and even individual bits in the function heads themselves. This capability makes Elixir an unexpected front-runner for learning and prototyping binary protocols.

Binary Pattern Fundamentals

Patterns are a deeply central component of writing idiomatic Elixir code. They are a visual representation of data-structures which act as guards in function-heads and case-statements and…

Breaking up a monolithic app into domain specific chunks comes with a pretty heavy price. These chunks need glue to hold those things together. The ecosystem for this glue can start to get pretty complex. This complexity distracts us with infrastructure overhead instead of allowing us to focus on the application.

NATS Server reduces load-balancing, discovery and inter-process protocols into one package. It is a message broker written in Go that describes itself as a “central nervous system” for applications. The project is clear, scales to millions of messages a second, and light-weight with clients in the most popular languages.

If a web request is stretching into seconds, 99% of the time the database isn’t being used correctly. When using the ORM, its natural to want to think in Python. This mindset can be disastrous for your applications performance. Its possible to see 20–100x speedups for requests by switching to subqueries and annotations.

The Django 1.11 release turned the framework into a serious way to express queries. More robust annotations and subqueries make the vast majority of SQL possible in stock Django.

The Problem

One day you might be wondering why you django code is slow. …

Be ready to revise any system, scrap any method, abandon any theory, if the success of the job requires it. — Henry Ford

When it comes to problem solving in Python, often times we feel locked into the OOP way. Python has more than just an imperative style. Functional programming in Python is well known but not well used. Sometimes the benefits of a functional approach are unclear and it becomes difficult to break out of the imperative world.

Switching to functional programming won’t magically make programs faster, but it can help to provide structure and expose problem areas.


Django is a wonderful tool which has helped thousands boost their productivity when writing web applications. Like any framework, when you first start out and the data model is simple, things are speedy. When you start adding real-world constraints and the data-model grows in complexity you’ll probably find that the same strategies you used in the beginning won’t be as effective. As you learn more about your problem domain, you need to adapt your code accordingly.

All frameworks require upfront knowledge about how the internals work in order to write high performance code. …

Working in an software organization, engineers write libraries that other people use. Unlike the real world, software abstracts the risk to a point where it might look safe. $10,000,000 in physical cash will not burst into flames if an algorithmic trader mistypes a line; a few numbers will just move around. A lot of work has gone into best practices for safe software, but often times we forget about the danger in our day-to-day work.

Aircraft manufacturing implements special procedures. Strict protocols like making sure every tool is accounted for promote proactive mindfulness. A missing bolt can cause hours of…

A standard design pattern that you would want to implement in a networking application is pubsub. Its a useful exercise, especially for a concurrency driven language like elixir, for understanding how to communicate between IO resources.

Socket Wrapper

Elixir’s gen_tcp is easy enough to use, but it can be beneficial to abstract the socket in order to swap out the socket types. I came across meh’s elixir-socket-wrapper project on github which does exactly that. So if we wanted to, we could swap out TCP for websockets and maintain the same behavior with minimal code changes.


gproc is an erlang project global process…

Kyle Hanson

Programmer, Functional programming aficionado

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store