跪拜 Guibai
← Back to the summary

JuiceFS at Zhiqi Robotics: 99.96% cache hit rate and 99.92% fewer small files in embodied AI storage

Cache hit rate 99.96%, small file count reduced by 99.92%: Zhiqi Robotics' JuiceFS production practice

Zhiqi Robotics provides a data and development platform for embodied intelligence R&D teams, covering data collection, processing, training, simulation, and deployment. The 'Dayan' embodied intelligence data platform connects robot endpoints to the cloud, supporting embodied intelligence R&D.

As robot R&D scales up, data such as images, videos, point clouds, trajectories, and model checkpoints continues to grow. The original object storage met the need for data persistence, but downstream processing and training rely on directory traversal, file opening, and random reads; video frame extraction produces a large number of small files, and Kubernetes task scheduling across nodes tends to cause repeated downloads and preheating.

To address this, Zhiqi Robotics introduced JuiceFS as a unified file access layer. Currently, the JuiceFS primary volume has about 80.63 million inodes, with an average daily data upload of about 10 TB. This article describes the storage architecture design and, based on typical scenarios such as shared cache failures and small file management, shares five production troubleshooting and optimization experiences. In small file management, the file count was reduced by about 99.92%; in shared cache, the 7-day median cache hit rate in production reached about 99.96%.

01 Business background and data characteristics

Zhiqi Openmind has built the 'Dayan' embodied intelligence data platform around robot R&D covering data collection, processing, model training, simulation validation, and deployment, connecting robot endpoints to the cloud. Platform data is mainly collected through teleoperation, motion capture, and skill suits. Among these, skill suits use wearable devices to collect human motion and operation data without requiring the robot itself. Collected data mainly includes ROS bags, videos, and trajectories. After raw data packets are uploaded via the S3 gateway, they go through cleaning and quality inspection, time alignment, format conversion, video frame extraction, annotation, frame retrieval, and vectorization, and are finally used for model training. The resulting models and skill artifacts are then delivered to the simulation environment and robot endpoints.

Business data characteristics: The same data is reused repeatedly across collection, processing, and training; algorithms need to read, annotate, and retrieve by frame, and training tasks are scheduled across different Kubernetes nodes. Video frame extraction is a necessary step. Estimating with 100,000 data segments, each with 3,600 frames, saving each frame individually would correspond to about 360 million independent files (scaled estimate, not current inventory).

02 Unified file access via JuiceFS

In this architecture, JuiceFS unifies different access methods from the collection side and training side into a single file system. Edge collection endpoints upload data via the S3 SDK through the JuiceFS S3 Gateway; data processing and training containers mount JuiceFS via the Kubernetes CSI and read/write data using the POSIX file interface. This way, the collection side can continue using the existing S3 access method, and the algorithm side can keep using familiar file interfaces, avoiding repeated downloads and re-uploads of the same data between processing stages, without the need to refactor file access logic specifically for object storage.

When reading data, JuiceFS first queries directories, file attributes, and the mapping between files and data blocks through Redis, then reads cached data blocks from GPFS; on a cache miss, it reads persistent objects from MinIO. The three components have clear roles: Redis stores metadata, MinIO stores persistent data, and GPFS hosts hot cache that can be reused across nodes. Each Mount Pod's cache-dir points to the GPFS shared directory, allowing different nodes to potentially reuse the same cache.

Choosing GPFS as shared cache mainly solves the problem of local cache not being reusable across nodes. After a task is scheduled to another node, the new node cannot directly use the original node's local cache, so it may need to download the same data from MinIO again, increasing origin traffic and data readiness time. GPFS provides a shared directory accessible across nodes, extending JuiceFS data block cache from a single machine to multi-node sharing.

JuiceFS locates cache by data block ID. The same data block ID in the same JuiceFS volume corresponds to the same cache path, independent of the specific client. Therefore, data blocks written to the GPFS shared cache by one Mount Pod can be directly reused by Mount Pods on other nodes during subsequent access. It should be noted that this mechanism shares cache by data block path, not by deduplicating arbitrary identical content; each client still maintains its own cache index, and concurrent cold reads may still cause repeated origin fetches. To reduce concentrated origin fetches at training startup, the platform preheats hot data to GPFS in advance based on the dataset manifest.

Production cache hit rate, read bandwidth, and training-side feedback are as follows:

