We released Chronon 3 last week with an order of magnitude performance improvement. Let’s take a look under the hood to see what makes it all tick!
The Recipe
Once your program is running, it keeps monitoring it against the initial set of predictions. If the execution at any time differs from what was ‘predicted’:
1. The prediction data structure is modified to take into account the new information.
2. Recording data is generated to select the right ‘prediction’ from the structure. This usually takes only 1 to 4 bits.
3. If the prediction matches accurately though then no data is generated at all!
See it in Action
For example, consider the code below:
Assume there are 2 threads that call the method process().
The first thread has an object of type Foo and calls Foo.bar(), which matches the prediction made by the recorder exactly, so no data is generated at that point for that thread.
The second thread calls has an object of FooSub instead, and thus ends up calling FooSub.bar().
Now here is where things get interesting. For this thread only, the prediction structure is adjusted to account for this new method call. Then a single bit is stored to select the right method call from the prediction structure. The previous thread, on the other hand, which keeps Foo.bar() keeps generating no data as its prediction is accurately matched.
Results
As you can see that the new prediction mechanism helps in saving a ton of data that would otherwise have been generated and even when data is indeed generated, it’s only very minimal. Apart from the example given above, we have a whole bunch of predictions inside the Chronon 3 Recorder. We now even have a pluggable architecture where we can keep plugging in more of these predictions and constantly increasing the speed of the recorder, without needing to wait an entire year.
So far the current architecture has worked extremely well and almost all our previous users running into OutOfMemory issues are now able to record easily!