Package org.hornetq.core.journal.impl

Examples of org.hornetq.core.journal.impl.JournalImpl$PerfBlast


      SequentialFileFactory messagesFF = new NIOSequentialFileFactory(messagesDir);

      // Will use only default values. The load function should adapt to anything different
      ConfigurationImpl defaultValues = new ConfigurationImpl();

      JournalImpl messagesJournal = new JournalImpl(defaultValues.getJournalFileSize(),
                                                    defaultValues.getJournalMinFiles(),
                                                    0,
                                                    0,
                                                    messagesFF,
                                                    "hornetq-data",
View Full Code Here


      SequentialFileFactory messagesFF = new NIOSequentialFileFactory(journalLocation);

      // Will use only default values. The load function should adapt to anything different
      ConfigurationImpl defaultValues = new ConfigurationImpl();

      JournalImpl messagesJournal = new JournalImpl(defaultValues.getJournalFileSize(),
                                                    defaultValues.getJournalMinFiles(),
                                                    0,
                                                    0,
                                                    messagesFF,
                                                    "hornetq-data",
                                                    "hq",
                                                    1);

      messagesJournal.start();

      ArrayList<RecordInfo> records = new ArrayList<RecordInfo>();
      ArrayList<PreparedTransactionInfo> txs = new ArrayList<PreparedTransactionInfo>();

      messagesJournal.load(records, txs, null, false);

      Map<Long, Set<PagePosition>> cursorRecords = new HashMap<Long, Set<PagePosition>>();
     
      Set<Long> pgTXs = new HashSet<Long>();
View Full Code Here

   private void getJmsBindings() throws Exception
   {
      SequentialFileFactory bindingsJMS = new NIOSequentialFileFactory(config.getBindingsDirectory());

      Journal jmsJournal = new JournalImpl(1024 * 1024,
                                           2,
                                           config.getJournalCompactMinFiles(),
                                           config.getJournalCompactPercentage(),
                                           bindingsJMS,
                                           "hornetq-jms",
                                           "jms",
                                           1);

      jmsJournal.start();

      List<RecordInfo> data = new ArrayList<>();

      ArrayList<PreparedTransactionInfo> list = new ArrayList<>();

      HornetQServerLogger.LOGGER.debug("Reading jms bindings journal from " + config.getBindingsDirectory());

      jmsJournal.load(data, list, null);

      for (RecordInfo record : data)
      {
         long id = record.id;

View Full Code Here

      }
   }

   public void testSpeedTransactional() throws Exception
   {
      Journal journal = new JournalImpl(10 * 1024 * 1024, 10, 0, 0, getFileFactory(), "hornetq-data", "hq", 5000);

      journal.start();

      journal.load(new ArrayList<RecordInfo>(), null, null);

      try
      {
         final int numMessages = 50050;

         SimpleEncoding data = new SimpleEncoding(1024, (byte)'j');

         long start = System.currentTimeMillis();

         int count = 0;
         double rates[] = new double[50];
         for (int i = 0; i < 50; i++)
         {
            long startTrans = System.currentTimeMillis();
            for (int j = 0; j < 1000; j++)
            {
               journal.appendAddRecordTransactional(i, count++, (byte)0, data);
            }

            journal.appendCommitRecord(i, true);

            long endTrans = System.currentTimeMillis();

            rates[i] = 1000 * (double)1000 / (endTrans - startTrans);
         }

         long end = System.currentTimeMillis();

         for (double rate : rates)
         {
            JournalImplTestUnit.log.info("Transaction Rate = " + rate + " records/sec");

         }

         double rate = 1000 * (double)numMessages / (end - start);

         JournalImplTestUnit.log.info("Rate " + rate + " records/sec");
      }
      finally
      {
         journal.stop();
      }

   }
View Full Code Here

         numFiles = 2;
      }

      JournalImplTestUnit.log.debug("num Files=" + numFiles);

      Journal journal = new JournalImpl(10 * 1024 * 1024, numFiles, 0, 0, getFileFactory(), "hornetq-data", "hq", 5000);

      journal.start();

      journal.load(new ArrayList<RecordInfo>(), null, null);

      JournalImplTestUnit.log.debug("Adding data");
      SimpleEncoding data = new SimpleEncoding(700, (byte)'j');

      long start = System.currentTimeMillis();

      for (int i = 0; i < numMessages; i++)
      {
         journal.appendAddRecord(i, (byte)0, data, true);
      }

      long end = System.currentTimeMillis();

      double rate = 1000 * (double)numMessages / (end - start);

      JournalImplTestUnit.log.info("Rate " + rate + " records/sec");

      journal.stop();

      journal = new JournalImpl(10 * 1024 * 1024, numFiles, 0, 0, getFileFactory(), "hornetq-data", "hq", 5000);

      journal.start();
      journal.load(new ArrayList<RecordInfo>(), null, null);
      journal.stop();

   }
