Home / Companies / Ably / Blog / Post Details
Content Deep Dive

Adventures in BEAM optimization with our MQTT adapter

Blog post from Ably

Post Details
Company
Date Published
Author
Simon Woolf
Word Count
1,724
Company Posts That Month
3
Language
English
Hacker News Points
-
Post removed?
No
Summary

The author shares their experience of optimizing Elixir code for an MQTT protocol adapter, only to discover that the true solution to performance issues was an obscure setting in the Erlang VM controlling which system call the IO polling subsystem used. They initially spent time profiling and optimizing the code but found that the majority of CPU usage was due to SLEEP calls, which they later realized were a measurement artifact. After disabling masking for WebSocket pings and adding special cases for MQTT pings, they continued to see high CPU usage. They eventually discovered that enabling +K true in the Erlang runtime significantly reduced CPU usage by switching from poll to epoll system call for IO polling. The author's micro-optimizations were ultimately irrelevant as the majority of CPU cycles were spent on IO polling.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
Observability 4 505 103 31 +6%
Real-time 3 687 243 78 +6%
Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.