The GPFS side uses 200 Gbps InfiniBand, while the s3fs baseline uses 25 Gbps Ethernet; network conditions differ, so not all performance differences can be attributed to the file system.

Shared cache improves cross-node data reuse, but also makes multiple Mount Pods jointly dependent on GPFS. Production needs continuous monitoring of cache capacity, GPFS metadata service, and node health to avoid the cache layer itself becoming a new bottleneck.

03 Five production practices

GPFS shared cache failure postmortem: directory visible but file reads hang

In one incident, multiple training containers could not read data normally: ls could list directories, but cat reading file contents hung. The team reproduced the hang when accessing the same GPFS cache subdirectory from different nodes; accessing other GPFS directories worked normally, so the problem was traced to the shared cache path.

During the incident, the shared cache hit rate dropped from 88.6% to 26.1%. Read requests accessing the GPFS cache waited for about 30 seconds, and the P95 latency of GET requests rose to 5.91 seconds. Afterward, newly initiated read requests could bypass the GPFS cache and fetch from MinIO, and the P95 latency of successful GET requests fell back to 0.11 seconds; but the shared cache hit rate continued to decline, reaching a minimum of 4.5%. This shows that new requests being able to fetch from MinIO does not mean that requests already stuck in GPFS cache I/O will automatically switch.

This also explains why directories could be listed normally but file contents could not be read: directory and file attributes are provided by Redis, while reading file contents still requires accessing the GPFS cache. Under normal conditions, after a cache miss, the client fetches from MinIO; but in this incident, GPFS cache I/O requests never returned, so read requests were stuck at the cache access stage and could not proceed to fetch from origin.

The team found through inspection that a GPFS metadata service node had exhausted memory: the mmfsd process used about 228 GiB, and SWAP was fully used. No data was lost in this incident.

The team restarted the GPFS client and verified recovery from three aspects: cache access, cache write, and business reads.

After the incident, the team added JuiceFS cache hit rate checks to routine inspections and added SNMP monitoring on the GPFS side, keeping an eye on remaining inodes and node health; business read probes are a follow-up improvement.

Small file management: temporary frames stay in the task, final results go to shared storage

The original process split videos into many independent images, written frame-by-frame to shared storage, then batch-deleted after transcoding. When multiple tasks run in parallel, temporary images are created and deleted centrally, increasing metadata operations and background reclamation pressure. But these temporary frames can be regenerated and do not all need to be written to shared storage.

Therefore, the team kept temporary frame processing inside the task as much as possible, using two approaches depending on whether the processing chain depends on file paths:

For data that needs both sharing and frame-by-frame reading, the team referenced FFRecord's sample aggregation approach and used FrameRecord to organize consecutive frames into one data packet, generating two accompanying index files. The storage side delivers the packet as a unit, while the business side can still read frame-by-frame through a Reader.

With 3,600 frames as an example, the final delivered files were reduced from 3,600 individual image files to 3 (1 data packet and 2 index files), a file count reduction of about 99.92%. In a local NTFS environment using the same batch of 3,600 frames, the six-round average showed that streaming packetization took about 27.6% less time than frame-by-frame disk writes; timing did not include network upload.

Checkpoint fsync timeout: investigating metadata background tasks

When training tasks saved checkpoints, fsync timed out multiple times and returned I/O errors. FUSE logs showed that even a small 308-byte file had a flush timeout; data slicing had completed, but Writer.Flush and SETATTR/FSYNC waited for a long time, indicating the wait was in the write finishing stage after data slicing.

The team then found HSCAN in Redis slow queries and noticed that another mounted task was performing JuiceFS automatic metadata backup. That task needs to traverse the file system metadata, and online file operations also depend on Redis, so the two may compete for resources. Review found that some business request wait periods overlapped or were adjacent to the backup export window. However, HSCAN can also be triggered by directory traversal or reclamation operations, so automatic backup was a key investigation lead but not yet confirmed as the sole root cause.

The optimization direction was not to disable backup, but to separate the background metadata export task from online business mounts: business mounts configure backup-meta=0, schedule metadata backup separately during off-peak times, and clarify the responsibility boundaries between Redis persistence/replication and JuiceFS logical metadata export. Currently, business mount configurations have been verified, the independent backup deployment and recovery drill are still pending acceptance, and checkpoint saving recovery in training tasks remains to be validated.

Deletion storm management: separating background reclamation from business mounts