View Full Code Here

   public void testInsertUpdateAndLoad() throws Exception
   {

      SequentialFileFactory factory = new AIOSequentialFileFactory(getTestDir());
      JournalImpl impl = new JournalImpl(10 * 1024 * 1024,
                                         AddAndRemoveStressTest.NUMBER_OF_FILES_ON_JOURNAL,
                                         0,
                                         0,
                                         factory,
                                         "hq",
                                         "hq",
                                         1000);

      impl.start();

      impl.load(AddAndRemoveStressTest.dummyLoader);

      for (long i = 1; i <= AddAndRemoveStressTest.NUMBER_OF_MESSAGES; i++)
      {
         if (i % 10000 == 0)
         {
            System.out.println("Append " + i);
         }
         impl.appendAddRecord(i, (byte)21, new SimpleEncoding(40, (byte)'f'), false);
         impl.appendUpdateRecord(i, (byte)22, new SimpleEncoding(40, (byte)'g'), false);
      }

      impl.stop();

      factory = new AIOSequentialFileFactory(getTestDir());
      impl = new JournalImpl(10 * 1024 * 1024, 10, 0, 0, factory, "hq", "hq", 1000);

      impl.start();

      impl.load(AddAndRemoveStressTest.dummyLoader);

      for (long i = 1; i <= AddAndRemoveStressTest.NUMBER_OF_MESSAGES; i++)
      {
         if (i % 10000 == 0)
         {
            System.out.println("Delete " + i);
         }

         impl.appendDeleteRecord(i, false);
      }

      impl.stop();

      factory = new AIOSequentialFileFactory(getTestDir());
      impl = new JournalImpl(10 * 1024 * 1024,
                             AddAndRemoveStressTest.NUMBER_OF_FILES_ON_JOURNAL,
                             0,
                             0,
                             factory,
                             "hq",
                             "hq",
                             1000);

      impl.start();

      ArrayList<RecordInfo> info = new ArrayList<RecordInfo>();
      ArrayList<PreparedTransactionInfo> trans = new ArrayList<PreparedTransactionInfo>();

      impl.load(info, trans, null);

      if (info.size() > 0)
      {
         System.out.println("Info ID: " + info.get(0).id);
      }

      impl.forceMoveNextFile();
      impl.checkReclaimStatus();

      impl.stop();

      Assert.assertEquals(0, info.size());
      Assert.assertEquals(0, trans.size());
      Assert.assertEquals(0, impl.getDataFilesCount());

      System.out.println("Size = " + impl.getDataFilesCount());

   }
View Full Code Here

         internalTestProduceAndConsume();
         stopServer();

         NIOSequentialFileFactory factory = new NIOSequentialFileFactory(getJournalDir());
         JournalImpl journal = new JournalImpl(ConfigurationImpl.DEFAULT_JOURNAL_FILE_SIZE,
                                               2,
                                               0,
                                               0,
                                               factory,
                                               "hornetq-data",
                                               "hq",
                                               100);

         List<RecordInfo> committedRecords = new ArrayList<RecordInfo>();
         List<PreparedTransactionInfo> preparedTransactions = new ArrayList<PreparedTransactionInfo>();

         journal.start();
         journal.load(committedRecords, preparedTransactions, null);

         Assert.assertEquals(0, committedRecords.size());
         Assert.assertEquals(0, preparedTransactions.size());

         System.out.println("DataFiles = " + journal.getDataFilesCount());

         if (i % 2 == 0 && i > 0)
         {
            System.out.println("DataFiles = " + journal.getDataFilesCount());
           
            journal.forceMoveNextFile();
            journal.debugWait();
            journal.checkReclaimStatus();
           
            if (journal.getDataFilesCount() != 0)
            {
               System.out.println("DebugJournal:"  + journal.debug());
            }
            Assert.assertEquals(0, journal.getDataFilesCount());
         }

         journal.stop();
         journal = null;

         setupServer(getJournalType());

      }
View Full Code Here

      super.recreateDirectory(journalDir);

      SequentialFileFactory fileFactory = new AIOSequentialFileFactory(journalDir, bufferSize, bufferTimeout, logRates);

      journal = new JournalImpl(fileSize,
                                minFiles,
                                compactMinFiles,
                                compactPercentage,
                                fileFactory,
                                filePrefix,
View Full Code Here

               process.waitFor();
               Assert.assertEquals(ValidateTransactionHealthTest.OK, process.exitValue());
            }
            else
            {
               JournalImpl journal = ValidateTransactionHealthTest.appendData(type,
                                                                              journalDir,
                                                                              numberOfRecords,
                                                                              transactionSize,
                                                                              numberOfThreads);
               journal.stop();
            }
         }

         reload(type, journalDir, numberOfRecords, numberOfThreads);
      }
View Full Code Here

      }
   }

   private void reload(final String type, final String journalDir, final long numberOfRecords, final int numberOfThreads) throws Exception
   {
      JournalImpl journal = ValidateTransactionHealthTest.createJournal(type, journalDir);

      journal.start();
      Loader loadTest = new Loader(numberOfRecords);
      journal.load(loadTest);
      Assert.assertEquals(numberOfRecords * numberOfThreads, loadTest.numberOfAdds);
      Assert.assertEquals(0, loadTest.numberOfPreparedTransactions);
      Assert.assertEquals(0, loadTest.numberOfUpdates);
      Assert.assertEquals(0, loadTest.numberOfDeletes);

      journal.stop();

      if (loadTest.ex != null)
      {
         throw loadTest.ex;
      }
View Full Code Here

TOP

Related Classes of org.hornetq.core.journal.impl.JournalImpl$PerfBlast

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.