Skip to main content

Stressor

Struct Stressor 

Source
pub struct Stressor { /* private fields */ }
Expand description

Designed to ‘exercise’ the filesystem and thrash the dirent cache. This cyclically works its way through 10000 files (the dirent cache holds 8000).

On each iteration it will either read, write or rewrite a file. Unaligned random reads and append-only writes up to 128kB each in length. Write errors causes the file to be truncated to zero bytes.

The file order is partially permuted each time (only those files which are known not to be in the dirent cache) to reduce cyclic write/delete patterns.

The truncation of files when we hit the target limit is also randomized to avoid introducing cyclic patterns (n writes, truncate, n writes, truncate, …).

Despite these measures, we still expect to see some cyclic behaviour. Each pass has equal probability of read or write. It takes about 3 writes to reach 150kB (the average size before we hit target bytes of 1.5GB) so we can assume n reads, n writes, n/3 truncates in steady state.

n + n + n/3 = 10000 n = 30000 / 7 = 4285

On average, 4285/3 = ~1500 files are truncated each pass. Assuming an average file size, this is around 220MB or 14%. Best case it will take 7 passes to rewrite all data, but we can assume that most of the data will be rewritten in a few dozen passes.

Each pass anecdotally takes between 2 and 20 seconds depending on system load, allocation strategy and fragmentation.

Implementations§

Source§

impl Stressor

Source

pub fn new(path_prefix: &str, target_free_bytes: u64) -> Arc<Self>

Creates a new aggressive stressor that will try to fill the disk until target_free_bytes of free space remains.

Source

pub fn run(self: &Arc<Self>, num_threads: usize)

Starts the stressor. Loops forever.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V