2

Using Chronicle with vertx.io...

I create a new Chronicle per per verticle. I.e: one instance per thread.

chronicle = ChronicleQueueBuilder.indexed("samePath").build(); <-- This is created per thread to the same queue.

Now for each web http POST request I do... Each post is handle by exactly 1 thread at a time.

String message = request.toString();
ExcerptAppender appender = chronicle.createAppender();

// Configure the appender to write up to 100 bytes
appender.startExcerpt(message.length()+100);

// Copy the content of the Object as binary
appender.writeObject(message);

// Commit
appender.finish();

This seems to work. But is it ok?

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
user432024
  • 4,392
  • 8
  • 49
  • 85

1 Answers1

2

This is not ok for IndexedChronicle whereas it is for VanillaChronicle.

If you can, best is to share the same VanillaChonicle instance among verticles (on the same process of course) and create an appender on demand.

Note that you can use WriteUtf* instead of writeObject to serialize strings as it is much more efficient.

Luca Burgazzoli
  • 1,216
  • 7
  • 9