Skip to content

Add quota to agent created datasets#835

Merged
leftwo merged 5 commits into
mainfrom
alan/reserve
Jul 15, 2023
Merged

Add quota to agent created datasets#835
leftwo merged 5 commits into
mainfrom
alan/reserve

Conversation

@leftwo

@leftwo leftwo commented Jul 15, 2023

Copy link
Copy Markdown
Contributor

This adds a quota and a reservation to crucible datasets created when a region
is created in the crucible agent. A somewhat arbitrary .25 overhead is reserved
for each region. 17% is the largest possible space the metadata will take, and this
gives us a little room in the unlikely event that all regions are full.

This does not consider snapshot overhead.

For issue #605

@leftwo

leftwo commented Jul 15, 2023

Copy link
Copy Markdown
Contributor Author

After a discussion with @ahl , I've updated the comments a bit, and changed the quota to be larger
than the reservation.

@leftwo leftwo requested a review from ahl July 15, 2023 05:16
Comment thread agent/src/main.rs Outdated
Comment on lines +17 to +18
* As a safety mechanism to prevent the agent from creating more regions
* than we have physical space, we using a zfs reservation on each dataset

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* As a safety mechanism to prevent the agent from creating more regions
* than we have physical space, we using a zfs reservation on each dataset
* As a safety mechanism to prevent the agent from allocating more space to regions
* than we have physical space on disk, we using a zfs reservation on each dataset

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread agent/src/main.rs Outdated
Comment on lines +19 to +21
* we create. While not a complete solution, it does help in some
* situations to avoid allocation of a region that we don't have the
* space for if that region was to fill up.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* we create. While not a complete solution, it does help in some
* situations to avoid allocation of a region that we don't have the
* space for if that region was to fill up.
* we create. While it does prevent us from allocating more space to regions than the disk could accommodate, it is not a complete solution in that we ideally would like Nexus to track allocations (for crucible and other significant datasets), an adequate capacity margin to ensure that disk performance doesn't become pathological, and monitors any over-use for appropriate mitigation (migration, termination, etc).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread agent/src/main.rs Outdated
Comment on lines +27 to +29
* In addition, we throw a quota of 3x the region size. If the region
* has grown that big, then something is wrong and we should prevent it
* from growing any larger and impacting other regions in the dataset.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* In addition, we throw a quota of 3x the region size. If the region
* has grown that big, then something is wrong and we should prevent it
* from growing any larger and impacting other regions in the dataset.
* In addition, we throw a quota of 3x the region size. The failure modes of exhausting the quota are potentially severe and not (as yet) well-tested so we want some buffer between the reservation and the quota. If the region
* has grown that big however, something is potentially very wrong and we should prevent it
* from growing any larger and impacting other regions on the disk.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread agent/src/main.rs Outdated
Comment on lines +31 to +32
const METADATA_BUFFER: f64 = 1.25;
const REGION_QUOTA: u64 = 3;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe: RESERVATION_FACTOR and QUOTA_FACTOR? I leave it to you... just a thought

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yeah, I tried RESERVATION_MULTIPLIER and that felt wrong.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread agent/src/main.rs
}

// If requested, set a quota and reservation here.
if let Some(reservation) = reservation {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest we might want something like this:

        let mut cmd = std::process::Command::new("zfs")
            .arg("create");

    if let Some(reservation) = reservation {
        cmd = cmd.arg("-o").arg(format!("reservation={}", reservation));
    }

        cmd = cmd
            .arg(&dataset)
            .output()?;

i.e. I think you can create the dataset with the properties preset.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I like it. Fewer lines of code and easier cleanup.

Alan Hanson added 2 commits July 15, 2023 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants