Search in sources :

Example 1 with IGNITE_PERF_STAT_FILE_MAX_SIZE

use of org.apache.ignite.IgniteSystemProperties.IGNITE_PERF_STAT_FILE_MAX_SIZE in project ignite by apache.

the class PerformanceStatisticsPropertiesTest method testFileMaxSize.

/**
 * @throws Exception If failed.
 */
@Test
@WithSystemProperty(key = IGNITE_PERF_STAT_FILE_MAX_SIZE, value = "" + TEST_FILE_MAX_SIZE)
public void testFileMaxSize() throws Exception {
    long initLen = srv.context().cache().cacheDescriptors().values().stream().mapToInt(desc -> 1 + cacheStartRecordSize(desc.cacheName().getBytes().length, false)).sum();
    long expOpsCnt = (TEST_FILE_MAX_SIZE - initLen) / (/*typeOp*/
    1 + OperationType.cacheRecordSize());
    startCollectStatistics();
    for (int i = 0; i < expOpsCnt * 2; i++) srv.cache(DEFAULT_CACHE_NAME).get(i);
    AtomicInteger opsCnt = new AtomicInteger();
    stopCollectStatisticsAndRead(new TestHandler() {

        @Override
        public void cacheOperation(UUID nodeId, OperationType type, int cacheId, long startTime, long duration) {
            opsCnt.incrementAndGet();
        }
    });
    assertEquals(expOpsCnt, opsCnt.get());
    long expLen = initLen + opsCnt.get() * (/*typeOp*/
    1 + OperationType.cacheRecordSize());
    List<File> files = statisticsFiles();
    assertEquals(1, files.size());
    long statFileLen = files.get(0).length();
    assertEquals(expLen, statFileLen);
    assertTrue(statFileLen <= TEST_FILE_MAX_SIZE);
}
Also used : OperationType.taskRecordSize(org.apache.ignite.internal.processors.performancestatistics.OperationType.taskRecordSize) IGNITE_PERF_STAT_FILE_MAX_SIZE(org.apache.ignite.IgniteSystemProperties.IGNITE_PERF_STAT_FILE_MAX_SIZE) GridTestUtils.waitForCondition(org.apache.ignite.testframework.GridTestUtils.waitForCondition) IgniteRunnable(org.apache.ignite.lang.IgniteRunnable) IgniteEx(org.apache.ignite.internal.IgniteEx) Test(org.junit.Test) UUID(java.util.UUID) File(java.io.File) IgniteSystemProperties(org.apache.ignite.IgniteSystemProperties) WithSystemProperty(org.apache.ignite.testframework.junits.WithSystemProperty) List(java.util.List) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) IGNITE_PERF_STAT_CACHED_STRINGS_THRESHOLD(org.apache.ignite.IgniteSystemProperties.IGNITE_PERF_STAT_CACHED_STRINGS_THRESHOLD) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) OperationType.jobRecordSize(org.apache.ignite.internal.processors.performancestatistics.OperationType.jobRecordSize) OperationType.cacheStartRecordSize(org.apache.ignite.internal.processors.performancestatistics.OperationType.cacheStartRecordSize) IGNITE_PERF_STAT_FLUSH_SIZE(org.apache.ignite.IgniteSystemProperties.IGNITE_PERF_STAT_FLUSH_SIZE) IgniteUuid(org.apache.ignite.lang.IgniteUuid) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) UUID(java.util.UUID) File(java.io.File) Test(org.junit.Test) WithSystemProperty(org.apache.ignite.testframework.junits.WithSystemProperty)

Aggregations

File (java.io.File)1 List (java.util.List)1 UUID (java.util.UUID)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 IgniteSystemProperties (org.apache.ignite.IgniteSystemProperties)1 IGNITE_PERF_STAT_CACHED_STRINGS_THRESHOLD (org.apache.ignite.IgniteSystemProperties.IGNITE_PERF_STAT_CACHED_STRINGS_THRESHOLD)1 IGNITE_PERF_STAT_FILE_MAX_SIZE (org.apache.ignite.IgniteSystemProperties.IGNITE_PERF_STAT_FILE_MAX_SIZE)1 IGNITE_PERF_STAT_FLUSH_SIZE (org.apache.ignite.IgniteSystemProperties.IGNITE_PERF_STAT_FLUSH_SIZE)1 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)1 IgniteEx (org.apache.ignite.internal.IgniteEx)1 OperationType.cacheStartRecordSize (org.apache.ignite.internal.processors.performancestatistics.OperationType.cacheStartRecordSize)1 OperationType.jobRecordSize (org.apache.ignite.internal.processors.performancestatistics.OperationType.jobRecordSize)1 OperationType.taskRecordSize (org.apache.ignite.internal.processors.performancestatistics.OperationType.taskRecordSize)1 IgniteRunnable (org.apache.ignite.lang.IgniteRunnable)1 IgniteUuid (org.apache.ignite.lang.IgniteUuid)1 GridTestUtils.waitForCondition (org.apache.ignite.testframework.GridTestUtils.waitForCondition)1 WithSystemProperty (org.apache.ignite.testframework.junits.WithSystemProperty)1 Test (org.junit.Test)1