<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Coral Blocks &#187; CoralStore</title>
	<atom:link href="https://www.coralblocks.com/index.php/category/coralstore/feed" rel="self" type="application/rss+xml" />
	<link>https://www.coralblocks.com/index.php</link>
	<description>Building amazing software, one piece at a time.</description>
	<lastBuildDate>Fri, 03 Apr 2026 15:31:21 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.1</generator>
	<item>
		<title>CoralStore Performance Numbers</title>
		<link>https://www.coralblocks.com/index.php/coralstore-performance-numbers/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=coralstore-performance-numbers</link>
		<comments>https://www.coralblocks.com/index.php/coralstore-performance-numbers/#comments</comments>
		<pubDate>Tue, 30 Dec 2014 17:16:49 +0000</pubDate>
		<dc:creator><![CDATA[cb]]></dc:creator>
				<category><![CDATA[CoralStore]]></category>
		<category><![CDATA[chronicle]]></category>
		<category><![CDATA[coralqueue]]></category>
		<category><![CDATA[disruptor]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[store]]></category>

		<guid isPermaLink="false">http://www.coralblocks.com/index.php/?p=758</guid>
		<description><![CDATA[ [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>CoralStore can write a 256-byte message to disk in around 159 nanoseconds through the <code>FileStore</code> implementation. Moreover, by using the <code>AsyncStore</code> you can get even lower latencies (<b>60 nanoseconds</b>) and variance, as the numbers on this article demonstrate. <span id="more-758"></span></p>
<p>The machine used for the benchmarks below was an Intel i7 quad-core (4 x 3.50GHz) Ubuntu box overclocked to 4.50Ghz.</p>
<h3 class="coral">FileStore</h3>
<p>With a <code>FileStore</code> you can persist all your messages to disk. As the example below demonstrates, a <code>FileStore</code> by itself (i.e. without being asynchronous) is already very fast, but has some outliers as you can see in the 99.9 percentile:</p>
<pre>
Messages: 900,000 (256 bytes)
Avg Time: <font color="blue">159.06 nanos</font>
Min Time: 47.0 nanos
Max Time: 98.944 micros
75% = [avg: 51.0 nanos, max: 53.0 nanos]
90% = [avg: 51.0 nanos, max: 55.0 nanos]
99% = [avg: 53.0 nanos, max: 174.0 nanos]
99.9% = [avg: 132.0 nanos, max: <font color="red">25.571 micros</font>]
99.99% = [avg: 155.0 nanos, max: <font color="red">27.549 micros</font>]
99.999% = [avg: 158.0 nanos, max: <font color="red">38.035 micros</font>]
</pre>
<p><br/></p>
<h3 class="coral">AsyncStore</h3>
<p>With the <code>AsyncStore</code> you can get blazing fast performance with no outliers as you can see by the results below:</p>
<pre>
Messages: 900,000 (256 bytes)
Avg Time: <font color="blue">59.84 nanos</font>
Min Time: 41.0 nanos
Max Time: 10.221 micros
75% = [avg: 49.0 nanos, max: 71.0 nanos]
90% = [avg: 54.0 nanos, max: 84.0 nanos]
99% = [avg: 58.0 nanos, max: 176.0 nanos]
99.9% = [avg: 59.0 nanos, max: 388.0 nanos]
99.99% = [avg: 59.0 nanos, max: 476.0 nanos]
99.999% = [avg: 59.0 nanos, max: 1.748 micros]
</pre>
<p><br/></p>
<h3 class="coral">FileStore Benchmark Source Code</h3>
<pre class="brush: java; title: ; notranslate">
package com.coralblocks.coralstore.bench;

import java.io.IOException;
import java.nio.ByteBuffer;

import com.coralblocks.coralbits.bench.Benchmarker;
import com.coralblocks.coralstore.FileStore;
import com.coralblocks.coralstore.Store;
import com.coralblocks.coralthreads.Affinity;

public class FileBench {
	
	public static void main(String[] args) throws IOException {
		
		// java -server -verbose:gc -cp target/coralstore-all.jar:lib/jna-3.5.1.jar -DdetailedBenchmarker=true -Xms2g -Xmx8g -XX:NewSize=512m -XX:MaxNewSize=1024m com.coralblocks.coralstore.bench.FileBench 256 100000 1000000 2
		
		int msgSize = Integer.parseInt(args[0]);
		int warmup = Integer.parseInt(args[1]);
		int messages = Integer.parseInt(args[2]);
		int procToBind = args.length &gt; 3 ? Integer.parseInt(args[3]) : -1;
		
		byte[] msgBytes = new byte[msgSize];
		// build a dummy message:
		for(int i = 0; i &lt; msgBytes.length; i++) {
			msgBytes[i] = (byte) String.valueOf(i % 10).charAt(0);	
		}
		ByteBuffer msg = ByteBuffer.wrap(msgBytes);
		
		Store store = new FileStore(&quot;.&quot;, &quot;fileStoreSession&quot;);
		
		Benchmarker bench = Benchmarker.create(warmup);
		
		if (procToBind != -1) {
			System.out.println(&quot;Using affinity! procToBind=&quot; + procToBind + &quot; available=&quot; + Affinity.isAvailable());
			Affinity.assignToProcessor(procToBind, Thread.currentThread());
			Affinity.bind();
		}
		
		for(int i = 0; i &lt; messages; i++) {
			msg.position(0);
			bench.mark();
			store.addMessage(msg);
			store.flush();
			bench.measure();
		}
		
		store.close();
		
		bench.printResults();
	}
}
</pre>
<p><br/></p>
<h3 class="coral">AsyncStore Benchmark Source Code</h3>
<pre class="brush: java; title: ; notranslate">
package com.coralblocks.coralstore.bench;

import java.io.IOException;
import java.nio.ByteBuffer;

import com.coralblocks.coralbits.bench.Benchmarker;
import com.coralblocks.coralstore.FileStore;
import com.coralblocks.coralstore.Store;
import com.coralblocks.coralstore.async.AsyncStore;
import com.coralblocks.coralthreads.Affinity;

public class AsyncBench {
	
	public static void main(String[] args) throws IOException, InterruptedException {
		
		// java -server -verbose:gc -cp target/coralstore-all.jar:lib/jna-3.5.1.jar -DdetailedBenchmarker=true -DcoralThreadsVerbose=true -Xms2g -Xmx8g -XX:NewSize=512m -XX:MaxNewSize=1024m com.coralblocks.coralstore.bench.AsyncBench 256 100000 1000000 2 3
		
		int msgSize = Integer.parseInt(args[0]);
		int warmup = Integer.parseInt(args[1]);
		int messages = Integer.parseInt(args[2]);
		int procToBind = args.length &gt; 3 ? Integer.parseInt(args[3]) : -1;
		int procToBindAsync = args.length &gt; 4 ? Integer.parseInt(args[4]) : -1;
		
		byte[] msgBytes = new byte[msgSize];
		// build a dummy message:
		for(int i = 0; i &lt; msgBytes.length; i++) {
			msgBytes[i] = (byte) String.valueOf(i % 10).charAt(0);	
		}
		ByteBuffer msg = ByteBuffer.wrap(msgBytes);
		
		Store store = new FileStore(&quot;.&quot;, &quot;asyncStoreSession&quot;);
		AsyncStore asyncStore = new AsyncStore(store, msgSize, procToBindAsync);
		
		Benchmarker bench = Benchmarker.create(warmup);
		
		if (procToBind != -1) {
			Affinity.assignToProcessor(procToBind, Thread.currentThread());
			Affinity.bind();
		}
		
		for(int i = 0; i &lt; messages; i++) {
			msg.position(0);
			bench.mark();
			asyncStore.addMessage(msg);
			asyncStore.flush();
			bench.measure();
			
			if ((i + 1) % AsyncStore.getQueueCapacity() == 0) {
				// avoid queue contention because we are measuring latency, not throughput
				asyncStore.drainAndWait();
			}
		}
		
		asyncStore.discard();
		
		bench.printResults();
	}
}
</pre>
<p><br/></p>
<h3 class="coral">Conclusion</h3>
<p>CoralStore delivers blazing fast performance with very low latency and variance. You can persist messages in 70 nanoseconds on average.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.coralblocks.com/index.php/coralstore-performance-numbers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
