Class SyncCalculation


  • public class SyncCalculation
    extends Object
    It will perform a simple test to evaluate how many syncs a disk can make per second * *
    • Constructor Detail

      • SyncCalculation

        public SyncCalculation()
    • Method Detail

      • syncTest

        public static long syncTest​(File datafolder,
                                    int blockSize,
                                    int blocks,
                                    int tries,
                                    boolean verbose,
                                    boolean fsync,
                                    boolean syncWrites,
                                    String fileName,
                                    int maxAIO,
                                    org.apache.activemq.artemis.core.server.JournalType journalType,
                                    ActionContext context)
                             throws Exception
        It will perform tries write tests of blockSize * blocks bytes and returning the lowest elapsed time to perform a try.

        Please configure blocks >= -XX:CompileThreshold (ie by default on most JVMs is 10000) to favour the best JIT/OSR compilation (ie: Just In Time/On Stack Replacement) if the test is running on a temporary file-system (eg: tmpfs on Linux) or without fsync.

        NOTE: The write latencies are provided only if verbose && !(journalType == JournalType.ASYNCIO && !syncWrites) (ie are used effective synchronous writes).

        Parameters:
        datafolder - the folder where the journal files will be stored
        blockSize - the size in bytes of each write on the journal
        blocks - the number of blockSize writes performed on each try
        tries - the number of tests
        verbose - true to make the output verbose, false otherwise
        fsync - if true the test is performing full durable writes, false otherwise
        syncWrites - if true each write is performed only if the previous one is completed, false otherwise (ie each try will wait only the last write)
        fileName - the name of the journal file used for the test
        maxAIO - the max number of in-flight IO requests (if journalType will support it)
        journalType - the JournalType used for the tests
        Returns:
        the lowest elapsed time (in TimeUnit.MILLISECONDS) to perform a try
        Throws:
        Exception
      • toNanos

        public static long toNanos​(long time,
                                   long blocks,
                                   boolean verbose,
                                   ActionContext context)