NOTE: This feature is only available in the extended version of MentaLog
To minimize the cost of logging (latency), MentaLog supports asynchronous logging using MentaQueue, which is a non-blocking, zero-garbage, ultra-fast producer/consumer queue. If you want to log asynchronously through another thread, just pass true to the isAsynchronous parameter when creating your logs through the methods below:
Log.createLogger(String dir, String filename, boolean isSynchronized, boolean isAsynchronous); Log.createLogger(String dir, String filename, boolean isSynchronized, List<Encoder> encoders, boolean isAsynchronous); Log.createLogger(String dir, String filename, boolean isSynchronized, boolean isMemoryMapped, int memoryMappedBufferSize, boolean isAsynchronous); Log.createMemoryMappedLogger(String dir, String filename, boolean isSynchronized, boolean isAsynchronous); Log.createMemoryMappedLogger(String dir, String filename, boolean isSynchronized, List<Encoder> encoders, boolean isAsynchronous); Log.createMemoryMappedLogger(String dir, String filename, boolean isSynchronized, int memoryMappedBufferSize, boolean isAsynchronous); Log.createMemoryMappedLogger(String dir, String filename, boolean isSynchronized, List<Encoder> encoders, int memoryMappedBufferSize, boolean isAsynchronous);
-DlogAsynchronousQueueCapacity or Log.setAsynchronousQueueCapacity(int size) - The capacity of the queue reponsible for transfering log messages between threads. This is a MentaQueue configuration that you should not have to mess with. It was determined empirically that the optimum value is 1024 and that's the default value if you don't specify anything.
-DlogAsynchronousConsumerPriority or Log.setAsynchronousConsumerPriority(int p) - The Java priority of the log consumer thread. You may want to decrease the priority which defaults to NORMAL or 5. However if you are using thread pinning this will not matter.
-DlogProcToBindConsumer or Log.setProcToBindConsumer(int core) - The core number to bind (thread pinning) the log consumer thread to. It defaults to -1, in other words, no thread pinning is used unless you specify the core you want to use.