Skip to content

perfcached 0.7.4.4

Choose a tag to compare

@Lt-Flash Lt-Flash released this 08 Nov 23:26
· 58 commits to master since this release

perfcached - found fast, kept safe

A multithreaded, self-clustering cache for Linux, with its own encrypted protocols and a Redis-compatible door. New here? Start with the README.

This page covers 0.7.4.1 to 0.7.4.4, with libperfd 0.7.5: 0.7.4.1 and 0.7.4.3 were not published and have no pages of their own. Coming from 0.7.3, read all of it, and "Before you upgrade" first. The ChangeLog has the detail.

0.7.4.4 is the 0.7.4.4-rc12 build (588e2b9b1f), green on both CI systems. It was rolled in one node at a time over 0.7.4.4-rc8 on a three-node test fleet on 2026-11-06, and went through the failure drill straight after the roll: a member killed mid-write twice (once held down 45 s), a member restarted on the epoll backend, and an HTTP flood, under two writing clients. Of 80,883 writes, each read straight back, none read back a wrong value (205 read nil at first and the value 20 ms later: see Known), and the final check of every key on every node found none wrong or lost; the two writes in flight at the kills were reported uncertain, as they must be. It then ran 72 hours under the fleet's own traffic with no ERROR, no critical line and no alert. Nothing was rebuilt for this page: the binaries in the signed tarball below are the ones running on that fleet.

Before you upgrade

  • From 0.7.3 the fleet moves together. The cluster header changed (version 6): a 0.7.3 node and a 0.7.4.x node cannot talk. Stop every node (perfcli -E ... fleetstop), install, then start them all. Clients of 0.7.3 keep working. From 0.7.4.3, 0.7.4.4 rolls one node at a time.
  • The native door carries requests in the clear by default. The client secret's Noise handshake still opens every connection; then libperfd asks for plaintext, the node grants it, and the client's first record proves it holds the session's keys, so a replayed handshake cannot. To keep a door encrypted, set [listen] encrypt = yes (for all its listeners, or per listener: tcp = <addr:port> encrypt=yes); on the client side, perfd_opts.encrypt = 1 or perfcli --encrypt. enable needs an encrypted connection (perfcli -E and -e imply it). The node says at start which doors anyone on the network can read and alter. Older clients and older nodes keep encrypting; the cluster plane is unchanged.
  • The relay port is TCP and UDP now. Replication groups longer than [cluster] max_datagram go to the peer's relay port over TCP; open it for TCP between members. max_datagram now defaults to 1,232 (what IPv6 guarantees on any path; it was 1,400), and it is part of the fleet's configuration fingerprint. max_datagram = 0 sends everything as datagrams.
  • A full WAL makes writers wait under every fsync policy, instead of dropping the record and refusing writes while the node heals. [wal] on_full = heal keeps the old behaviour.
  • pubsub_rx_threads defaults to auto: half the workers, rounded up, at most 15 (it was 2).

Data kept safe (0.7.4.1 - 0.7.4.4)

  • A snapshot taken while a table resized could miss records: it read the live table alone, and the resize emptied the old one under it. Those records were in neither the snapshot nor the log replayed after it, so a restart lost acknowledged writes. The snapshot now reads both tables and holds the resize's swap and its end while it reads. (0.7.4.4)
  • A snapshot taken while another thread deleted keys could miss a record: the delete moved the bucket's last record into a slot the snapshot had passed, below the snapshot's marker in the log, so a restart lost an acknowledged write. The snapshot now re-reads such a bucket under its lock. (0.7.4.4)
  • An EXPIRE that lapsed within the second it was set was not logged, and after a crash its key came back. (0.7.4.3)
  • While a resize drains, the new table answers for the keys the old one still holds, and a write that finds the key absent carries its record over first: a key written just before the swap no longer reads as a miss until the drain reaches it, an increment counts on, and a delete is never undone. A key's newer copy in the old table answers, not an older one copied before the swap. (0.7.4.1, 0.7.4.3)
  • A set and a delete of one key that arrive together on two threads end as they would on one. (0.7.4.1)

