Does your project need distributed Erlang?
You deployed your brand new Phoenix webserver installation, or a data processing pipeline using Broadway - or any other piece of infrastructure running on the Beam VM, and it’s all working just great. Global interpreter lock and threads corrupting each other’s memory are but a faint memory, api request latencies are nice and predictable, production bottlenecks are a breeze to identify and fix, what else could one want at this point?
Google Pubsub gRPC-based client
Google Pubsub supports both REST and gRPC endpoints, and the latter is clearly the winner in terms of performance. For instance, it takes about 1 ms to receive a REST message with the pubsub emulator on my laptop but I can get out 50 of them via the gRPC endpoint in the same single millisecond (using HTTP 2 streaming over the same TCP connection of course so not a completely fair comparison but at the same time it’s not like I am forcing the REST endpoint to stick with HTTP 1.
Server-Sent Events (SSE) with Elixir
Server-Sent Events is an efficient way to stream data from a web server to client, supported by all modern browsers. It is a great fit for many use cases where one-way communication is sufficient, and is much simpler and has less overhead than web sockets: any sort of status updates, streaming quotes etc. This post will show how to use SSE with Elixir-based Phoenix Web Server. Demo I will demo an app with a single web page streaming server’s current time.
How to deploy Elixir release to kubernetes, using Helm
Elixir has (or at least tended to have) reputation as a hard-to-deploy platform. The goal of this post is to show a way to quickly deploy an Elixir-based service to a kubernetes environment, using only Elixir releases, docker and helm. Use Case: add a phoenix server to existing kubernetes cluster Let’s say you already have a configured kubernetes cluster (I’ll be using Google Cloud in this example) and you want to add a web server to it - could be serving some api requests with JSON payloads, or just regular web content.
How to use Google Pubsub Emulator with Elixir
Google Pub/Sub is a fully-managed real-time messaging service that is part of gcloud. Google Cloud SDK comes with a pubsub emulator, which is very handy to use for local development and testing, and with most clients it’s very easy to switch between the Google service and the emulator, e.g. with ruby’s google-cloud-pubsub gem all you have to do is set the PUBSUB_EMULATOR_HOST environment variable that points to your local host/port, for example localhost:8918.