Skip to navigation

Storage services

View as MarkdownOpen in Claude

Table of Contents

Storage Services

By default, buckets inherit global configuration. However, several distinct sections of this global configuration can be overridden at startup or at runtime on a per bucket basis. The list includes checksumming, LRU, erasure coding, local mirroring, and chunking - please see the following sections for details.

Notation

In this document, G - denotes a (hostname:port) pair of any gateway in the AIS cluster.

Checksumming

All cluster and object-level metadata is protected by checksums. Secondly, unless user explicitly disables checksumming for a given bucket, all user data stored in this bucket is also protected.

For detailed overview, theory of operations, and supported checksumms, please see this document.

Example: configuring checksum properties for a bucket:

$ ais bucket props <bucket-name> checksum.validate_cold_get=true checksum.validate_warm_get=false checksum.type=xxhash checksum.enable_read_range=false

For more examples, please to refer to supported checksums and brief theory of operations.

LRU and Space

LRU (Least Recently Used) eviction is configured in the lru section of the cluster configuration (ais config cluster lru):

FieldDefaultDescription
lru.enabledfalsedefault for remote buckets added to the cluster (see below)
lru.dont_evict_time2heviction-free period [atime, atime + dont_evict_time]; minimum 1h
lru.capacity_upd_time10mmaximum interval between capacity updates; the interval shrinks toward periodic.stats_time as used capacity grows
lru.batch_size32768number of objects per eviction batch

lru.enabled is also a per-bucket property, and that is what determines eviction:

  • a remote bucket inherits the cluster’s lru.enabled once, when it is added to the cluster; later changes of the cluster setting do not affect existing buckets
  • an ais:// bucket always starts with LRU disabled - with or without a remote backend
  • to make a bucket evictable, enable LRU explicitly (e.g., ais bucket lru BUCKET --enable; see also the example below)

A bucket is eligible for automatic eviction when its lru.enabled is true and its access permissions allow deleting objects. Eviction age comes from the bucket’s lru.dont_evict_time; batch size comes from the cluster configuration.

Space watermarks

Space watermarks are cluster-wide (ais config cluster space). Each target compares them with the used capacity of its fullest mountpath; mountpaths that share a filesystem are counted once.

WatermarkDefaultDescription
space.cleanupwm65above this level, the target removes deleted buckets and objects (full storage cleanup runs above highwm, or on demand via ais storage cleanup)
space.lowwm75LRU evicts until used capacity drops to this level
space.highwm90above this level, the target runs storage cleanup and then, if still above, LRU; data-producing jobs (prefetch, copy, transform, etc.) and bucket-property updates are rejected (except those that free up space, e.g., enabling LRU)
space.out_of_space95above this level, PUTs and cold GETs fail with 507 (insufficient storage)

Capacity reads refresh the shared capacity cache on demand, once it expires.

The expiration interval shrinks as used capacity grows:

  • from lru.capacity_upd_time (low utilization)
  • to periodic.stats_time (approaching highwm);

Above highwm, it is disk.iostat_time_short times the remaining percentage points to out_of_space (at least one), within [100ms, periodic.stats_time].

Concurrent internal readers reuse the (capacity) cache while a refresh is running. Updating space.* (or any of the intervals above) expires the cache, so new watermarks apply to the next PUT.

Storage cleanup and LRU are triggered by periodic capacity checks (and upon capacity errors in data-producing jobs).

Notes:

  • LRU evicts only from eligible buckets (see above).
  • At out_of_space, a warm GET still succeeds, unless it turns into a cold GET (e.g., --latest or versioning.validate_warm_get with a newer remote version).
  • A GET with --blob-download checks capacity first and fails above highwm, even for an object already in the cluster.
  • Out-of-space errors stop as soon as used capacity drops to out_of_space or below.

See also:

Example setting space properties

Lower the cleanup, low, and high watermarks (out_of_space stays at 95), and enable LRU by default for remote buckets added from now on (existing buckets are not affected):

$ ais config cluster space.cleanupwm=40 space.lowwm=45 space.highwm=50 lru.enabled=true lru.dont_evict_time=1h

Example enabling LRU eviction for a given bucket

$ ais create ais://nnn
"ais://nnn" created
$ ais bucket props <TAB-TAB>
set reset show
$ ais bucket props set ais://nnn lru.enabled
PROPERTY VALUE
lru.enabled false
$ ais bucket props set ais://nnn lru.enabled true
"lru.enabled" set to: "true" (was: "false")
Bucket props successfully updated.

