Package com.yahoo.ycsb.generator

Examples of com.yahoo.ycsb.generator.UniformIntegerGenerator


    int fieldlength=Integer.parseInt(p.getProperty(FIELD_LENGTH_PROPERTY,FIELD_LENGTH_PROPERTY_DEFAULT));
    String fieldlengthhistogram = p.getProperty(FIELD_LENGTH_HISTOGRAM_FILE_PROPERTY, FIELD_LENGTH_HISTOGRAM_FILE_PROPERTY_DEFAULT);
    if(fieldlengthdistribution.compareTo("constant") == 0) {
      fieldlengthgenerator = new ConstantIntegerGenerator(fieldlength);
    } else if(fieldlengthdistribution.compareTo("uniform") == 0) {
      fieldlengthgenerator = new UniformIntegerGenerator(1, fieldlength);
    } else if(fieldlengthdistribution.compareTo("zipfian") == 0) {
      fieldlengthgenerator = new ZipfianGenerator(1, fieldlength);
    } else if(fieldlengthdistribution.compareTo("histogram") == 0) {
      try {
        fieldlengthgenerator = new HistogramGenerator(fieldlengthhistogram);
View Full Code Here


    }

    transactioninsertkeysequence=new CounterGenerator(recordcount);
    if (requestdistrib.compareTo("uniform")==0)
    {
      keychooser=new UniformIntegerGenerator(0,recordcount-1);
    }
    else if (requestdistrib.compareTo("zipfian")==0)
    {
      //it does this by generating a random "next key" in part by taking the modulus over the number of keys
      //if the number of keys changes, this would shift the modulus, and we don't want that to change which keys are popular
      //so we'll actually construct the scrambled zipfian generator with a keyspace that is larger than exists at the beginning
      //of the test. that is, we'll predict the number of inserts, and tell the scrambled zipfian generator the number of existing keys
      //plus the number of predicted keys as the total keyspace. then, if the generator picks a key that hasn't been inserted yet, will
      //just ignore it and pick another key. this way, the size of the keyspace doesn't change from the perspective of the scrambled zipfian generator
     
      int opcount=Integer.parseInt(p.getProperty(Client.OPERATION_COUNT_PROPERTY));
      int expectednewkeys=(int)(((double)opcount)*insertproportion*2.0); //2 is fudge factor
     
      keychooser=new ScrambledZipfianGenerator(recordcount+expectednewkeys);
    }
    else if (requestdistrib.compareTo("latest")==0)
    {
      keychooser=new SkewedLatestGenerator(transactioninsertkeysequence);
    }
    else if (requestdistrib.equals("hotspot"))
    {
      double hotsetfraction = Double.parseDouble(p.getProperty(
          HOTSPOT_DATA_FRACTION, HOTSPOT_DATA_FRACTION_DEFAULT));
      double hotopnfraction = Double.parseDouble(p.getProperty(
          HOTSPOT_OPN_FRACTION, HOTSPOT_OPN_FRACTION_DEFAULT));
      keychooser = new HotspotIntegerGenerator(0, recordcount - 1,
          hotsetfraction, hotopnfraction);
    }
    else
    {
      throw new WorkloadException("Unknown request distribution \""+requestdistrib+"\"");
    }

    fieldchooser=new UniformIntegerGenerator(0,fieldcount-1);
   
    if (scanlengthdistrib.compareTo("uniform")==0)
    {
      scanlength=new UniformIntegerGenerator(1,maxscanlength);
    }
    else if (scanlengthdistrib.compareTo("zipfian")==0)
    {
      scanlength=new ZipfianGenerator(1,maxscanlength);
    }
View Full Code Here

      operationchooser.addValue(Config.getConfig().read_write_modify_proportion, "READMODIFYWRITE");
    }

    transactioninsertkeysequence = new CounterGenerator(recordcount);
    if (Config.getConfig().request_distribution.compareTo("uniform") == 0) {
      keychooser = new UniformIntegerGenerator(0, recordcount - 1);
    } else if (Config.getConfig().request_distribution.compareTo("zipfian") == 0) {
      // it does this by generating a random "next key" in part by taking
      // the modulus over the number of keys
      // if the number of keys changes, this would shift the modulus, and
      // we don't want that to change which keys are popular
      // so we'll actually construct the scrambled zipfian generator with
      // a keyspace that is larger than exists at the beginning
      // of the test. that is, we'll predict the number of inserts, and
      // tell the scrambled zipfian generator the number of existing keys
      // plus the number of predicted keys as the total keyspace. then, if
      // the generator picks a key that hasn't been inserted yet, will
      // just ignore it and pick another key. this way, the size of the
      // keyspace doesn't change from the perspective of the scrambled
      // zipfian generator

      int opcount = Config.getConfig().operation_count;
      int expectednewkeys = (int) (((double) opcount) * Config.getConfig().insert_proportion * 2.0); // 2
                                            // is
                                            // fudge
                                            // factor

      keychooser = new ScrambledZipfianGenerator(recordcount
          + expectednewkeys);
    } else if (Config.getConfig().request_distribution.compareTo("latest") == 0) {
      keychooser = new SkewedLatestGenerator(transactioninsertkeysequence);
    else if (Config.getConfig().request_distribution.compareTo("churn") == 0){
      keychooser = new ChurnGenerator(Config.getConfig().working_set, Config.getConfig().churn_delta, recordcount);
    } else {
      throw new WorkloadException("Unknown distribution \"" + Config.getConfig().request_distribution + "\"");
    }

    fieldchooser = new UniformIntegerGenerator(0, Config.getConfig().field_count - 1);

    if (Config.getConfig().scan_length_distribution.compareTo("uniform") == 0) {
      scanlength = new UniformIntegerGenerator(1, Config.getConfig().max_scan_length);
    } else if (Config.getConfig().scan_length_distribution.compareTo("zipfian") == 0) {
      scanlength = new ZipfianGenerator(1, Config.getConfig().max_scan_length);
    } else {
      throw new WorkloadException("Distribution \"" + Config.getConfig().scan_length_distribution
          + "\" not allowed for scan length");
View Full Code Here

      operationchooser.addValue(Config.getConfig().memupdate_proportion, "UPDATE");
    }
   
    transactioninsertkeysequence = new CounterGenerator(recordcount);
    if (Config.getConfig().request_distribution.compareTo("uniform") == 0) {
      keychooser = new UniformIntegerGenerator(0, recordcount - 1);
    } else if (Config.getConfig().request_distribution.compareTo("zipfian") == 0) {
      // it does this by generating a random "next key" in part by taking
      // the modulus over the number of keys
      // if the number of keys changes, this would shift the modulus, and
      // we don't want that to change which keys are popular
      // so we'll actually construct the scrambled zipfian generator with
      // a keyspace that is larger than exists at the beginning
      // of the test. that is, we'll predict the number of inserts, and
      // tell the scrambled zipfian generator the number of existing keys
      // plus the number of predicted keys as the total keyspace. then, if
      // the generator picks a key that hasn't been inserted yet, will
      // just ignore it and pick another key. this way, the size of the
      // keyspace doesn't change from the perspective of the scrambled
      // zipfian generator

      int opcount = Config.getConfig().operation_count;
      int expectednewkeys = (int) (((double) opcount) * Config.getConfig().memset_proportion * 2.0); // 2 is fudge factor
      keychooser = new ScrambledZipfianGenerator(recordcount + expectednewkeys);
    } else if (Config.getConfig().request_distribution.compareTo("latest") == 0) {
      keychooser = new SkewedLatestGenerator(transactioninsertkeysequence);
    } else if (Config.getConfig().request_distribution.compareTo("churn") == 0){
      keychooser = new ChurnGenerator(Config.getConfig().working_set, Config.getConfig().churn_delta, recordcount);
    } else {
      throw new WorkloadException("Unknown distribution \"" + Config.getConfig().request_distribution + "\"");
    }

    fieldchooser = new UniformIntegerGenerator(0, Config.getConfig().field_count - 1);

    if (Config.getConfig().scan_length_distribution.compareTo("uniform") == 0) {
      scanlength = new UniformIntegerGenerator(1, Config.getConfig().max_scan_length);
    } else if (Config.getConfig().scan_length_distribution.compareTo("zipfian") == 0) {
      scanlength = new ZipfianGenerator(1, Config.getConfig().max_scan_length);
    } else {
      throw new WorkloadException("Distribution \"" + Config.getConfig().scan_length_distribution + "\" not allowed for scan length");
    }
View Full Code Here

TOP

Related Classes of com.yahoo.ycsb.generator.UniformIntegerGenerator

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.