f8596a3602
Fixes #7681 The current behavior of the CPU fingerprinter in AWS is that it reads the **current** speed from `/proc/cpuinfo` (`CPU MHz` field). This is because the max CPU frequency is not available by reading anything on the EC2 instance itself. Normally on Linux one would look at e.g. `sys/devices/system/cpu/cpuN/cpufreq/cpuinfo_max_freq` or perhaps parse the values from the `CPU max MHz` field in `/proc/cpuinfo`, but those values are not available. Furthermore, no metadata about the CPU is made available in the EC2 metadata service. https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-categories.html Since `go-psutil` cannot determine the max CPU speed it defaults to the current CPU speed, which could be basically any number between 0 and the true max. This is particularly bad on large, powerful reserved instances which often idle at ~800 MHz while Nomad does its fingerprinting (typically IO bound), which Nomad then uses as the max, which results in severe loss of available resources. Since the CPU specification is unavailable programmatically (at least not without sudo) use a best-effort lookup table. This table was generated by going through every instance type in AWS documentation and copy-pasting the numbers. https://aws.amazon.com/ec2/instance-types/ This approach obviously is not ideal as future instance types will need to be added as they are introduced to AWS. However, using the table should only be an improvement over the status quo since right now Nomad miscalculates available CPU resources on all instance types. |
||
---|---|---|
.. | ||
allocdir | ||
allochealth | ||
allocrunner | ||
allocwatcher | ||
config | ||
consul | ||
devicemanager | ||
dynamicplugins | ||
fingerprint | ||
interfaces | ||
lib | ||
logmon | ||
pluginmanager | ||
servers | ||
state | ||
stats | ||
structs | ||
taskenv | ||
testutil | ||
vaultclient | ||
acl.go | ||
acl_test.go | ||
agent_endpoint.go | ||
agent_endpoint_test.go | ||
alloc_endpoint.go | ||
alloc_endpoint_test.go | ||
alloc_watcher_e2e_test.go | ||
client.go | ||
client_stats_endpoint.go | ||
client_stats_endpoint_test.go | ||
client_test.go | ||
csi_endpoint.go | ||
csi_endpoint_test.go | ||
driver_manager_test.go | ||
fingerprint_manager.go | ||
fingerprint_manager_test.go | ||
fs_endpoint.go | ||
fs_endpoint_test.go | ||
gc.go | ||
gc_test.go | ||
node_updater.go | ||
rpc.go | ||
rpc_test.go | ||
testing.go | ||
util.go | ||
util_test.go |