Erasure coding

AIStore provides data protection that comes in several flavors: end-to-end checksumming, n-way mirroring, replication (for small objects), and erasure coding.

Erasure coding, or EC, is a well-known storage technique that protects user data by dividing it into D fragments or slices, computing P redundant (parity) slices, and then storing the resulting (D+P) slices on (D+P) storage servers - one slice per target server.

EC schemas are flexible and user-configurable: users can select the D and the P (above), thus ensuring that user data remains available even if the cluster loses any (emphasis on the any) of its P servers.

A bucket inherits EC settings from global configuration. But it can be overridden on a per bucket basis.

$ ais start ec-encode --help
NAME:
ais start ec-encode - erasure code entire bucket, e.g.:
- 'ais start ec-encode ais://nnn -d 8 -p 2' - erasure-code ais://nnn for 8 data and 2 parity slices;
- 'ais start ec-encode ais://nnn --data-slices 8 --parity-slices 2' - same as above;
- 'ais start ec-encode ais://nnn --recover' - check and make sure that every ais://nnn object is properly erasure-coded.
see also: 'ais start mirror'
USAGE:
ais start ec-encode BUCKET [command options]
OPTIONS:
--data-slices value, -d value number of data slices (default: 2)
--parity-slices value, -p value number of parity slices (default: 2)
--non-verbose, --nv non-verbose (quiet) output, minimized reporting, fewer warnings
--recover check and make sure that each and every object is properly erasure coded
--help, -h show help
  • ec.enabled: bool - enables or disabled data protection the bucket
  • ec.data_slices: integer in the range [2, 100], representing the number of fragments the object is broken into
  • ec.parity_slices: integer in the range [2, 32], representing the number of redundant fragments to provide protection from failures. The value defines the maximum number of storage targets a cluster can lose but it is still able to restore the original object
  • ec.objsize_limit: integer indicating the minimum size of an object that is erasure encoded. Smaller objects are just replicated.
  • ec.compression: string that contains rules for LZ4 compression used by EC when it sends its fragments and replicas over network. Value “never” disables compression. Other values enable compression: it can be “always” - use compression for all transfers, or list of compression options, like “ratio=1.5” that means “disable compression automatically when compression ratio drops below 1.5”

Choose the number data and parity slices depending on the required level of protection and the cluster configuration.

The number of storage targets must be greater than the sum of the number of data and parity slices. If the cluster uses only replication (by setting objsize_limit to a very high value), the number of storage targets must exceed the number of parity slices.

Global rebalance supports erasure-coded buckets.

Notes:

Every data and parity slice is stored on a separate storage target. To reconstruct a damaged object, AIStore requires at least ec.data_slices slices in total out of data and parity sets Small objects are replicated ec.parity_slices times to have the same level of data protection that big objects do Increasing the number of parity slices improves data protection level, but it may hit performance: doubling the number of slices approximately increases the time to encode the object by a factor of two

Example setting bucket properties

$ ais bucket props ais://<bucket-name> lru.lowwm=1 lru.highwm=90 ec.enabled=true ec.data_slices=4 ec.parity_slices=2

To change only one EC property(e.g, enable or disable EC for a bucket) without touching other bucket properties, use the single set property API. Example of disabling EC:

$ ais bucket props ais://<bucket-name> ec.enabled=true

or using AIS CLI utility:

enable EC for a bucket with custom number of data and parity slices. It should be done using 2 commands: the first one changes the numbers while EC is disabled, and the second one enables EC with new slice count:

$ ais bucket props mybucket ec.data_slices=3 ec.parity_slices=3
$ ais bucket props mybucket ec.enabled=true

check that EC properties are applied:

$ ais show bucket mybucket ec
PROPERTY VALUE
ec 3:3 (256KiB)

Limitations

Once a bucket is configured for EC, it’ll stay erasure coded for its entire lifetime - there is currently no supported way to change this once-applied configuration to a different (N, K) schema, disable EC, and/or remove redundant EC-generated content.

Only option ec.objsize_limit can be changed if EC is enabled. Modifying this property requires force flag to be set.

Note that after changing any EC option the cluster does not re-encode existing objects. The existing objects are rebuilt only after the objects are changed(rename, put new version etc).

N-way mirror

