Examples of Zipf


Examples of com.oltpbenchmark.util.RandomDistribution.Zipf

       
        public UserGenerator() {
            super(AuctionMarkConstants.TABLENAME_USERACCT,
                  AuctionMarkConstants.TABLENAME_REGION);
            this.randomRegion = new Flat(profile.rng, 0, (int)AuctionMarkConstants.TABLESIZE_REGION);
            this.randomRating = new Zipf(profile.rng, AuctionMarkConstants.USER_MIN_RATING,
                                                      AuctionMarkConstants.USER_MAX_RATING, 1.0001);
            this.randomBalance = new Zipf(profile.rng, AuctionMarkConstants.USER_MIN_BALANCE,
                                                       AuctionMarkConstants.USER_MAX_BALANCE, 1.001);
        }
View Full Code Here

Examples of com.oltpbenchmark.util.RandomDistribution.Zipf

            // items that each user should have. This will then be used to calculate the
            // the user ids by placing them into numeric ranges
            int max_items = Math.max(1, (int)Math.ceil(AuctionMarkConstants.ITEM_ITEMS_PER_SELLER_MAX * profile.getScaleFactor()));
            assert(max_items > 0);
            LOG.debug("Max Items Per Seller: " + max_items);
            Zipf randomNumItems = new Zipf(profile.rng,
                       AuctionMarkConstants.ITEM_ITEMS_PER_SELLER_MIN,
                       max_items,
                       AuctionMarkConstants.ITEM_ITEMS_PER_SELLER_SIGMA);
            for (long i = 0; i < this.tableSize; i++) {
                long num_items = randomNumItems.nextInt();
                profile.users_per_itemCount.put(num_items);
            } // FOR
             if (LOG.isDebugEnabled())
                LOG.debug("Users Per Item Count:\n" + profile.users_per_itemCount);
            this.idGenerator = new UserIdGenerator(profile.users_per_itemCount, benchmark.getWorkloadConfiguration().getTerminals());
View Full Code Here

Examples of com.oltpbenchmark.util.RandomDistribution.Zipf

       
        public UserAttributesGenerator() {
            super(AuctionMarkConstants.TABLENAME_USERACCT_ATTRIBUTES,
                  AuctionMarkConstants.TABLENAME_USERACCT);
           
            this.randomNumUserAttributes = new Zipf(profile.rng,
                                                    AuctionMarkConstants.USER_MIN_ATTRIBUTES,
                                                    AuctionMarkConstants.USER_MAX_ATTRIBUTES, 1.001);
        }
View Full Code Here

