Skip to content

Commit

Permalink
add command line option for the inline metadata size
Browse files Browse the repository at this point in the history
  • Loading branch information
iwanbk committed Feb 20, 2025
1 parent 207729b commit 4d52381
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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.
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<usize>,

#[structopt(long, requires("secret-key"), display_order = 1000)]
access_key: Option<String>,

Expand Down Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion src/metastore/stores/fjall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<usize>) -> Self {
Expand Down

0 comments on commit 4d52381

Please sign in to comment.