Package voldemort.store.quota

Examples of voldemort.store.quota.QuotaLimitStats


        File tempDir = TestUtils.createTempDir();

        FileBackedCachingStorageEngine quotaStore = new FileBackedCachingStorageEngine("quota-usage-test-store",
                                                                                       tempDir.getAbsolutePath());
        InMemoryStorageEngine<ByteArray, byte[], byte[]> inMemoryEngine = new InMemoryStorageEngine<ByteArray, byte[], byte[]>("inMemoryBackingStore");
        QuotaLimitStats quotaStats = new QuotaLimitStats(null, 1000);
        StatTrackingStore statTrackingStore = new StatTrackingStore(inMemoryEngine, null);

        QuotaLimitingStore quotaLimitingStore = new QuotaLimitingStore(statTrackingStore,
                                                                       statTrackingStore.getStats(),
                                                                       quotaStats,
                                                                       quotaStore);

        int targetRate = 50;
        // provide a quota of 100 gets/sec
        quotaStore.put(new ByteArray(QuotaUtils.makeQuotaKey(statTrackingStore.getName(),
                                                             QuotaType.GET_THROUGHPUT).getBytes()),
                       new Versioned<byte[]>("100.0".getBytes()),
                       null);

        long testIntervalMs = 5000;
        long timeToSleepMs = 1000 / targetRate;
        long startMs = System.currentTimeMillis();
        ByteArray key = new ByteArray("some key".getBytes());
        while((System.currentTimeMillis() - startMs) <= testIntervalMs) {
            quotaLimitingStore.get(key, null);
            Thread.sleep(timeToSleepMs);
        }

        assertEquals("No get operations should be throttled", 0, quotaStats.getRateLimitedGets());
        assertEquals("Put usage should be 0", 0, quotaStats.getQuotaPctUsedPut());
        assertEquals("delete usage should be 0", 0, quotaStats.getQuotaPctUsedDelete());
        assertEquals("getall usage should be 0", 0, quotaStats.getQuotaPctUsedGetAll());

        assertEquals("Computed usage pct must be close to actual observed qps",
                     statTrackingStore.getStats().getThroughput(Tracked.GET),
                     quotaStats.getQuotaPctUsedGet(),
                     1.0);

    }
View Full Code Here


            JmxUtils.registerMbean(this.aggregatedProxyPutStats,
                                   JmxUtils.createObjectName("voldemort.store.rebalancing",
                                                             "aggregate-proxy-puts"));
        }

        this.aggregatedQuotaStats = new QuotaLimitStats(null);
        if(config.isJmxEnabled()) {
            JmxUtils.registerMbean(this.aggregatedQuotaStats,
                                   JmxUtils.createObjectName("voldemort.store.quota",
                                                             "aggregate-quota-limit-stats"));
        }
View Full Code Here

            // Wrap everything under the rate limiting store (barring the
            // metadata store)
            if(voldemortConfig.isEnableQuotaLimiting() && !isMetadata) {
                StoreStats currentStoreStats = statStore.getStats();
                FileBackedCachingStorageEngine quotaStore = (FileBackedCachingStorageEngine) storeRepository.getStorageEngine(SystemStoreConstants.SystemStoreName.voldsys$_store_quotas.toString());
                QuotaLimitStats quotaStats = new QuotaLimitStats(this.aggregatedQuotaStats);
                QuotaLimitingStore rateLimitingStore = new QuotaLimitingStore(store,
                                                                              currentStoreStats,
                                                                              quotaStats,
                                                                              quotaStore);
                if(voldemortConfig.isJmxEnabled()) {
View Full Code Here

TOP

Related Classes of voldemort.store.quota.QuotaLimitStats

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.