Yet another supported storage service is n-way mirroring providing for bucket-level data redundancy and data protection. The service makes sure that each object in a given distributed (local or Cloud) bucket has exactly n object replicas, where n is an arbitrary user-defined integer greater or equal 1.

In other words, AIS n-way mirroring is intended to withstand loss of disks, not storage nodes (aka AIS targets).

For the latter, please consider using #erasure-coding and/or any of the alternative backup/restore mechanisms.

The service ensures is that for any given object there will be no two replicas sharing the same local disk.

Unlike erasure coding that takes care of distributing redundant content across different clustered nodes, local mirror is, as the name implies, local. When a bucket is configured as a mirror, objects placed into this bucket get locally replicated and the replicas are stored in local filesystems.

As aside, note that AIS storage targets can be deployed to utilize Linux LVMs that provide a variety of RAID/mirror schemas.

The following example configures buckets a, b, and c to store n = 1, 2, and 3 object replicas, respectively:

$ ais start mirror --copies 1 ais://a
$ ais start mirror --copies 2 ais://b
$ ais start mirror --copies 3 ais://c

The operations (above) are in fact extended actions that run asynchronously. Both Cloud and ais buckets are supported. You can monitor completion of those operations via generic xaction API.

Subsequently, all PUTs into an n-way configured bucket also generate n copies for all newly created objects. Which also goes to say that the (“make-n-copies”) operation, in addition to creating or destroying replicas of existing objects will also automatically re-enable(if n > 1) or disable (if n == 1) mirroring as far as subsequent PUTs are concerned.

Note again that number of local replicas is defined on a per-bucket basis.

Read load balancing

With respect to n-way mirrors, the usual pros-and-cons consideration boils down to (the amount of) utilized space, on the other hand, versus data protection and load balancing, on the other.

Since object replicas are end-to-end protected by checksums all of them and any one in particular can be used interchangeably to satisfy a GET request thus providing for multiple possible choices of local filesystems and, ultimately, local drives. Given n > 1, AIS will utilize the least loaded drive(s).

Another n-way example

The following sequence creates a bucket named abc, PUTs an object into it and then converts it into a 3-way mirror:

$ ais create ais://abc
$ ais put /tmp/obj1 ais://abc/obj1
$ ais start mirror --copies 3 ais://abc

The next command will redefine the abc bucket created in the previous example as a 2-way mirror - all objects that were previously stored in three replicas will now have only two (replicas):

$ ais start mirror --copies 2 ais://abc

Data redundancy: summary of the available options (and considerations)

Any of the supported options can be utilized at any time (and without downtime) - the list includes:

  1. cloud backend - Backend Bucket
  2. mirroring - N-way mirror
  3. copying - Copy (list, range, and/or prefix) selected objects or entire (in-cluster or remote) buckets
  4. erasure coding - Erasure coding

For instance, you first could start with plain mirroring via ais start mirror BUCKET --copies N, where N would be less or equal the number of target mountpaths (disks).

It is generally assumed (and also strongly recommended) that all storage servers (targets) in AIS cluster have the same number of disks and are otherwise identical.

Copies will then be created on different disks of each storage target - for all already stored and future objects in a given bucket.

This option won’t protect from node failures but it will provide a fairly good performance for writes and load balancing - for reads. As far as data redundancy, N-way mirror protects from failures of up to (N-1) disks in a storage server.

It is the performance and the fact that probabilities of disk failures are orders of magnitude greater than node failures makes this “N-way mirror” option attractive, possibly in combination with periodic backups.

Further, you could at some point in time decide to associate a given AIS bucket with a Cloud (backend) bucket, thus making sure that your data is stored in one of the AIS-supported Clouds: Amazon S3, Google Cloud Storage, Azure Blob Storage, and/or Oracle (OCI) Object Storage.

Finally, you could erasure code (EC) a given bucket for D + P redundancy, where D and P are, respectively, the numbers of data and parity slices:

$ ais start ec-encode --help
NAME:
ais start ec-encode - erasure code entire bucket, e.g.:
- 'ais start ec-encode ais://nnn -d 8 -p 2' - erasure-code ais://nnn for 8 data and 2 parity slices;
- 'ais start ec-encode ais://nnn --data-slices 8 --parity-slices 2' - same as above;
- 'ais start ec-encode ais://nnn --recover' - check and make sure that every ais://nnn object is properly erasure-coded.
see also: 'ais start mirror'
USAGE:
ais start ec-encode BUCKET [command options]
OPTIONS:
--data-slices value, -d value number of data slices (default: 2)
--parity-slices value, -p value number of parity slices (default: 2)
--non-verbose, --nv non-verbose (quiet) output, minimized reporting, fewer warnings
--recover check and make sure that each and every object is properly erasure coded
--help, -h show help

