slash dev slash null

stuff about puters

Rust Extension Methods

Seven years ago I was working on a system that had a fat client desktop app written in C# and a Java backend. I signed up for a week-long C# training programme. I was fascinated about the bits of C# that had evolved away from Microsoft J++. A lot of the differences that still stuck in my mind were all about boilerplate removal. One of those was C# Extension Methods. I have posted some sample code of Rust Extention Methods over on GitHub.    Read the rest of this entry »

Rust Pickling 

The first thing item to research on my Rust spike is picking. A quick survey of the landscape indicates that serde appears to be the current defacto standard framework. Pickling was an area that I chose to hand code in the TRex Scala implementation. Why? Because Scala’s pickling engine crashed my JVM and wasn’t yet the stage of a stable disk format. I want to have no external dependencies for the inner Paxos library and as few as possible elsewhere. As Scala’s official pickling engine wasn’t ready for prime time, I was on my own. I had some fun writing my own ByteChain based pickling where I wrote a compact binary wire encoding for unsigned integers. With Rust does serde put me in a better place? Read the rest of this entry »

Why Rust for TRex?

My programming career started out with C and C++ last century. I then switched to Java for a long while then finally moved onwards and upwards into Scala. Along the way I have put JavaScript into production and written a JavaScript authentication library others use. There was also a bit of PHP on the side which I don’t draw attention to. Why not return to C++ for a systems programming language port of Trex? Or try D? Why Rust?  Read the rest of this entry »

Rust FTW?

It has been on the back of my mind for a while that Scala might not be too many folks first choice language to implement a Paxos library. So I have been considering the options for porting TRex onto a systems programming language.

A couple of weeks ago I started reading The Rust Programming Language. Before I knew it I have been sucked in and find myself mildly, and occasionally widely, enthusiastic about Rust. There are still a lot of little steps I need to test out, and lessons I need to learn before I make the decision to do a full port. I thought to blog about those steps and lessons as I go long. For my next post, I will explain why I started out looking at Rust rather than another language.

Corfu: The Protocol

This is the eighth and last in a series of posts about Corfu a strongly consistent and scalable distributed log. To quote the paper:

At its base, CORFU derives its success by scaling Paxos to data center settings and providing a durable engine for totally ordering client requests at tens of Gigabits per second throughput.

It does this through a number of existing techniques:

Our design borrows bits and pieces from various existing methods, yet we invented a new solution in order to scale SMR [state machine replication] to larger cluster scales and deliver aggregate cluster throughput to hundreds of clients.

What I really like about Corfu is that it innovates by bringing existing techniques such as Paxos together into something which is a real breakthrough. The protocol itself is very simple. The established techniques it uses to implement the protocol are very simple. Yet when assembled into the solution they become extremely powerful. This post will put the pieces together and discuss the Corfu protocol.

Read the rest of this entry »

Corfu: Paxos Configurator

This the seventh post in a series about the techniques used in Corfu. The techniques described this far are the basic mechanics. Corfu uses these to build a linearizable log with one final ingredient: Paxos. To quote the paper:

At its base, CORFU derives its success by scaling Paxos to data center settings and providing a durable engine for totally ordering client requests at tens of Gigabits per second throughput.

It does this by using Paxos to control the cluster configuration whilst using the simpler techniques outlined in this series of posts to scale the main transactional load.  Read the rest of this entry »

Corfu: Safety Techniques

This the sixth post in a series about Corfu. It will cover some of the basic safety techniques which I call “Write Once”, “Write-Ordering” and “Collaborating Threads”. What is remarkable about Corfu is how it uses such well-established techniques to build something extremely scalable. Read the rest of this entry »

Corfu: Copy Compaction

This the fifth post in a series about Corfu. In the last post we discussed striping a log across many mirrored sets of disks for IO concurrency. In this post we will discuss deletions from the global log and copy collection techniques to free the disk space:

CORFU makes it easy for developers to build applications over the shared log without worrying about garbage collection strategies

Copy collection will also allow us to compact the log even when we don’t use deletes which the paper doesn’t mention. Why do we need compaction under write-only usage? Writes are quantized into pages written to directly by clients in an uncoordinated manner. Under realistic workloads many writes may be much smaller than the page size. Without copy compaction Corfu would squander disk space.

Read the rest of this entry »

Corfu: Stripe & Mirror

This the fourth post in a series about Corfu. The last post introduced a global sequencer to reduce contention on writes to the end of a log file. The idea is to be able to distribute the log file across many machines. In this post we will scale up or fictional example using by striping and mirroring to achieve high performance:

[…] we can append data to the log at the aggregate bandwidth of the cluster […] Moreover, we can support reads at the aggregate cluster bandwidth. Essentially, CORFU’s design decouples ordering from I/O, extracting parallelism from the cluster for all IO while providing single-copy semantics for the shared log.

Read the rest of this entry »

 Corfu: Global Sequencer

This the third post in a series about Corfu. In the last post we outlined how to linearizable consistency without a global buffer. This introduced a write contention challenge. In this post we will get into Corfu’s simple fix for this issue. Corfu uses a global ticket service which acts as a sequencer:

Ultimately, append throughput hits a bottleneck at around 180K appends/sec; this is the maximum speed of our sequencer implementation, which is a user-space application running over TCP/IP.

and:

The evaluation for this article was done with a user-space sequencer serving 200K tokens/s, whereas our more recent user-space sequencer is capable of 500K tokens/s.

Read the rest of this entry »