Skip to content

v3.14.0

Latest

Choose a tag to compare

@Tochemey Tochemey released this 18 Feb 19:59
· 2 commits to main since this release
Immutable release. Only release title and notes can be modified.
3d02f49

🚀 Oveview

This release brings multi-datacenter support, a high-performance protobuf-over-TCP remoting stack, and important fixes for channel pooling, timeouts, and data races. It also adds an option to disable grain relocation and several allocation and lock optimizations across the hot paths.

✨ What's New

🌐 Multi-datacenter support

  • DC-transparent messaging — actors and grains can communicate across datacenters without changing your code.
  • Pluggable control plane — use NATS JetStream or Etcd for coordination.
  • DC-aware placement — spawn actors in a specific datacenter with SpawnOn and the WithDataCenter option.
  • See the datacenter package and WithDataCenter for details.

🛡️ Grain relocation control

  • WithGrainDisableRelocation — disable actor/grain relocation when you don’t need it (e.g. stateless actors or short-lived grains).

🐛 Bug Fixes

Area Fix
Shutdown preShutdown no longer builds or persists peer state when relocation is disabled (WithoutRelocation), so shutdown proceeds correctly and avoids unnecessary cluster work.
Channel pool Fixed channel-pool poisoning in GrainContext.NoErr(): sending on both response and error channels for sync calls could corrupt the pool under scheduling races.
Timeouts Fixed localSend timeout/cancel paths returning channels to the pool while the grain goroutine could still write, preventing stale values in later requests.
Data race Fixed race in PID.recordProcessedMessage() by replacing the runtime type assertion on passivationStrategy with an atomic.Bool set at init.

⚡ Performance & Remoting

🌐 New remoting stack (protobuf over TCP)

ConnectRPC/HTTP-based remoting is replaced with a protobuf-over-TCP server and connection-pooling client:

  • Multi-loop TCP accept with SO_REUSEPORT, TCP_FASTOPEN, and TCP_DEFER_ACCEPT for lower connection-setup latency and kernel-level load balancing.
  • Sharded WorkerPool for connection dispatch, reducing contention under high concurrency.
  • Length-prefixed wire protocol with dynamic protobuf type dispatch via the global registry (no per-service stubs or HTTP path routing).
  • FramePool with power-of-two bucketed sync.Pool (256 B – 4 MiB) for read buffers and frame slices to cut heap allocations and GC pressure.
  • LIFO connection pool in the TCP client with lazy stale-connection eviction and no background goroutines.
  • Pluggable ConnWrapper compression (Zstandard, Brotli, Gzip) on both client and server.

♻️ Pooling & allocation

  • Bounded channel-based pools instead of sync.Pool for ReceiveContext, GrainContext, and response/error channels on the Tell, Ask, SendAsync, and SendSync hot paths to avoid cross-P thrashing and madvise overhead.
  • PID.latestReceiveTimeNano switched from atomic.Time to atomic.Int64 (Unix nanoseconds) to remove ~24-byte interface allocations per message.
  • Cached Address.String() and GrainIdentity.String() to avoid repeated fmt.Sprintf on every message.
  • Mailbox nodes in UnboundedMailbox and grainMailbox use plain pointers instead of atomic.Pointer on enqueue/dequeue.
  • Inlined defer closures in Ask-path functions (PID.Ask, actor.Ask, handleRemoteAsk, grain localSend) to remove per-call closure allocations.

🔓 Locking & contention

  • ActorOf does local actor lookup before taking the system-wide RWMutex; SendAsync/SendSync bypass the PID.ActorSystem() getter lock, reducing read-lock acquisitions from three to one on the local path.
  • passivationManager.Touch coalesced via an atomic timestamp guard (lastPassivationTouch), so mutex contention drops from once-per-message to at most once per 100 ms.

📦 Upgrade notes

  • Remoting now uses the new TCP-based stack by default. No API changes are required for typical usage.
  • Use WithGrainDisableRelocation when you want to skip relocation for certain grains.
  • For multi-DC setups, use the datacenter package and WithDataCenter with SpawnOn.

🔗 Pull requests

Features & refactors

Dependencies & tooling


Full Changelog: v3.13.0...v3.14.0