Package com.griddynamics.gridkit.coherence.patterns.benchmark.speedlimit

Examples of com.griddynamics.gridkit.coherence.patterns.benchmark.speedlimit.SpeedLimit


     
      final PatternFacade facade = PatternFacade.DefaultFacade.getInstance();
     
      final FunctorFactory functorFactory = getFunctorFactoryByName(benchmarkParams.getFunctorType());
     
      final SpeedLimit speedLimit = SpeedLimit.SpeedLimitHelper.getSpeedLimit(benchmarkParams.getOpsPerSec());
     
      ExecutorService service = benchmarkParams.getThreadCount() == 1 ? Executors.newSingleThreadExecutor()
                                      : Executors.newFixedThreadPool(benchmarkParams.getThreadCount());
     
      List<Callable<Void>> workers = new ArrayList<Callable<Void>>(benchmarkParams.getThreadCount());
      final CyclicBarrier  barrier = new CyclicBarrier(benchmarkParams.getThreadCount());
     
      for(int j = 0; j != benchmarkParams.getThreadCount(); ++j)
      {
        final long exID = j * 10000000;
       
        Callable<Void> rn = new Callable<Void>()
        {
          @Override
          public Void call() throws Exception
          {
            try
            {
              barrier.await();
             
              for(int i = 0; i != benchmarkParams.getInvocationPerThread(); ++i)
              {
                long executionID = exID + i;
                Identifier context = contexts[rnd.nextInt(contexts.length)];
             
                speedLimit.accure();
                 
                BenchmarkFunctor functor = functorFactory.createFunctor(executionID);
                 
                Future<CommandExecutionMark> functorResultFuture = facade.submitFunctor(context, functor.send());
               
View Full Code Here


    {
      final Random rnd = new Random(System.currentTimeMillis());
     
      final CommandFactory commandFactory = CommandBenchmarkDispatcher.getCommandFactory(benchmarkParams.getCommand());
     
      final SpeedLimit speedLimit = SpeedLimit.SpeedLimitHelper.getSpeedLimit(benchmarkParams.getOpsPerSec());
     
      final PatternFacade facade = PatternFacade.DefaultFacade.getInstance();
     
      final int workerID = workerIDs.get(CacheFactory.getCluster().getLocalMember().getId());
     
      ExecutorService service = Executors.newFixedThreadPool(benchmarkParams.getThreadCount());
     
      final CyclicBarrier startBarrier = new CyclicBarrier(benchmarkParams.getThreadCount());
      final CountDownLatch finishLatch = new CountDownLatch(benchmarkParams.getThreadCount());
     
      for(int t = 0; t != benchmarkParams.getThreadCount(); ++t)
      {
        final int threadNumber = t;
       
        Callable<Void> worker = new Callable<Void>()
        {
          @Override
          public Void call() throws Exception
          {
            try
            {
              startBarrier.await();
             
              long commandsPerWorker       = CommandBenchmarkDispatcher.getCommandsPerWorker(benchmarkParams);
              long commandsPerWorkerThread = CommandBenchmarkDispatcher.getCommandsPerWorkerThead(benchmarkParams);
             
              long offset = workerID * commandsPerWorker + threadNumber * commandsPerWorkerThread;
             
              for(int c = 0; c != benchmarkParams.getCommandPerThread(); ++c)
              {
                Identifier ctx = contexts[rnd.nextInt(contexts.length)];
                long id = offset + c * commandFactory.getMarksPerCommand();
               
                speedLimit.accure();
   
                facade.submit(ctx, commandFactory.createCommand(id, benchmarkParams.getReportBuffer()).send());
              }
             
              finishLatch.countDown();
View Full Code Here

TOP

Related Classes of com.griddynamics.gridkit.coherence.patterns.benchmark.speedlimit.SpeedLimit

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.