Apache Mesos
constants.hpp
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef __MASTER_CONSTANTS_HPP__
18 #define __MASTER_CONSTANTS_HPP__
19 
20 #include <stdint.h>
21 
22 #include <mesos/mesos.hpp>
23 
24 #include <stout/bytes.hpp>
25 #include <stout/duration.hpp>
26 #include <stout/version.hpp>
27 
28 namespace mesos {
29 namespace internal {
30 namespace master {
31 
32 // TODO(benh): Add units after constants.
33 // TODO(benh): Also make configuration options be constants.
34 
35 // TODO(vinod): Move constants that are only used in flags to
36 // 'master/flags.hpp'.
37 
38 // TODO(jieyu): Use static functions for all the constants. See more
39 // details in MESOS-1023.
40 
41 // Maximum number of slot offers to have outstanding for each framework.
42 constexpr int MAX_OFFERS_PER_FRAMEWORK = 50;
43 
44 // Minimum number of cpus per offer.
45 constexpr double MIN_CPUS = 0.01;
46 
47 // Minimum amount of memory per offer.
48 constexpr Bytes MIN_MEM = Megabytes(32);
49 
50 // Default interval the master uses to send heartbeats to an HTTP
51 // scheduler.
53 
54 // Amount of time within which a slave PING should be received.
55 // NOTE: The slave uses these PING constants to determine when
56 // the master has stopped sending pings. If these are made
57 // configurable, then we'll need to rely on upper/lower bounds
58 // to ensure that the slave is not unnecessarily triggering
59 // re-registrations.
61 
62 // Maximum number of ping timeouts until slave is considered failed.
63 constexpr size_t DEFAULT_MAX_AGENT_PING_TIMEOUTS = 5;
64 
65 // The minimum timeout that can be used by a newly elected leader to
66 // allow re-registration of slaves. Any slaves that do not reregister
67 // within this timeout will be marked unreachable; if/when the agent
68 // reregisters, non-partition-aware tasks running on the agent will
69 // be terminated.
71 
72 // Default limit on the percentage of slaves that will be removed
73 // after recovering if no re-registration attempts were made.
74 // TODO(bmahler): There's no value here that works for all setups.
75 // Currently the default is 100% which is favorable to those running
76 // small clusters or experimenting with Mesos. However, it's important
77 // that we also prevent the catastrophic 100% removal case for
78 // production clusters. This TODO is to provide a --production flag
79 // which would allow flag defaults that are more appropriate for
80 // production use-cases.
81 constexpr double RECOVERY_AGENT_REMOVAL_PERCENT_LIMIT = 1.0; // 100%.
82 
83 // Maximum number of removed slaves to store in the cache.
84 constexpr size_t MAX_REMOVED_SLAVES = 100000;
85 
86 // Default maximum number of completed frameworks to store in the cache.
87 constexpr size_t DEFAULT_MAX_COMPLETED_FRAMEWORKS = 50;
88 
89 // Default maximum number of completed tasks per framework
90 // to store in the cache.
92 
93 // Default maximum number of unreachable tasks per framework
94 // to store in the cache.
96 
97 // Time interval to check for updated watchers list.
99 
100 // Default number of tasks (limit) for /master/tasks endpoint.
101 constexpr size_t TASK_LIMIT = 100;
102 
104 
106 
107 constexpr size_t DEFAULT_REGISTRY_MAX_AGENT_COUNT = 100 * 1024;
108 
114 constexpr char MASTER_INFO_LABEL[] = "info";
115 
121 constexpr char MASTER_INFO_JSON_LABEL[] = "json.info";
122 
123 // Timeout used for ZooKeeper related operations.
124 // TODO(vinod): Master detector/contender should use this timeout.
126 
127 // Name of the default, CRAM-MD5 authenticator.
128 constexpr char DEFAULT_AUTHENTICATOR[] = "crammd5";
129 
130 // Name of the default hierarchical allocator.
131 constexpr char DEFAULT_ALLOCATOR[] = "hierarchical";
132 
133 // The default interval between allocations.
135 
136 // Name of the default, local authorizer.
137 constexpr char DEFAULT_AUTHORIZER[] = "local";
138 
139 // Name of the master HTTP authentication realm for read-only endpoints.
141  "mesos-master-readonly";
142 
143 // Name of the master HTTP authentication realm for read-write endpoints.
145  "mesos-master-readwrite";
146 
147 // Name of the default authentication realm for HTTP frameworks.
149  "mesos-master-scheduler";
150 
151 // Agents older than this version are not allowed to register.
153 
154 std::vector<MasterInfo::Capability> MASTER_CAPABILITIES();
155 
156 } // namespace master {
157 } // namespace internal {
158 } // namespace mesos {
159 
160 #endif // __MASTER_CONSTANTS_HPP__
Definition: master.hpp:27
constexpr Duration DEFAULT_HEARTBEAT_INTERVAL
Definition: constants.hpp:52
constexpr Bytes Megabytes(uint64_t value)
Definition: bytes.hpp:123
constexpr Duration DEFAULT_AGENT_PING_TIMEOUT
Definition: constants.hpp:60
constexpr Duration DEFAULT_REGISTRY_GC_INTERVAL
Definition: constants.hpp:103
constexpr double RECOVERY_AGENT_REMOVAL_PERCENT_LIMIT
Definition: constants.hpp:81
constexpr char MASTER_INFO_JSON_LABEL[]
Label used by the Leader Contender and Detector, for JSON content.
Definition: constants.hpp:121
constexpr char READWRITE_HTTP_AUTHENTICATION_REALM[]
Definition: constants.hpp:144
constexpr Duration ZOOKEEPER_SESSION_TIMEOUT
Definition: constants.hpp:125
Definition: duration.hpp:32
constexpr Duration DEFAULT_ALLOCATION_INTERVAL
Definition: constants.hpp:134
constexpr char READONLY_HTTP_AUTHENTICATION_REALM[]
Definition: constants.hpp:140
constexpr size_t TASK_LIMIT
Definition: constants.hpp:101
constexpr char DEFAULT_ALLOCATOR[]
Definition: constants.hpp:131
Definition: duration.hpp:221
Definition: duration.hpp:207
constexpr size_t DEFAULT_MAX_COMPLETED_TASKS_PER_FRAMEWORK
Definition: constants.hpp:91
Definition: spec.hpp:30
std::vector< MasterInfo::Capability > MASTER_CAPABILITIES()
constexpr char MASTER_INFO_LABEL[]
Label used by the Leader Contender and Detector.
Definition: constants.hpp:114
constexpr size_t DEFAULT_MAX_UNREACHABLE_TASKS_PER_FRAMEWORK
Definition: constants.hpp:95
Definition: attributes.hpp:24
constexpr Duration MIN_AGENT_REREGISTER_TIMEOUT
Definition: constants.hpp:70
constexpr char DEFAULT_AUTHENTICATOR[]
Definition: constants.hpp:128
Definition: version.hpp:41
constexpr size_t MAX_REMOVED_SLAVES
Definition: constants.hpp:84
constexpr Duration DEFAULT_REGISTRY_MAX_AGENT_AGE
Definition: constants.hpp:105
constexpr char DEFAULT_AUTHORIZER[]
Definition: constants.hpp:137
constexpr char DEFAULT_HTTP_FRAMEWORK_AUTHENTICATION_REALM[]
Definition: constants.hpp:148
constexpr size_t DEFAULT_REGISTRY_MAX_AGENT_COUNT
Definition: constants.hpp:107
constexpr size_t DEFAULT_MAX_AGENT_PING_TIMEOUTS
Definition: constants.hpp:63
constexpr size_t DEFAULT_MAX_COMPLETED_FRAMEWORKS
Definition: constants.hpp:87
Definition: bytes.hpp:30
constexpr int MAX_OFFERS_PER_FRAMEWORK
Definition: constants.hpp:42
const Version MINIMUM_AGENT_VERSION
Definition: constants.hpp:152
constexpr Duration WHITELIST_WATCH_INTERVAL
Definition: constants.hpp:98
constexpr Bytes MIN_MEM
Definition: constants.hpp:48
Definition: duration.hpp:263
constexpr double MIN_CPUS
Definition: constants.hpp:45