Erasure-coding: with and without recovery

Assuming, ais://abc is not erasure-coded (or its erasure-coding property is disabled):

$ ais start ec-encode ais://abc -d 8 -p 2
## or, same:
##
$ ais start ec-encode ais://abc --data-slices 8 --parity-slices 2

This will erasure-code all objects in the ais://abc bucket for the total of 10 slices stored on different AIS targets, plus 1 (one) full replica. In other words, this example requires at least 10 + 1 = 11 targets in the cluster.

Generally, D + P erasure coding requires that AIS cluster has D + P + 1 targets, or more.

In addition to Reed-Solomon encoded slices, we currently always store a full replica - the strategy that uses available capacity but pays back with read performance.

Example recovering lost or damaged slices and objects

But what if there’s an accident that involves corrupted or deleted data, lost disks, and/or entire nodes?

Well, erasure-coding supports a special recovery mode to “check and make sure that each and every object is properly erasure coded.”

$ ais start ec-encode ais://abc --recover
## or same, assuming the bucket is (D=8, P=2) erasure-coded:
##
$ ais start ec-encode ais://abc --data-slices 8 --parity-slices 2

Chunking

AIS fully supports chunking - storing an object as a sequence of chunks described by a manifest, rather than a single contiguous file (monolithic). Like n-way mirroring and erasure coding, it is governed by bucket configuration. A bucket’s chunks properties are the authoritative record of its intended storage layout. Administrative jobs that operate on many objects converge the data to that configuration, just as re-mirroring and re-encoding follow the bucket’s mirror and ec properties.

The relevant properties are:

PropertyMeaning
chunks.objsize_limitAuto-chunking threshold; 0 disables auto-chunking (soft limit)
chunks.max_monolithic_sizeMaximum size of a monolithic object; cannot be disabled (hard limit)
chunks.chunk_sizeChunk size used whenever the bucket’s configuration requires chunking

Explicit per-object overrides remain supported: client-side multipart PUT, S3 multipart upload (stored using the client’s part sizes), and a single-object blob download (started explicitly or selected via api.GetArgs.BlobThreshold). Each is a deliberate, advanced choice scoped to one object and uses the operation’s chunk size, or its default when omitted.

Storage layout

For a given object size:

  1. Above chunks.max_monolithic_size: chunked, with chunks.chunk_size.
  2. Otherwise, when auto-chunking is enabled and the size is at or above chunks.objsize_limit: chunked, with chunks.chunk_size.
  3. Otherwise: monolithic - except for the explicit per-object overrides above and the prefetch exception below.

A layout rule is independent of how the object arrives. It applies equally to PUT, cold GET, copy, append flush, promote, and rechunk.

Status (v5.1): rule 1 is enforced by PUT, cold GET, and copy; rechunk enforces it only for the objects it rewrites - an existing monolithic object above chunks.max_monolithic_size (e.g., after lowering it) is left as is. Rule 2 is enforced by rechunk only; PUT, cold GET, and copy do not auto-chunk at chunks.objsize_limit.

Status (v5.2): PUT, cold GET, copy, and rechunk enforce both rules.

Status (v5.3): Append flush and promote also enforce both rules.

Parallel cold GET

A user GET (native or S3) of a cold object in an auto-chunked bucket can fetch remote ranges in parallel when the object is at or above chunks.objsize_limit and the minimum size for parallel cold GET, and spans at least two chunks. Parallel reads also require an available remote version pin and sufficient target resources.

Readers fetch chunks concurrently, up to chunks.cold_readers per GET (4 by default), all pinned to the same remote version. When the remote supplies a whole-object checksum, parallel cold GET stores it as is, the same as a sequential cold GET. Otherwise, it combines per-chunk CRC32C checksums in object order, even when chunks arrive out of order, without rereading the data. Buckets with checksumming disabled remain without a payload checksum.

Jobs keep their own logic: prefetch chooses between the blob downloader and a sequential cold GET (see Prefetch mechanism), and copy, transform, and other jobs read sequentially.

Parallel cold GET is disabled for checksum.validate_cold_get, EC-enabled buckets, and the OCI backend.

