fix: close stream adaptive gaps and switch notify to stario v0.1.1

- make stream fast path honor adaptive soft payload limits end-to-end
  - split oversized fast-stream payloads into sequential frames before batching
  - use adaptive soft cap when encoding stream batch payloads
  - move timeout-like error detection into production code for adaptive tx
  - tune notify FrameReader read size explicitly to avoid throughput regression
  - drop local stario replace and depend on released b612.me/stario v0.1.1
This commit is contained in:
2026-04-18 16:05:57 +08:00
parent 4f760f2807
commit f038a89771
76 changed files with 12656 additions and 906 deletions
+91 -38
View File
@@ -6,18 +6,34 @@ import (
)
type ClientRuntimeSnapshot struct {
OwnerState string
Alive bool
SessionEpoch uint64
TransportAttached bool
HasRuntimeConn bool
HasRuntimeQueue bool
HasRuntimeStopCtx bool
ConnectSource string
ConnectNetwork string
ConnectAddress string
CanReconnect bool
Retry ConnectionRetrySnapshot
OwnerState string
Alive bool
SessionEpoch uint64
TransportAttached bool
HasRuntimeConn bool
HasRuntimeQueue bool
HasRuntimeStopCtx bool
ConnectSource string
ConnectNetwork string
ConnectAddress string
CanReconnect bool
BulkNetworkProfile string
BulkDefaultMode string
BulkChunkSize int
BulkWindowBytes int
BulkMaxInFlight int
BulkAttachLimit int
BulkActiveLimit int
BulkLaneLimit int
BulkAttachAttempts int64
BulkAttachRetries int64
BulkAttachSuccess int64
BulkAutoFallbacks int64
TransportBulkAdaptiveSoftPayloadBytes int
TransportStreamAdaptiveSoftPayloadBytes int
TransportStreamAdaptiveWaitThresholdBytes int
TransportStreamAdaptiveFlushDelay time.Duration
Retry ConnectionRetrySnapshot
}
type ServerRuntimeSnapshot struct {
@@ -33,36 +49,43 @@ type ServerRuntimeSnapshot struct {
HasRuntimeUDPListener bool
HasRuntimeQueue bool
HasRuntimeStopCtx bool
BulkChunkSize int
BulkWindowBytes int
BulkMaxInFlight int
Retry ConnectionRetrySnapshot
}
type ClientConnRuntimeSnapshot struct {
ClientID string
RemoteAddress string
Alive bool
Reason string
Error string
IdentityBound bool
UsesStreamTransport bool
TransportGeneration uint64
TransportAttached bool
HasRuntimeConn bool
HasRuntimeStopCtx bool
TransportAttachCount uint64
TransportDetachCount uint64
LastTransportAttachAt time.Time
DetachedClientKeepSec int64
LastHeartbeatAt time.Time
TransportDetachReason string
TransportDetachKind string
TransportDetachGeneration uint64
TransportDetachError string
TransportDetachedAt time.Time
TransportDetachHasExpiry bool
TransportDetachExpiry time.Time
TransportDetachRemaining time.Duration
TransportDetachExpired bool
ReattachEligible bool
ClientID string
RemoteAddress string
Alive bool
Reason string
Error string
IdentityBound bool
UsesStreamTransport bool
TransportGeneration uint64
TransportAttached bool
HasRuntimeConn bool
HasRuntimeStopCtx bool
TransportAttachCount uint64
TransportDetachCount uint64
LastTransportAttachAt time.Time
DetachedClientKeepSec int64
LastHeartbeatAt time.Time
TransportDetachReason string
TransportDetachKind string
TransportDetachGeneration uint64
TransportDetachError string
TransportDetachedAt time.Time
TransportDetachHasExpiry bool
TransportDetachExpiry time.Time
TransportDetachRemaining time.Duration
TransportDetachExpired bool
ReattachEligible bool
TransportBulkAdaptiveSoftPayloadBytes int
TransportStreamAdaptiveSoftPayloadBytes int
TransportStreamAdaptiveWaitThresholdBytes int
TransportStreamAdaptiveFlushDelay time.Duration
}
func (c *ClientCommon) clientRuntimeSnapshot() ClientRuntimeSnapshot {
@@ -85,6 +108,26 @@ func (c *ClientCommon) clientRuntimeSnapshot() ClientRuntimeSnapshot {
snapshot.ConnectAddress = source.addr
snapshot.CanReconnect = source.canReconnect()
}
snapshot.BulkNetworkProfile = bulkNetworkProfileName(c.BulkNetworkProfile())
snapshot.BulkDefaultMode = bulkOpenModeName(c.BulkDefaultOpenMode())
tuning := c.BulkOpenTuning()
cfg := c.BulkDedicatedAttachConfig()
snapshot.BulkChunkSize = tuning.ChunkSize
snapshot.BulkWindowBytes = tuning.WindowBytes
snapshot.BulkMaxInFlight = tuning.MaxInFlight
snapshot.BulkAttachLimit = cfg.AttachLimit
snapshot.BulkActiveLimit = cfg.ActiveLimit
snapshot.BulkLaneLimit = cfg.LaneLimit
snapshot.BulkAttachAttempts = c.bulkAttachAttemptCount.Load()
snapshot.BulkAttachRetries = c.bulkAttachRetryCount.Load()
snapshot.BulkAttachSuccess = c.bulkAttachSuccessCount.Load()
snapshot.BulkAutoFallbacks = c.bulkAttachFallbackCount.Load()
if binding := c.clientTransportBindingSnapshot(); binding != nil {
snapshot.TransportBulkAdaptiveSoftPayloadBytes = binding.bulkAdaptiveSoftPayloadBytesSnapshot()
snapshot.TransportStreamAdaptiveSoftPayloadBytes = binding.streamAdaptiveSoftPayloadBytesSnapshot()
snapshot.TransportStreamAdaptiveWaitThresholdBytes = binding.streamAdaptiveWaitThresholdBytesSnapshot()
snapshot.TransportStreamAdaptiveFlushDelay = binding.streamAdaptiveFlushDelaySnapshot()
}
snapshot.Retry = c.connectionRetrySnapshot()
return snapshot
}
@@ -118,6 +161,10 @@ func (s *ServerCommon) serverRuntimeSnapshot() ServerRuntimeSnapshot {
snapshot.HasRuntimeQueue = rt.queue != nil
snapshot.HasRuntimeStopCtx = rt.stopCtx != nil
}
tuning := s.BulkOpenTuning()
snapshot.BulkChunkSize = tuning.ChunkSize
snapshot.BulkWindowBytes = tuning.WindowBytes
snapshot.BulkMaxInFlight = tuning.MaxInFlight
snapshot.Retry = s.connectionRetrySnapshot()
return snapshot
}
@@ -153,6 +200,12 @@ func (c *ClientConn) clientConnRuntimeSnapshot() ClientConnRuntimeSnapshot {
snapshot.HasRuntimeConn = c.clientConnTransportSnapshot() != nil
snapshot.HasRuntimeStopCtx = rt.stopCtx != nil
}
if binding := c.clientConnTransportBindingSnapshot(); binding != nil {
snapshot.TransportBulkAdaptiveSoftPayloadBytes = binding.bulkAdaptiveSoftPayloadBytesSnapshot()
snapshot.TransportStreamAdaptiveSoftPayloadBytes = binding.streamAdaptiveSoftPayloadBytesSnapshot()
snapshot.TransportStreamAdaptiveWaitThresholdBytes = binding.streamAdaptiveWaitThresholdBytesSnapshot()
snapshot.TransportStreamAdaptiveFlushDelay = binding.streamAdaptiveFlushDelaySnapshot()
}
if detach := c.clientConnTransportDetachSnapshot(); detach != nil {
snapshot.TransportDetachReason = detach.Reason
snapshot.TransportDetachKind = c.clientConnTransportDetachKindSnapshot()