37 Commits

Author SHA1 Message Date
Michael Smithhisler
d95a3766ae client: fix client blocking during garbage collection (#25123)
This change removes any blocking calls to destroyAllocRunner, which
caused nomad clients to block when running allocations in certain
scenarios. In addition, this change consolidates client GC by removing
the MakeRoomFor method, which is redundant to keepUsageBelowThreshold.

---------

Co-authored-by: Tim Gross <tgross@hashicorp.com>
2025-03-19 14:32:46 -04:00
hashicorp-copywrite[bot]
2d35e32ec9 Update copyright file headers to BUSL-1.1 2023-08-10 17:27:15 -05:00
Seth Hoenig
a4cc76bd3e numa: enable numa topology detection (#18146)
* client: refactor cgroups management in client

* client: fingerprint numa topology

* client: plumb numa and cgroups changes to drivers

* client: cleanup task resource accounting

* client: numa client and config plumbing

* lib: add a stack implementation

* tools: remove ec2info tool

* plugins: fixup testing for cgroups / numa changes

* build: update makefile and package tests and cl
2023-08-10 17:05:30 -05:00
Tim Gross
88323bab4a allocrunner: provide factory function so we can build mock ARs (#17161)
Tools like `nomad-nodesim` are unable to implement a minimal implementation of
an allocrunner so that we can test the client communication without having to
lug around the entire allocrunner/taskrunner code base. The allocrunner was
implemented with an interface specifically for this purpose, but there were
circular imports that made it challenging to use in practice.

Move the AllocRunner interface into an inner package and provide a factory
function type. Provide a minimal test that exercises the new function so that
consumers have some idea of what the minimum implementation required is.
2023-05-12 13:29:44 -04:00
hashicorp-copywrite[bot]
f005448366 [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
James Rasell
3bffe443ac chore: fix incorrect docstring formatting. 2021-08-30 11:08:12 +02:00
Alex Dadgar
270ae48b82 Plugins use parent loggers
This PR fixes various instances of plugins being launched without using
the parent loggers. This meant that logs would not all go to the same
output, break formatting etc.
2019-01-11 11:36:37 -08:00
Danielle Tomlinson
6f636ea15a gc: Wait for allocrunners to be destroyed 2018-12-18 23:38:33 +01:00
Michael Schurter
9da25adc54 client: hclog-ify most of the client
Leaving fingerprinters in case that interface changes with plugins.
2018-10-16 16:53:30 -07:00
Michael Schurter
53a4b3fe99 example redis job "runs" on arv2! see below
Tons left to do and lots of churn:
1. No state saving
2. No shutdown or gc
3. Removed AR factory *for now*
4. Made all "Config" structs local to the package they configure
5. Added allocID to GC to avoid a lookup

Really hating how many things use *structs.Allocation. It's not bad
without state saving, but if AllocRunner starts updating its copy things
get racy fast.
2018-10-16 16:53:29 -07:00
Alex Dadgar
5e67b37aad use int64 2018-10-16 15:34:32 -07:00
Preetha Appan
3ca71ae935 Change CPU/Disk/MemoryMB to int everywhere in new resource structs 2018-10-16 16:21:42 -05:00
Alex Dadgar
0f2f4797cb fixing tests 2018-10-04 14:26:19 -07:00
Alex Dadgar
a62e412b88 Refactor - wip 2018-06-12 10:23:45 -07:00
Josh Soref
c77b05aebd spelling: terminated 2018-03-11 19:01:49 +00:00
Josh Soref
672d51b774 spelling: parallelism 2018-03-11 18:35:54 +00:00
Michael Schurter
e93d625d44 Remove noisy log line
Didn't mean to commit this
2017-11-03 16:00:30 -07:00
Michael Schurter
cb3a03c829 Make unable-to-gc log level adaptive
WARNing when someone has over 50 non-terminal allocs was just too
confusing.

Tested manually with `gc_max_allocs = 10` and bumping a job from `count
= 19` to `count = 21`:

```
2017/11/02 17:54:21.076132 [INFO] client.gc: garbage collection due to number of allocations (19) is over the limit (10) skipped because no terminal allocations
...
2017/11/02 17:54:48.634529 [WARN] client.gc: garbage collection due to number of allocations (21) is over the limit (10) skipped because no terminal allocations
```
2017-11-02 10:57:42 -07:00
Michael Schurter
ec43315e13 Fix regression by returning error on unknown alloc 2017-11-01 15:16:38 -05:00
Michael Schurter
fb3a780b7a Trigger GCs after alloc changes
GC much more aggressively by triggering GCs when allocations become
terminal as well as after new allocations are added.
2017-11-01 15:16:38 -05:00
Michael Schurter
9c1e595e2e Fix GC'd alloc tracking
The Client.allocs map now contains all AllocRunners again, not just
un-GC'd AllocRunners. Client.allocs is only pruned when the server GCs
allocs.

Also stops logging "marked for GC" twice.
2017-11-01 15:16:38 -05:00
Michael Schurter
0f584a0143 initial attempt at refactoring blocked/migrating 2017-08-11 16:21:35 -07:00
Luke Farnell
7a56971508 fixed all spelling mistakes for goreport 2017-08-07 17:13:05 -04:00
Michael Schurter
cc11d9a563 Add new gc_max_allocs tuneable
More than gc_max_allocs may be running on a node, but terminal allocs
will be garbage collected to try to keep the total number below the
limit.
2017-05-11 17:18:02 -07:00
Alex Dadgar
38ebed5e0e Review fixes 2017-03-14 10:45:15 -07:00
Alex Dadgar
050cdd5b14 remove escape 2017-03-10 16:46:22 -08:00
Alex Dadgar
701537e9c5 Limit parallelism during garbage collection
This PR introduces a parallelism limit during garbage collection. This
is used to avoid large resource usage spikes if garbage collecting many
allocations at once.
2017-03-10 16:27:00 -08:00
Diptanu Choudhury
6b0a1ebb58 Making the GC related fields tunable 2017-01-31 15:51:20 -08:00
Alex Dadgar
47d48bdaee Fix nil dereference 2017-01-10 14:14:58 -08:00
Diptanu Choudhury
6f978dd051 Removing the alloc runner from GC if it is destroyed by the server 2016-12-20 11:14:22 -08:00
Diptanu Choudhury
7ebe4a6972 Added comments 2016-12-20 10:49:48 -08:00
Diptanu Choudhury
6143d8dbbd Added tests 2016-12-19 13:21:47 -08:00
Diptanu Choudhury
61e534d684 Making the gc allocator understand real disk usage 2016-12-16 18:34:59 -08:00
Diptanu Choudhury
79fdad86c3 Added the stats collector to GC 2016-12-14 15:11:11 -08:00
Diptanu Choudhury
41d7ebc5c5 Refactored hoststats collector 2016-12-14 15:07:42 -08:00
Diptanu Choudhury
a38201a220 GC-ing before we start a new allocation 2016-12-14 15:04:06 -08:00
Diptanu Choudhury
615fbbe17a Added a garbage collector for allocations 2016-12-14 15:01:12 -08:00