NEXItaliano

NEXFS › Documentation › Limits and behaviour

Limits and behaviour

By Roberto Arato of aratoingegneria.it

This page collects in one place the sizes NEXFS supports, the times it uses, and how it behaves when something goes wrong. Read it before you install a cluster: it tells you what to expect, so nothing surprises you later.

Every value here is the one of the current version (0.9.17).

Sizes

What Limit What happens beyond it
A file or folder name 255 bytes the program receives "file name too long" (ENAMETOOLONG), as on a local disk
The target of a symbolic link 4,096 bytes "file name too long"
A single file about 8 PiB (8 million GiB) "file too large" (EFBIG)
Hard links to the same file 65,000 "too many links" (EMLINK)
One extended attribute (xattr) 64 KiB "argument list too long" (E2BIG)
The names of all extended attributes of a file 65,280 bytes in total "no space left on device" (ENOSPC), as on ext4
Snapshots of one folder 1,024 "too many links"; remove an old snapshot to make a new one
Copies of each block from 1 to 4 (default 3) set per cluster and per folder
Metadata nodes from 1 to 5 an odd number is best: 3 for most clusters, 5 for large ones
Disks in one data node 16 add another data node
Locks on one file 1,024 at the same time "no locks available" (ENOLCK)
Groups a user belongs to (as seen by NEXFS) 32 the extra groups are not used for permissions

Files up to 4 KiB live inside the metadata: they are created, read and written with a single request, which makes small files fast. Bigger files are split into blocks of 4 MiB, and each block is stored on several data nodes.

Times

What Value Can you change it?
A client renews its session every 2 seconds no
A client that cannot renew stops trusting its memory after 10 seconds no
The cluster considers a silent client gone, and frees its files after 15 seconds no
A new leader is chosen when the leader stops usually in 1–2 seconds no
A request waits for an answer before returning an error 8 seconds yes: timeouts.request_ms in the configuration
The copies of a data node that does not answer are rebuilt on the other nodes after 10 minutes yes: timeouts.replace_after_s

The 10 minutes are on purpose: a node that is only being restarted, or that loses the network for a moment, comes back long before that, and nothing has to be copied. A disk that really broke is replaced by rebuilding its copies from the others.

When nodes stop

One node at a time can always stop. With 3 metadata nodes and 3 copies of each block (the default), switching off any single node, for maintenance or by accident, does not stop anything: programs keep reading and writing, and when the node comes back it catches up by itself.

When too many data nodes are off, writes wait. NEXFS confirms a write only when it is on enough copies (with 3 copies wanted, at least 2). If so many data nodes are off that this is not possible, a program that writes, or that calls fsync, waits until enough nodes are back, and then goes on by itself. It never receives "done" for data kept on a single disk, and it does not receive an error that would make it stop half way. Reads of data that still has a copy available go on as usual.

In practice: for maintenance, restart data nodes one at a time, and wait until nexfsctl health says ok before the next one.

When too many metadata nodes are off, the cluster pauses. The metadata nodes decide by majority: with 3 of them, 2 must be on; with 5, 3 must be on. Below that, requests wait (and after timeouts.request_ms return an error) until a majority is back. Nothing confirmed is lost.

Files used from several computers at the same time

  • What one computer writes, the others read as soon as the write is done, also when both have the file open.
  • Adding lines at the end of a shared file (O_APPEND, for example a log written by several computers) is safe: every line arrives once, whole, and no line overwrites another.
  • Locks (flock, fcntl) work across computers. A lock belongs to the session of the computer that took it: if that computer stops, its locks are released when the cluster considers it gone (15 seconds), as with NFS. NEXFS does not detect a deadlock between computers (EDEADLK): two programs that wait for each other's lock wait until one of them gives up.
  • Shared memory maps (mmap with MAP_SHARED) show the changes of another computer after that computer calls msync, or closes the file.
  • Reserving space with fallocate creates the file at the requested size, but does not set disk space aside: if the cluster fills up, a later write can still receive "no space left on device".

Durability

  • fsync returns 0 only when the data is on the disk of all its copies (see Security and data durability).
  • If a write that was waiting in the client's queue fails, every fsync and every close of that file report the error, from any program that has it open, until the last program closes it. This is stricter than a local disk, where only one of them might hear about it.
  • Writes that were not yet confirmed with fsync can be lost if the computer that made them loses the network for more than 15 seconds while they were still in its queue: the program that wrote them receives the error at its next fsync or close. Data confirmed with fsync is never lost.
  • Every data node keeps free space in reserve on its disks (2% of the disk, at least 1 GiB but never more than 5% of a small disk; disk_reserve_mb in the configuration). A disk below the reserve takes no new data: the copies go to the other nodes, and if no node has room, writes return "no space left on device".

Access times

The client is mounted with noatime by default: the time of the last read of a file is not updated, so reading never writes anything. Mount with -o relatime or -o strictatime if a program needs it (see The client).

Who is trusted

  • Every node and every client has a certificate signed by the cluster's own authority (CA). Without it, nothing connects.
  • A client is trusted to say which user is working. As with NFS without Kerberos, the cluster checks permissions (owner, group, others, ACLs) for the user and the groups that the client declares. Mount NEXFS only on computers you administer, and give the client certificate only to them.
  • Data nodes accept changes only with a signed permit from the metadata nodes, which expires shortly after the client stops being in touch with them. A client that was cut off cannot overwrite data written by someone else in the meantime.