The cluster (0.7.4.1 - 0.7.4.4)

  • A key deleted while a node was away could stay readable on that node after it came back: one live peer that did not answer in time left the key kept, with nothing asking again. The node now waits for the answers and walks again, up to three more times; what is still undecided after that is kept, logged and counted (reconcile_unruled). (0.7.4.4)
  • A handover, or any promotion, could leave the fleet without a master for about ten seconds, each of the two masters waiting on the other. A new master now ranks a keepalive against the term it claimed. (0.7.4.4)
  • A member short of deletes from a node that then restarted could never catch up: cluster.acks_stuck stayed up for good, and keys deleted in that gap could stay readable on it. After 30 s the member skips what nobody can resend and reconciles its records with the fleet (acks.gap_dead counts it). A member whose numbering an origin floored no longer takes the rebuild it is asked for as a 49-day absence that sent it back to recovering. (0.7.4.3, 0.7.4.4)
  • perfcli -E ... master_prefer <node>, on the master, hands mastership to that member once it holds the synced state, with no interval without a master; master_auto cancels one still pending. An election prefers the map's live standby. (0.7.4.3)
  • A member ignores a master beacon from a term older than its map's; a master steps down on a newer one and follows its sender at once. After a peer comes back, a miss asks only that peer, and only when it may hold something new; every return of any peer used to send every miss to every peer for 30 s. (0.7.4.3)
  • The membership push carries each member's state, and libperfd routes to a member only once it is ready. /members shows a build's fourth version number, and a heartbeat fits the smallest IPv6 path. (0.7.4.1, 0.7.4.3)

Security (0.7.4.1 - 0.7.4.3)

  • Every sealed cluster frame is taken once. It names its sender, the sending thread's stream and its place in it inside the authenticated header; a copy taken before, one too far behind its stream, or one from the sender's previous process is dropped and counted in /stats cluster.replay. A forwarded INCR the network doubled, or someone sent again, used to apply twice.
  • The cluster seal is XChaCha20-Poly1305: its 24-byte nonces stay unique however many frames one fleet key seals.
  • [secrets] cluster_accept: a second cluster secret that frames are also opened with, never sealed with, so the cluster secret changes in three rolling restarts instead of a flag day.
  • The relay's TCP receiver and the bulk plane accept only a member's host, and the bulk plane wants a connection's first message within a second.
  • perfload and perfdump run zstd without a shell and open a dump's files only by plain names in its directory: a file name with a quote in a dump's manifest ran a command.
  • The dashboard takes the enable secret only over its own TLS or from its own host; a session asked for over plain HTTP from another host is refused (403).

Faster (0.7.4.1)

  • The WAL is written a batch at a time from one buffer, not a record per write vector, and its pump checksums three records at once. On one test host, 200 B SETs from another host with fsync = everysec on RAM: 1.59M to 4.2-4.3M SET/s. The WAL's buffers grow by 4 MB.
  • Eager replication's pushes ride the relay port, one relay thread per sending thread, instead of one thread receiving every cluster datagram. Groups longer than max_datagram go over TCP instead of as fragmented datagrams: on a three-node eager fleet, SET 4.13M to 4.90-5.05M/s.
  • A SET costs 7% less CPU. A full bucket links overflow buckets of its own under its own lock: the table-wide overflow area and its one lock are gone.
  • An encrypted async libperfd handle seals what it has queued once per write, not once per request: encrypted over loopback, SET 32 B 4.8M to 6.7M/s, GET 5.4M to 7.7M/s.

The WAL, memory and alerts (0.7.4.1)

  • The log can follow the load: [wal] segments_max lets it grow from segments when it is half full or its free segments would last under three snapshots, and gives the extra segments back after five quiet minutes.
  • Under a cgroup limit that can never hold the memory floor, the arena and the process, the node refuses to start and says the sum; perfcached -C says it beforehand.
  • The network link under the node's address is watched (a VLAN followed to its bond, an active-backup bond to its active slave): /stats alerts.host.link, /metrics perfcached_link_*, and the host.link alert at [alerts] link_warn_pct / link_crit_pct, critical at once when cluster datagrams drop while the link is that full. The dashboard's member cards show a link bar.
  • The page: a write-through collection's title says read/write-through, and an upstream master's tooltip says what it does instead of "not used". (0.7.4.4)

libperfd 0.7.5

  • A handle with a spreading policy follows the fleet while it is connected: when a member comes up, one handle in N moves to it at its next call, and a handle leaves a member that stops serving. The default policy stays where it connected.
  • A member that took the connection and then said nothing, as a frozen daemon's kernel does, held a caller for the whole I/O timeout on every re-dial. A standby's dial no longer holds a caller; connect_timeout_ms bounds the handshake as well as the TCP connect, and no answer is reported as a transport error, not as a wrong secret.
  • Connections are spread over the daemon's workers: after it dials, a handle asks which worker it landed on and dials again while that worker holds more than one connection beyond the least loaded one. opts.worker_balance = -1 turns it off.

