MCPcopy Create free account
hub / github.com/apache/mesos / TEST_P

Function TEST_P

src/tests/hierarchical_allocator_benchmarks.cpp:545–653  ·  view source on GitHub ↗

This benchmark evaluates the allocator performance in the presence of roles with both small quota (which can be satisfied by half an agent) as well as large quota (which need resources from two agents). We setup the cluster, trigger one allocation cycle and measure the elapsed time. All cluster resources will be offered in this cycle to satisfy all roles' quota.

Source from the content-addressed store, hash-verified

543// cluster, trigger one allocation cycle and measure the elapsed time. All
544// cluster resources will be offered in this cycle to satisfy all roles' quota.
545TEST_P(BENCHMARK_HierarchicalAllocator_WithQuotaParam, LargeAndSmallQuota)
546{
547 // Pause the clock because we want to manually drive the allocations.
548 Clock::pause();
549
550 // Each agent can satisfy either two `smallQuotaRole` or half of
551 // `largeQuotaRole`.
552 const string agentResourcesString = "cpus:2;mem:2048;disk:2048";
553 const string smallQuotaResourcesString = "cpus:1;mem:1024;disk:1024";
554 const string largeQuotaResourcesString = "cpus:4;mem:4096;disk:4096";
555
556 const string& sorter = std::get<0>(GetParam());
557
558 BenchmarkConfig config{master::DEFAULT_ALLOCATOR, sorter, sorter};
559
560 const QuotaParam& quotaParam = std::get<1>(GetParam());
561
562 // Store roles for setting up quota later (after allocator is initialized).
563 vector<string> smallQuotaRoles;
564
565 // Add framework profiles for `smallQuotaRole`.
566 for (size_t i = 0; i < quotaParam.smallQuotaRoleCount; i++) {
567 string role("smallQuotaRole" + stringify(i));
568 smallQuotaRoles.push_back(role);
569 config.frameworkProfiles.push_back(FrameworkProfile(
570 "framework_small_" + stringify(i),
571 {role},
572 quotaParam.frameworksPerRole));
573 }
574
575 // Store roles for setting up quota later (after allocator is initialized).
576 vector<string> largeQuotaRoles;
577
578 // Add framework profiles for `largeQuotaRole`.
579 for (size_t i = 0; i < quotaParam.largeQuotaRoleCount; i++) {
580 string role("largeQuotaRole" + stringify(i));
581 largeQuotaRoles.push_back(role);
582 config.frameworkProfiles.push_back(FrameworkProfile(
583 "framework_large_" + stringify(i),
584 {role},
585 quotaParam.frameworksPerRole));
586 }
587
588 // See comment above in `QuotaParam` regarding how we decide agent counts.
589 size_t agentCount =
590 quotaParam.smallQuotaRoleCount / 5 + quotaParam.largeQuotaRoleCount * 5;
591
592 // Add agent profiles.
593 config.agentProfiles.push_back(AgentProfile(
594 "agent",
595 agentCount,
596 CHECK_NOTERROR(Resources::parse(agentResourcesString))));
597
598 initializeCluster(config);
599
600 size_t totalRoleCount =
601 quotaParam.smallQuotaRoleCount + quotaParam.largeQuotaRoleCount;
602

Callers

nothing calls this directly

Calls 12

FrameworkProfileClass · 0.85
AgentProfileClass · 0.85
isReadyMethod · 0.80
elapsedMethod · 0.80
startMethod · 0.65
stopMethod · 0.65
stringifyFunction · 0.50
parseFunction · 0.50
pauseMethod · 0.45
resumeMethod · 0.45
getMethod · 0.45
isPendingMethod · 0.45

Tested by

no test coverage detected