135 Million messages a second between processes in pure Java

{This post is part of a long running series on lock free queues, checkout the full index to get more context here}
Porting an existing single producer/single consumer concurrent queue into an IPC mechanism via memory mapped files and getting 135 million messages throughput in pure Java.
In my previous post I covered a single producer/consumer queue developed and shared by Martin Thompson capable of delivering an amazing 130M messages per second. The queue he delivered is a great tool for communicating between threads, but sometimes communicating between threads is not enough. Sometime you need to leave your JVM and go out of process. Inter Process Communications (IPC) is a different problem to inter thread communications, can it be cracked by the same approach?


Connecting your App to a Wi-Fi Device

With the growth of the Internet of Things, connecting Android applications to Wi-Fi enabled devices is becoming more and more common. Whether you’re building an app for a remote viewfinder, to set up a connected light bulb, or to control a quadcopter, if it’s Wi-Fi based you will need to connect to a hotspot that may not have Internet connectivity.

From Lollipop onwards the OS became a little more intelligent, allowing multiple network connections and not routing data to networks that don’t have Internet connectivity. That’s very useful for users as they don’t lose connectivity when they’re near Wi-Fis with captive portals. Data routing APIs were added for developers, so you can ensure that only the appropriate app traffic is routed over the Wi-Fi connection to the external device.


Simple, sophisticated failure handling

Failsafe is a lightweight, zero-dependency library for handling failures. It was designed to be as easy to use as possible, with a concise API for handling everday use cases and the flexibility to handle everything else. Failsafe features:

Supports Java 6+ though the documentation uses lambdas for simplicity.


RecyclerViewTools – Collection of tools for RecyclerView

Collection of tools for RecyclerView.

This collection was developed with two main goals: easy to code (very simple API) & robust (it really works). Includes:

  • Headers, Footers & Sections for RecyclerView. Based on a common “wrap” adapter.
  • Extended SwipeRefreshLayout to use when Recycler is not direct child (e.g. on CoordinatorLayout)
  • Implementation of OnItemClickListener for RecyclerView (works standalone or in conjunction with headers, footers & sections).
  • FastScrollToTop function.


AES256 PasswordBased Encryption/Decryption


Initialise a SecureMyText object with following syntax

SecureMyText secure=new SecureMyText(context,String password for encryption);

Use the created object to perform encryption.

For encrypting the text

String encrypted_text = secure.encrypt(string to be encrypted);

For getting final encrypted text containing salt and IV to be transferred.

String encrypted_text_to_be_transferred = secure.EncryptToFinalTransferText(string to be encrypted);

For decrypting initialization remains the same

String plain_text = secure.decrypt(string to be decrypted);

For more details look for the SecureText class in main java folder. All the instructions are given in the file itself. Copy the lightweight class into your project and customise it according to your needs.

The sample folder has the sample android application that shows a sample implementation of the encryption/decryption.

Explaination of the whole encryption and decryption process taking example of app to server communication with notes and flow diagrams is attached.


CHRONIX – A fast and efficient time series storage based on Apache Lucene and Apache Solr

Chronix natively speaks time series. You can store nearly every kind of data type within a time series due to its flexible design. You decide what a time series looks like.

Chronix is built to store time series highly compressed and for fast access times. In comparison to related time series databases, Chronix does not only take 5 to 171 times less space, but it also shaves off 83% of the access time, and up to 78% off the runtime on a mix of real world queries. For the measurements we used a commodity hardware laptop computer and Chronix using the Apache Solr scenario (single node).

Chronix supports three different scenarios, pursuing different goals:

  1. Chronix Storage: Use Chronix as a small storage library and plug it into your application. It stores the time series using Apache Lucene.
  2. Chronix Server: Combine Chronix with Apache Solr for a typical client-server scenario. Apache Solr offers several useful features like scalability, fault tolerance, distributed indexing, or replication.
  3. Chronix Spark: Whenever you need a parallel and distributed time series processing, integrate Chronix with Apache Spark. Leverage Apache Spark to process a time series in parallel.