Merge pull request #448 from robertbaldyga/perqueue-seq-cutoff

Per-queue multi-stream sequential cutoff
This commit is contained in:
Michał Mielewczyk
2021-03-05 14:38:21 +01:00
committed by GitHub
15 changed files with 360 additions and 62 deletions

View File

@@ -45,6 +45,7 @@ class CoreConfig(Structure):
("_volume_type", c_uint8),
("_try_add", c_bool),
("_seq_cutoff_threshold", c_uint32),
("_seq_cutoff_promotion_count", c_uint32),
("_user_metadata", UserMetadata),
]
@@ -52,6 +53,7 @@ class CoreConfig(Structure):
class Core:
DEFAULT_ID = 4096
DEFAULT_SEQ_CUTOFF_THRESHOLD = 1024 * 1024
DEFAULT_SEQ_CUTOFF_PROMOTION_COUNT = 8
def __init__(
self,
@@ -59,6 +61,7 @@ class Core:
try_add: bool,
name: str = "core",
seq_cutoff_threshold: int = DEFAULT_SEQ_CUTOFF_THRESHOLD,
seq_cutoff_promotion_count: int = DEFAULT_SEQ_CUTOFF_PROMOTION_COUNT,
):
self.cache = None
self.device = device
@@ -76,6 +79,7 @@ class Core:
_volume_type=self.device.type_id,
_try_add=try_add,
_seq_cutoff_threshold=seq_cutoff_threshold,
_seq_cutoff_promotion_count=seq_cutoff_promotion_count,
_user_metadata=UserMetadata(_data=None, _size=0),
)

View File

@@ -71,7 +71,7 @@ def test_seq_cutoff_max_streams(pyocf_ctx):
handled by cache. It should no longer be tracked by OCF, because of request in step 3. which
overflowed the OCF handling structure)
"""
MAX_STREAMS = 256
MAX_STREAMS = 128
TEST_STREAMS = MAX_STREAMS + 1 # Number of streams used by test - one more than OCF can track
core_size = Size.from_MiB(200)
threshold = Size.from_KiB(4)
@@ -91,7 +91,7 @@ def test_seq_cutoff_max_streams(pyocf_ctx):
streams.remove(non_active_stream)
cache = Cache.start_on_device(Volume(Size.from_MiB(200)), cache_mode=CacheMode.WT)
core = Core.using_device(Volume(core_size))
core = Core.using_device(Volume(core_size), seq_cutoff_promotion_count=1)
cache.add_core(core)