uWebSockets: Truly scalable and high performing WebSockets for Node.js and C++11

µWS is one of the most lightweight, efficient & scalable WebSocket server implementations available. It features an easy-to-use, fully async object-oriented interface and scales to millions of connections using only a fraction of memory compared to the competition. License is zlib/libpng (very permissive & suits commercial applications).

  • Linux, OS X & Windows support.
  • Built-in load balancing and multi-core scalability.
  • SSL/TLS support & integrates with foreign HTTPS servers.
  • Permessage-deflate built-in.
  • Node.js binding exposed as the well-known ws interface.
  • Optional engine in projects like Socket.IO, Primus & SocketCluster.


Why I don’t spend time with Modern C++ anymore

Modern C++, what is it, where it comes from?

For the past 10 years with the advent of C++11, and before that its respective initiatives (TR1, Boost), there was a big movement within the C++ development community towards moving projects to the new standard: Modern C++. That meant using features like auto, closures (lambda), variadic templates and many more. C++ certainly became a rich platform for experimentation, and several “Modern C++” libraries appeared. Those lucky to grasp the new idioms as SFINAE, tag dispatching, CRTP, type generator, safe bool and others, or at least those who can recite them, were hailed with the status of Gurus.


Top 10 dumb mistakes to avoid with C++ 11 smart pointers

I love the new C++ 11 smart pointers. In many ways, they were a godsent for many folks who hate managing their own memory. In my opinion, it made teaching C++ to newcomers much easier.

However, in the two plus years that I’ve been using them extensively, I’ve come across multiple cases where improper use of the C++ 11 smart pointers made the program inefficient or simply crash and burn. I’ve catalogued them below for easy reference.


Mobile App Development with Qt

The Most Powerful Way to Build Cross-Platform Mobile Apps
Qt runs on Android, iOS, Windows Phone, Windows RT, BlackBerry10 and Sailfish

Mobile App Development

C++ Has Become More Pythonic

C++ has changed a lot in recent years. The last two revisions, C++11 and C++14, introduce so many new features that, in the words of Bjarne Stroustrup, “It feels like a new language.”

It’s true. Modern C++ lends itself to a whole new style of programming – and I couldn’t help noticing it has more of a Python flavor. Ranged-based for loops, type deduction, vector and map initializers, lambda expressions. The more you explore modern C++, the more you find Python’s fingerprints all over it.

Was Python a direct influence on modern C++? Or did Python simply adopt a few useful constructs before C++ got around to it? You be the judge.


C++14 generic lambdas to simulate stackless coroutines without macros or type erasure

Asynchronous programming is becomming more common in Modern C++. However, the callback based model, whether through the use of explicit callbacks or through futures with completion callbacks, can result in code that is difficult to write and read especially when trying to call an asynchronous function in a loop.

There have been several attempts to mitigate this

However, there are issues that prevent universal adoption of these solutions

  • Stackfull coroutines – Require linking to a separate library. In addition, there are concerns with how much stack space a coroutine needs. Too much stackspace wastes memory, too little risks stack overflow. Segmented stacks can help with this, but may not be supported on all compilers/platforms.
  • Stackless coroutines – So far only implemented in Visual C++. Lack of consensus at the Standards meeting caused it to be put into a TS rather than into the standard
  • Macro based libraries – Macro magic 😦

This library is another alternative that uses C++14 generic lambdas to implement stackless coroutines without macros. The library is a single header file and has no dependencies other than C++14.


How to write a Bloom filter in C++

Bloom filters are data structures which can efficiently determine whether an element is possibly a member of a set or definitely not a member of a set. This article will cover a simple implementation of a C++ bloom filter. It’s not going to cover what bloom filters are or much of the math behind them, as there are other great resources covering those topics.


libnghttp2_asio: High level HTTP/2 C++ library

libnghttp2_asio is C++ library built on top of libnghttp2 and provides high level abstraction API to build HTTP/2 applications. It depends on Boost::ASIO library and OpenSSL. Currently libnghttp2_asio provides server and client side API.

libnghttp2_asio is not built by default. Use --enable-asio-lib configure flag to build libnghttp2_asio. The required Boost libraries are:

  • Boost::Asio
  • Boost::System
  • Boost::Thread


Fast multi-core TCP and WebSockets load generator

tcpkali is a high performance TCP and WebSocket load generator and sink.

  • Opens millions of connections from a single host by using available interface aliases.
  • Efficient multi-core operation (--workers); utilizes all available cores by default.
  • Allows opening massive number of connections (--connections)
  • Allows limiting an upstream and downstream of a single connection throughput (--channel-bandwidth-downstream, --channel-bandwidth-upstream or --message-rate)
  • Allows specifying the first and subsequent messages (--message, --first-message).
  • Measures response latency percentiles using HdrHistogram (--latency-marker)
  • Sends stats to StatsD/DataDog (--statsd)


Python Tutor

Python Tutor, created by Philip Guo, helps people overcome a fundamental barrier to learning programming: understanding what happens as the computer executes each line of a program’s source code.

Using this tool, you can write Python, Java, JavaScript, TypeScript, Ruby, C, and C++ programs in your Web browser and visualize what the computer is doing step-by-step as it executes those programs. So far, over 1.5 million people in over 180 countries have used Python Tutor to visualize over 15 million pieces of code, often as a supplement to textbooks, lecture notes, and online programming tutorials.