Chronicle Queue on NFS Storage

176 views
Skip to first unread message

Dan Kristensen

unread,
Oct 20, 2014, 9:29:04 AM10/20/14
to java-ch...@googlegroups.com
I have tried having my IndexedChronicle put on a NFS mounted volume.

It works great, when my appender and tailer applications are running on the same machine, but when the appender is run on one machine, and the tailer is running on another machine, the tailer falls behind.

My Appender class looks like this:

package chronicle_test;

import java.io.IOException;

import net.openhft.chronicle.ExcerptTailer;
import net.openhft.chronicle.IndexedChronicle;

public class ChronicleReader {
private final IndexedChronicle indexedChronicle;
private final ExcerptTailer tailer;

public ChronicleReader(String chronicleFilePath) throws IOException {
indexedChronicle = new IndexedChronicle(chronicleFilePath);
tailer = indexedChronicle.createTailer();
}

public static void main(String[] args) throws IOException {
String chronicleFilePath = args[0];
ChronicleReader chronicleWriter = new ChronicleReader(chronicleFilePath);
chronicleWriter.startReading();

}

private void startReading() {
while (true) {
while (tailer.nextIndex()) {
int readInt = tailer.readInt();
System.out.println("Readint=" + readInt);
}
}
}
}


And my tailer looks like this:

package chronicle_test;

import java.io.IOException;

import net.openhft.chronicle.ExcerptAppender;
import net.openhft.chronicle.IndexedChronicle;

public class ChronicleWriter implements Runnable {

private final IndexedChronicle indexedChronicle;
private final ExcerptAppender createAppender;
private Thread thread;

public ChronicleWriter(String chronicleFilePath) throws IOException {
indexedChronicle = new IndexedChronicle(chronicleFilePath);
createAppender = indexedChronicle.createAppender();
}

public static void main(String[] args) throws IOException {
String chronicleFilePath = args[0];
ChronicleWriter chronicleWriter = new ChronicleWriter(chronicleFilePath);
chronicleWriter.startWriting();
}

private void startWriting() {
writeEvent(1);
thread = new Thread(this);
thread.start();
try {
thread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}

private void writeEvent(int v) {
createAppender.startExcerpt();
createAppender.writeInt(v);
createAppender.finish();
}

@Override
public void run() {
int i = 0;
while (true) {
i++;
writeEvent(i);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}



Is this not the way to do it, or is there some kind of bug when running this across 2 different machines?



Peter Lawrey

unread,
Oct 20, 2014, 11:53:02 AM10/20/14
to java-ch...@googlegroups.com

This is not a configuration we have tested. NFS can do some strange things with caching of files. For now I suggest you use the TCP replication even if this means you have two copies on the same NFS server.

--
You received this message because you are subscribed to the Google Groups "Chronicle" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-chronicl...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages