What runs on the host of the card
The ADP software stack manages the card on the server that holds it. For a local card this is the GPU server. For a remote card it is a storage server. The stack has these parts:
- a driver (
adp.ko) - one storage service for each card (
adpstore@<N>) - the
adpclitool - for a remote card, one NVMe-oF target service for each card (
awide-spdk-target-<N>)
ADP card requirements tells what each part is and what the host needs for it.
Install the software stack
Awide Labs delivers the ADP software stack as an installer for the kernel of the host. ADP card requirements tells what the host needs before you start: slot, SSDs, packages, kernel.
-
Install the card in a PCIe Gen5 x16 slot. Install the NVMe SSDs for the cache in the same server, on the NUMA node of the card.
-
Install the prerequisite packages.
-
Run the installer with the SSDs of the card in the command. It installs the driver, the storage service and the command-line tool. It puts the SSDs into one RAID 0 array behind the card and reserves hugepages:
sudo ./xdp-installer install --level=0 --resources="/dev/nvme1n1 /dev/nvme2n1" --vhc=0 \ --enable-set-hugepages --hugepage-distribution-percentage=50 --assume-yesWhen another service of the host also uses hugepages, a database for example, add
--start-before <service>and--hugepages-headroom <pages>to this command. The storage service then starts before that service at boot and has a margin of pages (other users of hugepages). -
Remote card only: install the NVMe-oF target on the address that the GPU servers connect to, and start it. Use the 128 KiB I/O size of the integrations. On a storage server with several cards, give one address and port for each card. When there are several storage servers, give each server its own box ID:
./awide_ai_spdk_target.py install --targets=192.0.2.10:4420 --awideai-box-id 0 \ --io-size 131072 --start-serviceThe target gets the serial number
L<box ID>P<index>and a fixed namespace identity. The serial number identifies the card on the GPU servers. With a fixed identity, the initiators keep the device after a restart of the target.The listen address of the target must stay after a reboot of the host. When the network configuration of the host does not have it yet, add
--persist-address=<interface>:<address>/<prefix>to the install command. The installer then writes a netplan file for the address, which takes effect at the next boot. To see what the next boot starts, run./awide_ai_spdk_target.py check. -
On a storage server, set the CPU and I/O tuning profile:
sudo tuned-adm profile throughput-performance -
Make sure that the card is up (next section). Then configure the storage service.
-
Before the first reboot of the host, check that everything starts again by itself:
sudo python3 autostart.py check(Autostart after a reboot of the server).
Update the stack with packages
The installer sets up a new host. A host that is already set up can take a new ADP software stack as two packages:
adp-dkms (the driver sources, which DKMS builds for the running kernel) and adp-stack (the storage service, the
CLI and the library). They do not change the configuration of the card in /etc/adp/<N>.
The packages keep the same version from release to release, so DKMS keeps the module that it built before. Stop the model, its gateway and the NVMe-oF targets of the card, then remove the old module before you install:
sudo systemctl stop adpstore.target
sudo modprobe -r adp
sudo dkms remove -m adp -v 2.4.5.0 --all # else DKMS keeps the old module
sudo dpkg -i adp-dkms_*.deb adp-stack_*.deb
sudo modprobe adp # /sys/module/adp/srcversion must change
sudo systemctl start adpstore.target
Then start the targets, the gateway and the model again. A host that the installer set up keeps its own unit of the
storage service in /etc/systemd/system, which takes precedence over the one of the package: compare the two after an
update. Build the driver with the compiler that the kernel was built with; with another build of the compiler, the
module build fails with incompatible gcc/plugin versions.
PCIe power saving on the card link
The driver turns PCIe ASPM L1 off on the link of the card. With L1 on, the link sleeps between requests, and a single
page write takes about 44 µs instead of 8.5 µs. The module parameter adp_pcie_l1_off controls this: 1 (the
default) turns L1 off, 0 leaves the link as it is. When the BIOS controls ASPM, the kernel log says
PCIe ASPM L1 stays ON: turn ASPM off for the slot of the card in the BIOS.
Check the card
systemctl is-active adpstore@0 # the storage service of card 0: "active"
adpcli system get_status # every component, and the aggregated status
adpcli system get_disk_usage -x 0 # physical usage, valid objects, databases
adpcli raid get_raid_info -x 0 # the SSD array behind card 0
systemctl is-active awide-spdk-target-0 # remote card only: the NVMe-oF target of card 0
A healthy card reports every component OK:
Components status:
Driver (OK): Driver is working properly
Service (OK): Adpstore service is working properly and system is active
RAID (OK): RAID Array is functioning properly, raidLevel: RAID0, protection: No, performance: Normal
CapacityUsage (OK): Capacity usage is below defined thresholds
Firmware (OK): Firmware is working properly
Temperature (OK): Temperature is at NORMAL level
SuperCapacitors (OK): Super Capacitors are working properly
OnboardFlash (OK): Onboard flash component is working properly
Aggregated status is OK
The usage report shows how full the card is and how many objects and databases it holds. After a gateway connects, the
number of databases is the num_dbs of the gateway (128 by default):
Physical usage [%] : 12.40
Physical capacity : 863.10 GB / 6.96 TB
Number of valid objects : 10051238 / 1680330742
Number of databases : 128 / 4096 (0 deleting)
Configure the storage service
The storage service of card N reads /etc/adp/<N>/adpstore.ini, which the installer writes. Check two keys on every
card that holds the KV cache. Configuration → ADP storage service has the
full list.
[db_settings]
key_eviction = true
product_type = 0 # 0 = KV, 1 = Block
Key eviction is on by default in key-value mode, also when the key is absent. The installer and an upgrade keep an
existing adpstore.ini, so a file that says key_eviction = false keeps eviction off: set it to true on a card
that holds a cache.
CAUTION
When the card is the main storage of an application and not a cache (for example the storage manager of a
database), key eviction must be off. Add key_eviction = false to section [db_settings] before you install or
upgrade the stack. Otherwise a full card deletes its oldest records without an error, and the data is lost.
Apply a change with the model server and the gateway stopped:
systemctl restart adpstore@0
journalctl -u adpstore@0 -o cat | grep -i "key eviction" # "Key eviction Enabled" or "Key eviction Disabled"
A restart applies key_eviction = true. Once eviction was on, a change to false takes effect only after a reboot of
the host. A restart of the storage service also restarts the NVMe-oF target of the card, and the GPU servers
reconnect by themselves.
Capacity and key eviction
The storage service reports usage in three zones. adpcli system get_status shows them as CapacityUsage:
| Physical usage | Status | Effect |
|---|---|---|
| below the soft threshold (90 % by default) | OK | — |
| between the soft and the hard threshold (100 %) | warning | none on writes |
| above the maximum | CRITICAL | writes are banned: every write fails until there is free space. The service logs event 3002. |
With key eviction on (the default in key-value mode), the card starts to get space back before it reaches the maximum. The storage service sets
the point where eviction starts. It is not a setting in the INI file. The soft and hard thresholds
(adpcli system get_usage_soft_threshold, get_usage_hard_threshold) change only the reported status. Do not change
them to start eviction earlier.
A full card leaves the write ban by itself. While writes are banned, the storage service checks the fill level every 5 s. With key eviction on, it frees space and lifts the ban as soon as there is room, also after a restart. So a card that filled up with eviction off comes back when you turn eviction on and restart the storage service; no wipe is necessary.
Watch the physical usage (adpcli system get_disk_usage) as the fill level of a cache, and alert well before the
maximum. When a card fills faster than it gets space back, the hit rate falls, and vLLM shows no error. The gateway
also counts the writes that the card refuses (what to monitor).
Wiping the card
A wipe empties the cache. After a change of the stored layout it is necessary
(settings that require a clean cache). In other cases it
only costs a refill. The gateway does it at start with --start-clean=1: it removes its databases. The storage service
refuses this while key eviction is on (Key eviction is ENABLED, delete DB not supported). So do a wipe in this order:
- Stop vLLM and the gateway. On a shared cache, stop every gateway on the card.
- Set
key_eviction = falsein/etc/adp/<N>/adpstore.ini, then reboot the host of the card: a restart of the storage service does not turn eviction off. After the reboot, the storage service logsKey eviction Disabled. - Start one gateway once with
--start-clean=1and withoutshared_storage. Wait until its log reports the databases removed.adpcli system get_disk_usage -x 0then shows0objects. - Set the gateway back to
--start-clean=0. - Set
key_eviction = trueand restart the storage service. - Start the gateways and the engines.
A full card does not need a wipe to leave the write ban (capacity).
WARNING
Keep start_clean at 0 in every place that starts the gateway: compose files, Kubernetes manifests, runtime
classes of an operator, restart scripts. A gateway that starts with start_clean=1 at each restart removes the cache
each time. With key eviction on, the storage service refuses the clean.
Autostart after a reboot of the server
After a reboot of the host, the card, its storage service and the model next to it come back by themselves, in this order:
driver adp ─▶ hugepages ─▶ storage service adpstore@N ─▶ NVMe-oF target or gateway ─▶ model
("up and ready")
At shutdown the order is the other way: the model stops first, then the gateway, then the storage service. The storage service closes its databases on a live card, so the KV cache on the card is still there after the reboot. A long prompt that was cached before the reboot is read back from the card and is not computed again.
The installer sets up most of this:
| Step | What does it |
|---|---|
| Driver at boot | /usr/lib/modules-load.d/adp.conf from the installer and the packages. The unit of the storage service also loads the driver as its first step. |
| Hugepages | adp_hugepages.service reserves the pages of the storage service early at boot, before any adpstore@N (--enable-set-hugepages). |
| Storage service | adpstore.target starts adpstore@0..N-1. A storage service that fails restarts by itself (up to 3 times in 20 minutes). |
| NVMe-oF target | awide-spdk-target-N starts after its adpstore@N and follows its restarts. |
Two things depend on your host: other services that use hugepages, and the model.
Other users of hugepages
The storage service needs all the pages reserved for it. Another service of the host can also use hugepages, for
example a database with huge_pages = try. When it starts before the storage service at boot, it takes some of the
reserved pages, and the storage service stops at start (CONFIG_AllocBuffFromHugePages in its log). Two settings
prevent this:
- Start the storage service before that service. The storage service then takes its pages first. At shutdown the other service stops before it.
- Reserve some pages more than the storage service needs (a headroom). This covers a restart of the other service while the storage service is down. 256 pages (512 MB with 2 MB pages) are enough for a database with a small shared buffer.
At installation, add --start-before <service> and --hugepages-headroom <pages> to the installer command
(install the software stack). On a host that is already installed, use autostart.py, a script of the card stack installer
(adp/installer/utils/autostart.py). Without --go it only shows what it would do:
sudo python3 autostart.py apply --start-before postgresql --hugepages-headroom 256
sudo python3 autostart.py apply --start-before postgresql --hugepages-headroom 256 --go
| Setting | Default | What it does |
|---|---|---|
--start-before <services> | empty | The services that the storage service starts before (comma list). Written to /etc/systemd/system/adpstore@.service.d/50-autostart.conf. |
--start-after <services> | empty | The services that the storage service starts after, for example a storage service that the host needs first. |
--hugepages-headroom <pages> | 0 | Pages reserved on top of the need of the storage service, on the NUMA node of the card. Written to /etc/adp/adp_hugepages.sh; the former file stays next to it. It takes effect at the next boot. |
--start-before '' and --start-after '' together remove the drop-in. An uninstall of the card stack also removes
it. When the host reserves hugepages itself (vm.nr_hugepages in sysctl or hugepages= on the kernel command line),
make sure that the number covers the storage service and the other users together.
The model on a host with a local card
The model must start when the card is ready and stop before the storage service. Run it from a systemd unit, not
with the restart policy of Docker: Docker starts its containers at boot without any order against adpstore@N.
autostart.py model-unit writes this unit for a model that runs with Docker Compose:
python3 autostart.py model-unit --name model-a --workdir /srv/model-a \
--compose-file docker-compose.yaml --env-file .env --card 0 --out /etc/systemd/system/model-a.service
sudo systemctl daemon-reload && sudo systemctl enable model-a.service
The unit waits until the card reports “up and ready” (up to 600 s, --ready-timeout), because the storage service can
restart a few times at boot before it is ready. Then it runs docker compose up -d, and at shutdown
docker compose stop. It starts after adpstore@N and stops before it, but it does not stop the model when the
storage service restarts: the gateway takes the card back by itself. When the gateway runs as its own unit, add
--gateway-unit <unit>. The model then also starts after the gateway and stops before it. --after <units> adds more
units to wait for. The compose file for this unit is in Installation.
Check before and after a reboot
Before a reboot:
sudo python3 autostart.py check
It changes nothing. It checks that something loads the driver at boot, that adpstore.target and
adp_hugepages.service are enabled, and how many pages are reserved. It also finds the processes that hold hugepages
now, and checks that the storage service starts before their services. autostart check OK and exit code 0 mean
that nothing is in the way. Otherwise it prints each problem and what to do.
After a reboot:
systemctl --failed # nothing of the card stack
lsmod | grep -w adp # the driver
grep HugePages_Total /proc/meminfo # the reserved pages
adpcli system is_ready -x 0 # "up and ready"
systemctl status model-a # active (exited): the containers were started
systemd-analyze critical-chain model-a.service # the order and the time of each step
What to expect
On a host with an A100 GPU, one card and a 27B model, two planned reboots with nothing done by hand gave:
| From the reboot command | |
|---|---|
| about 3.5 min | the host answers over SSH. Most of this time is the firmware of the server. |
| a few seconds later | the driver is loaded, the pages are reserved, the card is “up and ready” |
| about 5 min | the model answers requests |
The KV cache on the card survived both reboots. A prompt of about 100k tokens, cached before the reboot, got its answer in about 7 s after it, with 98 % of its tokens read from the card. The same prompt computed from the start takes about 51 s. The first two rows depend on the firmware of the server; the last one adds the start of the model.
Maintenance of the card host
The storage service writes the RAID metadata of the card to disk only at a correct stop. At the next start, the
service reads this metadata and then removes the file. When the service stops in another way, or when someone changes
/etc/adp while the service runs, the card can lose its RAID metadata. The cache on the card is then lost.
To service the host of a card:
- On a remote card, the gateways take the card out of service when it stops. On a local card, stop the gateway and the engine first.
- Stop the NVMe-oF target of the card:
systemctl stop awide-spdk-target-<N>. - Stop the storage service:
systemctl stop adpstore@<N>. Make sure thatsystemctl is-active adpstore@<N>showsinactive. This also stops the target, if step 2 did not. - Do the maintenance. Copy or move files in
/etc/adponly now. To go back to an earlier copy, move the directory back. Do not remove it and unpack an archive over it. - Start the storage service, then the target. A start of the service does not start the target: start both. Check the card with
adpcli system get_status. - On the GPU servers, make sure that the card is connected again. Identify it by its serial number. The gateway takes the card back by itself: a local card after its storage service returns, a remote card when its namespace comes back, also under a new device name (when a card comes back).
Planned reboot of the host
When the model runs from its own unit (the model on a host with a local card),
a reboot needs no manual stops. Run sudo systemctl reboot: the units stop the model, then the gateway, then the
storage service. Check the host after the reboot as
Check before and after a reboot shows. When the model and the gateway are not in
units, stop them first as in step 1 above.
Remote card: check the fabric
Check the RDMA path between the storage server and the GPU server before you connect the card. A link below its rate, or a port without a subnet manager, shows later only as slow restores or a card that does not connect. On both servers:
ibv_devices # the RDMA devices, mlx5_0 for example
ibv_devinfo -d mlx5_0 | grep -E 'state|active_mtu|link_layer'
# state PORT_ACTIVE · link_layer InfiniBand (or Ethernet for RoCE) · active_mtu 4096
ibstat mlx5_0 | grep -E 'State|Rate' # InfiniBand: State Active, Physical state LinkUp, Rate 100 (EDR)
ip -br addr # the address of the port: IPoIB (ib0, …) or the RoCE interface
Then measure the bandwidth with ib_read_bw from perftest, over RDMA CM (-R), as NVMe-oF connects:
ib_read_bw -d mlx5_0 -R --report_gbits # storage server: waits for the client
ib_read_bw -d mlx5_0 -R --report_gbits 192.0.2.10 # GPU server: close to the line rate, above 90 Gb/s on 100 Gb/s
On InfiniBand, a port in PORT_INIT instead of PORT_ACTIVE has no subnet manager on the fabric. Start one: the one
of the switch, or opensm on one host. The target listens on an address (--targets of the target installer), and the
GPU server connects to it (--traddr in discovery.conf). On InfiniBand this is the IPoIB address of the port of the storage
server. On Ethernet it is the address of its RoCE interface.
Remote card: connect the GPU server
The NVMe-oF target service on the storage server exports one key-value namespace for each card over RDMA. The GPU server connects it with the kernel initiator. Nothing of the ADP software stack runs on the GPU server.
Set up the connection at boot, with its retry, once on every GPU server that uses a remote card, before models
run there. The standard nvmf-autoconnect.service of nvme-cli tries once at boot and reports success also when
nothing connected. When the network of the cards is not ready at that moment, or the host of the card reboots at the
same time, the server stays without its cards, and the models there run without the cache on the card.
Set up the boot connection
With Ansible, the playbook install_initiators.yml of the ADP deployment files does every step below on all GPU
servers of the inventory group initiators, and checks that every card is connected. It is safe to run again.
By hand, on each GPU server:
-
Install
nvme-cli1.12 or later, load the transport module at boot, and make sure that the host has an NQN:sudo apt install nvme-cli # dnf install nvme-cli echo nvme-rdma | sudo tee /etc/modules-load.d/awide-nvme-rdma.conf sudo modprobe nvme-rdma [ -s /etc/nvme/hostnqn ] || nvme gen-hostnqn | sudo tee /etc/nvme/hostnqn -
Write
/etc/nvme/discovery.conf, one line for each card. Each card is a port of its storage server:--transport=rdma --traddr=192.0.2.10 --trsvcid=4420 --ctrl-loss-tmo=-1 --reconnect-delay=10 --transport=rdma --traddr=192.0.2.10 --trsvcid=4421 --ctrl-loss-tmo=-1 --reconnect-delay=10With
--ctrl-loss-tmo=-1the kernel reconnects a connected card by itself when its target or the link comes back, every--reconnect-delayseconds.--host-traddr=<address>picks the address of this server on the network of the cards. There must be no/etc/nvme/config.jsonnext todiscovery.conf: with both files, the unit does not start at boot. -
Install the drop-in for
nvmf-autoconnect.service. The ADP deployment files ship it asdeploy/initiator/nvmf-autoconnect.service.d/awide.conf:sudo install -D -m 644 awide.conf /etc/systemd/system/nvmf-autoconnect.service.d/awide.conf sudo systemctl daemon-reload && sudo systemctl enable nvmf-autoconnect.service -
Connect now, the way the boot does it, and check:
sudo systemctl start nvmf-autoconnect.service journalctl -u nvmf-autoconnect.service -n 3 # "awide: 2 of 2 NVMe-oF connections up"
What the drop-in does
- While a line of
discovery.confhas no connection, the unit fails, and systemd runs it again every 30 s, up to 20 times (about 10 minutes). Connected cards are skipped. - It connects each card by name when
connect-allof an oldernvme-cli(2.3) connects nothing. Two kernel linesunknown parameter or missing value 'tls'in the boot journal are then expected. - When a target is away for longer than the retries, start the unit again when the target is back:
sudo systemctl start nvmf-autoconnect.service.
After a reboot, the last line of journalctl -b -u nvmf-autoconnect.service | grep awide must be
awide: N of N NVMe-oF connections up.
The card on the GPU server
The namespace is a key-value namespace, not a block device. nvme list shows its size as 0 B and the serial number
of the card subsystem (for example L0P0) in the SN column. Do not partition or format it.
Name the card by its link in /dev/disk/by-id/, by serial number (/dev/disk/by-id/nvme-<model>_<serial>), not by
/dev/nvmeXnY: device numbers follow the order of the connects and change after a reconnect. The gateway takes every
ADP card that the server has connected, also a card connected after the gateway started
(configuration).
Without native NVMe multipath (nvme_core.multipath=N), a command to a card that reconnects can wait for the
reconnect. With the io_timeout_ms setting of the gateway, set fast_io_fail_tmo of each connected controller
(/sys/class/nvme/nvme<X>/fast_io_fail_tmo) below its deadline, for example 2 seconds.
After a restart of the target
The target keeps a fixed namespace identity. The GPU servers reconnect by themselves, and a running gateway takes the
card back within 5 s, also under a new device name. When the controller was removed (a disconnect by hand, for
example), run sudo systemctl start nvmf-autoconnect.service on the GPU server.
Transfer size and fragments
| Placement | Limit | Object size |
|---|---|---|
| Local card | an object of at most 256 KiB | 261120 (255 KiB) |
| Remote card | one NVMe command of at most MDTS (128 KiB with the target’s --io-size 131072), a multiple of 4 KiB | 131072 |
The OffloadingSpec backend (xkv.fragment_bytes) and the SGLang backend (max_io_bytes) cut objects to this size
themselves. Keep the gateway fragment_size at 0 for them. The vLLM KV connector needs the gateway
fragment_size set to the value of the table. The gateway logs the device limit at start (# Max I/O Size). A fragment size that does not fit the device is an error in
the log (Fragment size … does not fit the storage device); the gateway keeps serving and holds the objects to the
device limit. Some models have a KV page that is not a multiple of 4 KiB (GLM-5.x). With the vLLM KV
connector on a remote card, they also need slot_alignment_bytes: 4096. A change of the fragment size requires a
wipe.
Durability
The card holds a cache. The system does not lose anything important when the card loses part of it. After an abrupt
restart of the storage service or the target, a write that the card acknowledged can be missing. The integration then
reads that chunk as a miss, and the engine computes it again. Supercapacitors on the card protect its data against a
power loss. Monitor them with adpcli system get_status (SuperCapacitors (OK)).
Reading the gateway log
NVMe media error type: 2 code: 135 is how the target of a remote card answers every store command that does not
succeed. The gateway reads the status of the store inside the answer:
- A key that the card does not hold is an ordinary cache miss. The gateway writes no log line for it and only counts it in its status file.
- Any other status is a failure, and the log line names it, for example
store status 8 (OUT_OF_SPACE)for a full card. The gateway logs the first failure of a status, then at most one line every 10 s with the number of failures, and counts them in its status file (what to monitor). None of them takes the card out of service.
Judge the card by adpcli system get_status, get_disk_usage and the counters of the status file, not by the number
of these lines.
Planning a deployment?
Talk to our engineers about your models, context lengths, concurrency and where the ADP card should sit.