Examples of com.oltpbenchmark.util.RandomDistribution.Zipf

                LOG.trace("endDate = " + endDate + " : startDate = " + startDate);
           
            long bidDurationDay = ((endDate.getTime() - startDate.getTime()) / AuctionMarkConstants.MILLISECONDS_IN_A_DAY);
            Pair<Zipf, Zipf> p = this.item_bid_watch_zipfs.get(bidDurationDay);
            if (p == null) {
                Zipf randomNumBids = new Zipf(profile.rng,
                        AuctionMarkConstants.ITEM_BIDS_PER_DAY_MIN * (int)bidDurationDay,
                        AuctionMarkConstants.ITEM_BIDS_PER_DAY_MAX * (int)bidDurationDay,
                        AuctionMarkConstants.ITEM_BIDS_PER_DAY_SIGMA);
                Zipf randomNumWatches = new Zipf(profile.rng,
                        AuctionMarkConstants.ITEM_WATCHES_PER_DAY_MIN * (int)bidDurationDay,
                        AuctionMarkConstants.ITEM_WATCHES_PER_DAY_MAX * (int)bidDurationDay,
                        AuctionMarkConstants.ITEM_WATCHES_PER_DAY_SIGMA);
                p = Pair.of(randomNumBids, randomNumWatches);
                this.item_bid_watch_zipfs.put(bidDurationDay, p);
View Full Code Here

Examples of com.oltpbenchmark.util.RandomDistribution.Zipf

        this.rng = rng;
        this.scale_factor = benchmark.getWorkloadConfiguration().getScaleFactor();
        this.num_clients = benchmark.getWorkloadConfiguration().getTerminals();
        this.loaderStartTime = new Timestamp(System.currentTimeMillis());

        this.randomInitialPrice = new Zipf(this.rng,
                AuctionMarkConstants.ITEM_INITIAL_PRICE_MIN,
                AuctionMarkConstants.ITEM_INITIAL_PRICE_MAX,
                AuctionMarkConstants.ITEM_INITIAL_PRICE_SIGMA);
       
        // Random time difference in a second scale
        this.randomTimeDiff = new Gaussian(this.rng,
                AuctionMarkConstants.ITEM_PRESERVE_DAYS * 24 * 60 * 60 * -1,
                AuctionMarkConstants.ITEM_DURATION_DAYS_MAX * 24 * 60 * 60);
       
        this.randomDuration = new Gaussian(this.rng,
                AuctionMarkConstants.ITEM_DURATION_DAYS_MIN,
                AuctionMarkConstants.ITEM_DURATION_DAYS_MAX);
       
        this.randomPurchaseDuration = new Zipf(this.rng,
                AuctionMarkConstants.ITEM_PURCHASE_DURATION_DAYS_MIN,
                AuctionMarkConstants.ITEM_PURCHASE_DURATION_DAYS_MAX,
                AuctionMarkConstants.ITEM_PURCHASE_DURATION_DAYS_SIGMA);
       
        this.randomNumImages = new Zipf(this.rng,
                AuctionMarkConstants.ITEM_NUM_IMAGES_MIN,
                AuctionMarkConstants.ITEM_NUM_IMAGES_MAX,
                AuctionMarkConstants.ITEM_NUM_IMAGES_SIGMA);
       
        this.randomNumAttributes = new Zipf(this.rng,
                AuctionMarkConstants.ITEM_NUM_GLOBAL_ATTRS_MIN,
                AuctionMarkConstants.ITEM_NUM_GLOBAL_ATTRS_MAX,
                AuctionMarkConstants.ITEM_NUM_GLOBAL_ATTRS_SIGMA);
       
        this.randomNumComments = new Zipf(this.rng,
                AuctionMarkConstants.ITEM_NUM_COMMENTS_MIN,
                AuctionMarkConstants.ITEM_NUM_COMMENTS_MAX,
                AuctionMarkConstants.ITEM_NUM_COMMENTS_SIGMA);

        if (LOG.isTraceEnabled())
View Full Code Here

Examples of com.oltpbenchmark.util.RandomDistribution.Zipf

        String revSQL = SQLUtil.getInsertSQL(revTable);
        PreparedStatement revisionInsert = this.conn.prepareStatement(revSQL);

        WikipediaBenchmark b = (WikipediaBenchmark)this.benchmark;
        int batchSize = 1;
        Zipf h_users = new Zipf(this.rng(), 1, this.num_users, WikipediaConstants.REVISION_USER_SIGMA);
        FlatHistogram<Integer> h_textLength = new FlatHistogram<Integer>(this.rng(), TextHistograms.TEXT_LENGTH);
        FlatHistogram<Integer> h_commentLength = b.commentLength;
        FlatHistogram<Integer> h_minorEdit = b.minorEdit;
        FlatHistogram<Integer> h_nameLength = new FlatHistogram<Integer>(this.rng(), UserHistograms.NAME_LENGTH);
        FlatHistogram<Integer> h_numRevisions = new FlatHistogram<Integer>(this.rng(), PageHistograms.REVISIONS_PER_PAGE);
       
        int rev_id = 1;
        int lastPercent = -1;
        for (int page_id = 1; page_id <= this.num_pages; page_id++) {
            // There must be at least one revision per page
            int num_revised = h_numRevisions.nextValue().intValue();
           
            // Generate what the new revision is going to be
            int old_text_length = h_textLength.nextValue().intValue();
            assert(old_text_length > 0);
            char old_text[] = TextGenerator.randomChars(rng(), old_text_length);
           
            for (int i = 0; i < num_revised; i++) {
                // Generate the User who's doing the revision and the Page revised
                // Makes sure that we always update their counter
                int user_id = h_users.nextInt();
                assert(user_id > 0 && user_id <= this.num_users) : "Invalid UserId '" + user_id + "'";
                this.user_revision_ctr[user_id-1]++;
               
                // Generate what the new revision is going to be
                if (i > 0) {
View Full Code Here

Examples of com.oltpbenchmark.util.RandomDistribution.Zipf

       
        assert(this.num_pages == this.titles.size());
        LOG.info(String.format("Generating a %dk traces to '%s'", b.getTraceSize(), file));
       
        Flat z_users = new Flat(rng(), 1, this.num_users);
        Zipf z_pages = new Zipf(rng(), 1, this.num_pages, WikipediaConstants.USER_ID_SIGMA);
       
        PrintStream ps = new PrintStream(file);
        for (int i = 0, cnt = (b.getTraceSize() * 1000); i < cnt; i++) {
            int user_id = -1;
           
            // Check whether this should be an anonymous update
            if (rng().nextInt(100) < WikipediaConstants.ANONYMOUS_PAGE_UPDATE_PROB) {
                user_id = WikipediaConstants.ANONYMOUS_USER_ID;
            }
            // Otherwise figure out what user is updating this page
            else {
                user_id = z_users.nextInt();
            }
            assert(user_id != -1);
           
            // Figure out what page they're going to update
            int page_id = z_pages.nextInt();
            Pair<Integer, String> p = this.titles.get(page_id);
            assert(p != null);
           
            TransactionSelector.writeEntry(ps, user_id, p.getFirst(), p.getSecond());
        } // FOR
View Full Code Here

Examples of com.oltpbenchmark.util.RandomDistribution.Zipf

        assert(catalog_tbl != null);
       
        String sql = SQLUtil.getInsertSQL(catalog_tbl, 1);
        PreparedStatement watchInsert = this.conn.prepareStatement(sql);
       
        Zipf h_numWatches = new Zipf(rng(), 0, this.num_pages, WikipediaConstants.NUM_WATCHES_PER_USER_SIGMA);
        Zipf h_pageId = new Zipf(rng(), 1, this.num_pages, WikipediaConstants.WATCHLIST_PAGE_SIGMA);

        int batchSize = 0;
        int lastPercent = -1;
        Set<Integer> userPages = new HashSet<Integer>();
        for (int user_id = 1; user_id <= this.num_users; user_id++) {
            int num_watches = h_numWatches.nextInt();
            if (LOG.isTraceEnabled())
                LOG.trace(user_id + " => " + num_watches);
           
            userPages.clear();
            for (int i = 0; i < num_watches; i++) {
                int pageId = h_pageId.nextInt();
                while (userPages.contains(pageId)) {
                    pageId = h_pageId.nextInt();
                } // WHILE
                userPages.add(pageId);
               
                Pair<Integer, String> page = this.titles.get(pageId);
                assert(page != null) : "Invalid PageId " + pageId;
View Full Code Here

Examples of edu.brown.rand.RandomDistribution.Zipf

          assert(txns.getSampleCount() == 100) : txns;
          this.rand_gen = new Random();
          long articlesSize = Math.round(ArticlesConstants.ARTICLES_SIZE * this.getScaleFactor());
          long usersSize = Math.round(ArticlesConstants.USERS_SIZE * this.getScaleFactor());

          this.readRecord = new Zipf(this.rand_gen, 0,
                    articlesSize, 1.0001);
          this.userRecord = new Zipf(this.rand_gen, 0, usersSize, 1.0001);

          this.txnWeights = new FlatHistogram<Transaction>(this.rand_gen, txns);
      }
View Full Code Here

Examples of edu.brown.rand.RandomDistribution.Zipf

       
        public UserGenerator() {
            super(AuctionMarkConstants.TABLENAME_USER,
                  AuctionMarkConstants.TABLENAME_REGION);
            this.randomRegion = new Flat(profile.rng, 0, (int) AuctionMarkConstants.TABLESIZE_REGION);
            this.randomRating = new Zipf(profile.rng, AuctionMarkConstants.USER_MIN_RATING,
                                                                     AuctionMarkConstants.USER_MAX_RATING, 1.0001);
            this.randomBalance = new Zipf(profile.rng, AuctionMarkConstants.USER_MIN_BALANCE,
                                                                      AuctionMarkConstants.USER_MAX_BALANCE, 1.001);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.