From 4d5238171cd0104b0b6ab0479de9877aa71d635d Mon Sep 17 00:00:00 2001 From: Iwan BK Date: Thu, 20 Feb 2025 10:53:56 +0700 Subject: [PATCH] add command line option for the inline metadata size --- README.md | 22 ++++++++++++++++++---- src/main.rs | 5 ++++- src/metastore/stores/fjall.rs | 2 +- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ce6c8cd..38afff3 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,26 @@ cd s3-cas cargo build --release --features binary ``` +## Inline metadata + +Objects smaller than or equal to a configurable threshold can be stored directly in their metadata records, +improving performance for small objects. + +Configure this feature using the command-line option: +```console +--inline-metadata-size # omit to disable inlining +``` + +When the size is set: +- If the size of object data + metadata smaller than or equal to the threshold, the object data is stored in the metadata, + otherwise use the standard block storage +- Setting size to 0 or omitting the option disables inlining completely + +Currently, objects uploaded using the multipart method will never be inlined +because they are assumed to be large objects. + ## Known issues -- The metadata database (sled) has unbounded memory growth related to the objects stored. This means - the server will eventually consume all memory on the host and crash. To fix this the metadata database - should either be replaced with a new version of sled (still in development) or a different one entirely - Only the basic API is implemented, and even then it is not entirely implemented (for instance copy between servers is not implemented). -- The codebase is very much POC and not following a good abstraction structure - Single key only, no support to add multiple keys with different permissions. diff --git a/src/main.rs b/src/main.rs index f9f096d..784380e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,6 +31,9 @@ struct Args { #[structopt(long, default_value = "9100")] metric_port: u16, + #[structopt(long, help = "leave empty to disable it")] + inline_metadata_size: Option, + #[structopt(long, requires("secret-key"), display_order = 1000)] access_key: Option, @@ -71,7 +74,7 @@ async fn run(args: Args) -> anyhow::Result<()> { args.meta_root.clone(), metrics.clone(), storage_engine, - None, + args.inline_metadata_size, ); let s3fs = s3_cas::s3fs::S3FS::new(args.fs_root, args.meta_root, casfs, metrics.clone()); let s3fs = s3_cas::metrics::MetricFs::new(s3fs, metrics.clone()); diff --git a/src/metastore/stores/fjall.rs b/src/metastore/stores/fjall.rs index f959279..b82f0e2 100644 --- a/src/metastore/stores/fjall.rs +++ b/src/metastore/stores/fjall.rs @@ -26,7 +26,7 @@ impl std::fmt::Debug for FjallStore { } } -const DEFAULT_INLINED_METADATA_SIZE: usize = 1024; +const DEFAULT_INLINED_METADATA_SIZE: usize = 1; // setting very low will practically disable it by default impl FjallStore { pub fn new(path: PathBuf, inlined_metadata_size: Option) -> Self {