PHP (new)

  • lang/php: an extension for PHP 8.3 NTS over libperfd, on the native door with the Noise handshake, a list of seeds, failover and spreading across the members, and one handle a worker kept across requests under PHP-FPM. A Symfony cache adapter builds on it (composer package perfcached/symfony-cache). See lang/php/README.md.
  • The Debian package php8.3-perfcached is on this page (below).

Files

The signed tarball: perfcached-0.7.4.4.tar.gz with perfcached-0.7.4.4.tar.gz.sig - its binaries are the ones running on the test fleet, x86_64, built on Debian 13 (glibc 2.41) with libcurl mail; it runs on glibc 2.34 or later. It unpacks to one prefix directory (bin/, etc/, include/, lib/, sbin/, share/) for /opt, and it is what upgrade_stage, the dashboard's staging and the perfcached-upgrade helper take. Check it with the binary you already run (0.6.5 or later):

perfcached -K perfcached-0.7.4.4.tar.gz        # GOOD, the release key 5646e8e4 (built in)

Debian 12 and 13, Ubuntu 20.04 and 24.04, amd64:

  • perfcached: the clustered daemon, every cluster mode.
  • perfcached-standalone: the single-node edition, built from the same tree without the cluster code. A [cluster] section in its config is refused rather than ignored.
  • perfcached-dashboard: the status page's own process; unit installed disabled. Not for Ubuntu 20.04: its libmicrohttpd (0.9.66) predates the API (0.9.71) the dashboard is written for. Run the dashboard on another machine for a 20.04 fleet - it reaches the members over the native door.
  • libperfd0: the client library, libperfd.so.0, at 0.7.5.
  • libperfd-dev: its header, static archive, libperfd.so link and libperfd.pc.
  • php8.3-perfcached (0.1.0; Debian 12 and 13, Ubuntu 24.04): the PHP extension, for PHP 8.3 NTS. It depends on libperfd0 and the PHP API version (20230831). Debian ships no PHP 8.3, so on Debian it wants PHP 8.3 from packages.sury.org; Ubuntu 24.04 has its own.

The two daemon packages install the same files and replace each other. They do not need libperfd0: install it, or libperfd-dev, for your own programs. They do not restart the daemon on upgrade: after a 0.7.3 fleet's packages are upgraded, stop every node and start them all (see "Before you upgrade"). The dashboard package keeps the automatic restart.

sudo apt install ./perfcached_0.7.4.4-1+deb13_amd64.deb
sudo apt install ./perfcached-dashboard_0.7.4.4-1+deb13_amd64.deb    # on the machine that shows the page
sudo apt install ./libperfd0_0.7.4.4-1+deb13_amd64.deb ./libperfd-dev_0.7.4.4-1+deb13_amd64.deb   # to build against libperfd
sudo apt install ./libperfd0_0.7.4.4-1+deb13_amd64.deb ./php8.3-perfcached_0.1.0-1+deb13_amd64.deb  # PHP 8.3 (Sury's on Debian)

Each distribution's packages were built for it: Debian 13 natively (gcc 14.2, glibc 2.41), Debian 12 (gcc 12.2), Ubuntu 24.04 (gcc 13.3) and Ubuntu 20.04 (gcc 9.4, debhelper from focal-backports) each in a container of that distribution. Ubuntu 24.04's are built without LTO, as the other three are by their distributions' defaults. Every build ran noisetest, the selftest and a deliberately broken-lock build that must fail. Each set was then checked in a clean container of its distribution:

  • the version and revision perfcached -V reports (0.7.4.4 (588e2b9b1f)), and the systemd unit;
  • the daemon starting and answering ping, set and get over its native door from perfcli, through the client secret's handshake (on epoll: the containers' default seccomp profile refuses io_uring);
  • a program built against libperfd-dev through pkg-config, linking libperfd.so.0 and reporting 0.7.5;
  • the shipped config passing perfcached -C, a [cluster] section refused by the standalone edition, and the two editions replacing each other;
  • the dashboard package: its binary's libraries, its unit file and the example config;
  • an upgrade over the published 0.7.3 packages.

php8.3-perfcached was built in a container of each distribution against that distribution's libperfd0 and libperfd-dev above (PHP 8.3.36 from Sury on Debian, 8.3.6 on Ubuntu 24.04), and checked in a clean one: its dependencies; the CLI and PHP-FPM loading it through mods-available, with no warning; the extension and the package agreeing on 0.1.0; a SET and GET from PHP against the installed daemon, through the client secret's handshake, and nil for an absent key; a dial with nothing listening raising PerfcachedTransportException; remove taking the module and keeping its ini, purge leaving nothing.