If a range read fails with HTTP 412 (the remote object changed), AIS discards the partial result and refetches the object once with a fresh sequential GET, before sending data to the client.

The same sequential refetch applies when a range read returns HTTP 429 or 503 in a bucket without backend rate limiting. Throttling on the initial full GET, or on a blob download range read, also starts target-wide backoff. During backoff, cold GETs for buckets without backend rate limiting stay sequential for twice timeout.cold_get_conflict (10s by default), with a 5s minimum and timeout.max_host_busy as the maximum. See Reading large objects from remote buckets for how this interacts with the rate limiter.

For large objects, use a chunks.chunk_size of 128–256 MiB. The object must span multiple chunks for parallelism; the number of readers is at most the number of chunks.

Rechunk

Changing a bucket’s chunk layout automatically starts rechunk to converge existing objects to the rules above.

$ ais bucket props set ais://abc chunks.chunk_size=16MiB chunks.objsize_limit=50MiB

ais bucket rechunk can also be run explicitly. The --prefix option restricts the job to a subset of objects, for incremental conversion - not to apply a different policy to part of the bucket.

Rechunk started by a properties change continues past per-object failures; an explicit ais bucket rechunk stops at the first failure unless run with --cont-on-err. Out of space aborts the job in either case. The job’s control message (ais show job rechunk) reports skipped (monolithic objects that stay monolithic, and mirror copies), matched (chunked objects already at the configured chunk size), processed (objects rewritten), and failed.

Per-job --chunk-size and --objsize-limit overrides, deprecated in v5.1, are removed in v5.2, along with apc.RechunkMsg.ChunkSize and ObjSizeLimit. Set the bucket’s chunks properties instead; rechunk always converges to that configuration. See Removed and Deprecated APIs.

Prefetch mechanism

Prefetch selects, per object, how to fetch it from the remote backend - a regular cold GET, or the blob downloader, which retrieves byte ranges in parallel. The prefetch blob-threshold expresses that intent; it does not prescribe storage layout.

As of v5.2:

  • blob-threshold == 0: regular cold GET.
  • With blob-threshold > 0 and bucket auto-chunking enabled: blob download only at or above max(blob-threshold, chunks.objsize_limit), using chunks.chunk_size.
  • With auto-chunking disabled: blob download at or above blob-threshold > 0, producing a chunked object; the job warns once.
  • A regular cold GET can still store the result chunked when the storage layout rules require it.

The third case is a deliberate exception to rule 3. A chunks.objsize_limit of zero does express a layout preference - automatic writes remain monolithic - but reassembling parallel-fetched ranges into a monolithic file degrades performance. Prefetch therefore keeps the chunked result, uses the prefetch blob-chunk-size (or the blob-downloader default), and suggests ais bucket rechunk, which restores such objects to monolithic form per the bucket’s configuration.

Status (v5.1): prefetch uses the blob downloader at or above blob-threshold regardless of bucket configuration, with blob-chunk-size or the blob-downloader default.

The prefetch request accepts an optional tid query parameter, repeated once per target ID (?tid=t1&tid=t2), to run on the specified active targets and fetch only objects assigned to them. Omitting the parameter preserves prefetch on all active targets. Duplicate IDs, empty IDs, unknown nodes, proxies, targets in maintenance or decommission, and a malformed query string are rejected before the job starts. A misspelled parameter name is ignored, and the job runs on all targets.

Rolling upgrades: during an upgrade from 5.2 to 5.3, proxies can run different versions. A 5.2 proxy ignores tid and runs prefetch on all targets.

Chunked writes and cleanup on failure

AIS can write chunks during a regular PUT, a cold GET that caches a remote object, an object copy, append flush, or promote. The bucket’s chunking configuration determines when these operations must store an object as chunks; see storage layout for the current rules. Local copies of already-chunked objects preserve their existing layout. Rechunk (xaction) changes the layout according to the bucket’s configuration.

For these internally managed writes, AIS owns the multipart upload. If initiation, a part write, or completion fails, AIS aborts the upload and attempts local cleanup even if backend abort fails. The operation returns its original error; cleanup failures are logged. Writes that only populate the local cache do not attempt to abort a backend upload. Filesystem cleanup remains best effort.

For client-initiated multipart uploads through the native or S3 API, the client owns the upload ID and can retry a failed abort request. If backend abort fails, AIS returns that failure and retains the local upload state, unless the backend reports that the upload no longer exists (404), in which case local cleanup proceeds.