After enabling the recycle bin, when business operations perform rm or unlink, files are first removed from the original directory, and eligible entries enter the JuiceFS recycle bin's hourly directory; underlying data references and object blocks are not immediately all released, but are cleaned up by subsequent background tasks. This lets foreground delete operations return quickly, but when a large number of temporary files are deleted centrally, background reclamation still adds metadata and object storage load. In one deletion storm, the daily unlink peak reached 1.06 million times.

Two types of anomalies also appeared in the troubleshooting records. One was that Mount Pod container restart counts did not change, but the internal FUSE process exited and restarted; the original business container still held the old FUSE connection, so access returned ENOTCONN, while newly created tasks using new connections could read normally. The other was Mount Pod restarts due to OOMKilled: memory sampling rose from 6.3 GiB to 13.8 GiB, the container memory limit was 16 GiB, and the restart count went from 0 to 1. These two types of anomalies came from records at different times and should not be attributed to the same incident.

Recycle bin cleanup tasks are executed by writable mounts with background tasks enabled. Multiple Mount Pods compete for the current cleanup round's execution right based on a shared timestamp in Redis; only the mount that successfully updates the shared timestamp executes cleanup. Review logs showed that one mount processed 112,180 and 128,593 entries in two cleanup rounds, indicating that mount indeed undertook reclamation tasks; but these records alone cannot prove that reclamation tasks were the sole cause of the OOM, and process-level memory data for the incident period is still needed to determine this.

The remediation plan is to separate business mounts from dedicated Cleaner: business Mount Pods use no-bgjob and no longer perform periodic background reclamation, but still handle online reads/writes and business-initiated unlink operations; a dedicated Cleaner Mount Pod mounts the PVC and executes reclamation tasks. In the plan, business mounts have a memory limit of 32 GiB and Cleaner has 16 GiB. After the plan is online, verification is needed to confirm whether no-bgjob is in effect on business mounts, whether the Cleaner continues reclamation, and whether business read/write operations are normal.

Storage network optimization

Virtualization layer troubleshooting: host resources and network paths

After upload requests returned 504 errors, the team first used network probes to troubleshoot. One probe found that RTT within the MinIO virtual machine group was about 0.05-0.7 ms, but cross-group RTT reached 90-170 ms. After shutting down one MinIO VM, cross-group ping latency dropped; after merely restarting the VM without starting the MinIO process, latency rose again. In another incident, both Mount and S3 Gateway slowed down simultaneously. Further investigation found that the control-plane VM hosting the storage VIP shared the same ESXi host as a high-traffic VM, with VIP probe RTT fluctuating between 15-820 ms and about 2% packet loss.

After migrating the high-traffic VM sharing the host with the VIP to another host, storage access recovered in about 5 minutes. These phenomena suggest the problem may relate to VMware host resource contention and network forwarding paths; whether the physical uplink reached bandwidth limits still needs confirmation using network data from the incident period.

Object request path optimization: MinIO endpoint direct connection

In addition to virtualization layer resource contention, the team also checked the object request forwarding path. After Mount or S3 Gateway sends a request, traffic passes through the control-plane VIP, kube-proxy, and the business gateway, finally reaching MinIO. Taking a 4 MiB request body as an example, three logical forwarding hops produce about 12 MiB of logical data passing; this value does not equal the actual bytes sent by the network card.

To shorten the request path, the team kept the original endpoint domain and port, configured forwarding ports compatible with the original endpoint on the MinIO node side, and resolved the endpoint to multiple MinIO nodes via DNS, so new connections can directly access object storage nodes while existing connections continue on the original path. The cutover was phased: first the old VIP coexisted with two direct connection addresses, then switched to 12 MinIO node addresses. After the switch, control-plane node egress traffic dropped, while MinIO continued to handle reads/writes; the team also checked for object request errors and whether business reads/writes were normal to verify the effect.

04 Summary and outlook

As embodied intelligence data continues to grow, storage optimization requires overall governance across data organization, cache, metadata, background tasks, and network access paths. Going forward, the team will continue to improve business read probes, advance GPFS fragmentation management, complete independent metadata backup and recovery acceptance, and continuously validate the online effect of separating Cleaner from business mounts. On the infrastructure side, the team also proposes evaluating bare-metal servers for object storage deployment when conditions allow, to reduce virtualization layer resource contention.

We hope some of the practical experiences in this article can serve as a reference for developers facing similar problems. If you have other questions, you are welcome to join the JuiceFS community for discussion.