Alpine 3.24 (musl), x86_64, both editions, as tarballs of the tree's make install layout: binaries in usr/bin (the dashboard among them), libperfd (shared and static) with perfd.h and libperfd.pc, the example config, and the docs. No systemd unit or OpenRC service is in these tarballs; run the daemon under your own supervisor, or use the packages below, which carry the OpenRC services.

apk add libsodium libcurl libmicrohttpd
tar -xzf perfcached-0.7.4.4-alpine3.24-x86_64.tar.gz
cp -a perfcached-0.7.4.4-alpine3.24-x86_64/usr perfcached-0.7.4.4-alpine3.24-x86_64/etc /

Built with gcc 15.2 on Alpine 3.24.4 in a clean container behind the same three gates, then checked in a second clean container: -V and the musl interpreter, the dashboard's libraries, the round trip, the libperfd program, the shipped config and the [cluster] refusal.

Alpine 3.24 packages: every package contrib/alpine/APKBUILD builds, as .apk, signed with the perfcached release key: perfcached (with its OpenRC service and account), perfcached-standalone, perfcached-dashboard (its own service and account), perfcached-doc, libperfd and libperfd-dev. The packages carry the daemon's version, 0.7.4.4; the library inside reports 0.7.5. Trust the key once (its public half is attached here and in contrib/alpine/keys), then install:

cp yury@kfi.net.au-6aca2bb6.rsa.pub /etc/apk/keys/
apk add ./perfcached-0.7.4.4-r0.apk                                     # or ./perfcached-standalone-0.7.4.4-r0.apk
apk add ./libperfd-0.7.4.4-r0.apk ./perfcached-dashboard-0.7.4.4-r0.apk  # on the machine that shows the page
apk add ./libperfd-0.7.4.4-r0.apk ./libperfd-dev-0.7.4.4-r0.apk          # to build against libperfd

Built with gcc 15.2 on Alpine 3.24.4, then checked in a clean container that trusts only that key: everything installs; perfcached -V reports 0.7.4.4 (588e2b9b1f); the OpenRC services and the accounts are in place; the shipped config passes perfcached -C; the dashboard's libraries resolve; pkg-config reports 0.7.5, and a program links the shared or the static library and pings the installed daemon; the standalone package replaces the clustered one; and without the key apk refuses them as untrusted.

SHA256SUMS covers every file on this page.

Known

  • A read-through collection in shard or spread mode that does not write through (upstream_writes unset) answers nil for a key read through a member that does not own it (shard) or hold it (spread): the owner fetches for a member's pull only when the collection writes through. Fixed for 0.7.5.
  • In shard mode, a hash read through a member that does not own the key answers empty on a read-through collection when the owner holds no copy of it yet. JSON reads may share it.
  • A read whose fetched copy finds no room in the arena answers nil, though the upstream holds the key. Each read-through collection keeps a table of copies for every upstream server it reaches, about 1.25 MB each: size arena_mb for them. Fixed for 0.7.5.
  • A member short of deletes its origin no longer holds (past tombstone_retain_max, or forgotten under the time rule while the member was counted gone) keeps those keys until their TTL, and serves them. Fixed for 0.7.5.
  • On a write-through collection, a read straight after a write through the same node can answer nil, the right value there about 20 ms later: about 3 in 1,000 on the test fleet, nearly all of them on one node. A client that moves to another member between a write and its read can also miss its own write. The cause is not yet found.
  • A libperfd write that may have applied is not replayed: the first counter update or conditional set after a quiet spell, on a connection a restart closed meanwhile, comes back "NOT replayed". And with route_keys on, such a write whose routed standby dies mid-request is sent again on the active link and can apply twice. Both fixed for 0.7.5.
  • A spreading libperfd handle takes 16 to 24 s to leave a member that failed, with its writes refused meanwhile; reads are served. Fixed for 0.7.5.
  • With [cluster] tombstone_acks = no, or while a member runs a build older than 0.7.3, deletes are kept by time: in eager mode a delete made on one side of a partition that outlasts tombstone_retain_s can be undone when the partition heals.
  • In a container under Docker's or podman's default seccomp profile, io_uring is refused and the daemon runs on epoll. perfcached -C and the log say which.
  • No lists, sets, sorted sets or streams yet. Keys hold strings, counters, JSON documents or hashes.
  • discovery = unicast (clouds, Kubernetes) is tested in lab network namespaces, not yet in a real cloud deployment. spread mode has not yet carried production traffic.
  • The RESP and HTTP doors are plaintext, and so is the native door's traffic after its handshake unless encrypt = yes: keep them on a trusted segment, behind their allow-lists.