diff --git a/iac/provider-gcp/main.tf b/iac/provider-gcp/main.tf index 747fa95db3..36641e08f3 100644 --- a/iac/provider-gcp/main.tf +++ b/iac/provider-gcp/main.tf @@ -81,8 +81,13 @@ locals { "local_lock=none", // all locks are network locks // caching - "noac", // disable attribute caching. slower, but more reliable - "lookupcache=none", // disable lookup caching + // Bound cross-host staleness to ~1s while avoiding a Filestore RPC on every + // metadata op. Sandboxes mounting the same volume on different hosts still see + // peer writes within the attribute timer; strict coherency for shared mutable + // state should use NLM locks (already enabled via lock,local_lock=none) or an + // out-of-band signal. + "actimeo=1", // cap all attribute caches at 1 second + "lookupcache=positive", // cache hits; negative lookups still hit the server so new files appear promptly // security "noacl", // do not use an acl diff --git a/iac/provider-gcp/nomad-cluster/scripts/start-client.sh b/iac/provider-gcp/nomad-cluster/scripts/start-client.sh index e4d6f68d10..a1a5712051 100755 --- a/iac/provider-gcp/nomad-cluster/scripts/start-client.sh +++ b/iac/provider-gcp/nomad-cluster/scripts/start-client.sh @@ -83,6 +83,19 @@ echo "$SWAPFILE none swap sw 0 0" | tee -a /etc/fstab sysctl vm.swappiness=10 sysctl vm.vfs_cache_pressure=50 +# Increase RPC slot table so nconnect can actually parallelize. Default of 2 in-flight +# RPCs per TCP connection bottlenecks metadata-heavy NFS workloads (uncached lookups, +# many concurrent sandboxes). Modprobe options apply when sunrpc loads (first NFS mount); +# the runtime sysctl handles the case where the module is already loaded. +mkdir -p /etc/modprobe.d +cat <<'EOF' >/etc/modprobe.d/sunrpc.conf +options sunrpc tcp_slot_table_entries=128 tcp_max_slot_table_entries=128 +EOF +if [ -d /proc/sys/sunrpc ]; then + sysctl -w sunrpc.tcp_slot_table_entries=128 + sysctl -w sunrpc.tcp_max_slot_table_entries=128 +fi + # TODO: Optimize the mount more according to https://cloud.google.com/filestore/docs/mounting-fileshares %{ if USE_FILESTORE_CACHE } # Configure NFS read ahead