Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/codec/raptorq.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const (
rqSymbolSize uint16 = 65535
rqRedundancyFactor uint8 = 6
// Limit RaptorQ processor memory usage to ~2 GiB
rqMaxMemoryMB uint64 = 16 * 1024 // MB
rqMaxMemoryMB uint64 = 2 * 1024 // MB
// Concurrency tuned for 2 GiB limit and typical 8+ core CPUs
rqConcurrency uint64 = 6
// Target single-block output for up to 1 GiB files with padding headroom (~1.25 GiB)
Expand Down
16 changes: 8 additions & 8 deletions supernode/node/supernode/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ func (server *Server) Run(ctx context.Context) error {
logtrace.Fatal(ctx, "Failed to setup gRPC server", logtrace.Fields{logtrace.FieldModule: "server", logtrace.FieldError: err.Error()})
}

// Optimized for streaming 1GB files with 4MB chunks (10 concurrent streams)
// Tuned for 1GB max files with 4MB chunks. Reduce in-flight memory.
opts := grpcserver.DefaultServerOptions()

opts.MaxRecvMsgSize = (16 * 1024 * 1024) // 16MB (supports 4MB chunks + overhead)
opts.MaxSendMsgSize = (16 * 1024 * 1024) // 16MB for download streaming
opts.InitialWindowSize = (16 * 1024 * 1024) // 16MB per stream (4x chunk size)
opts.InitialConnWindowSize = (160 * 1024 * 1024) // 160MB (16MB x 10 streams)
opts.MaxConcurrentStreams = 20 // Limit to prevent resource exhaustion
opts.ReadBufferSize = (8 * 1024 * 1024) // 8MB TCP buffer
opts.WriteBufferSize = (8 * 1024 * 1024) // 8MB TCP buffer
opts.MaxRecvMsgSize = (8 * 1024 * 1024) // 8MB supports 4MB chunks + overhead
opts.MaxSendMsgSize = (8 * 1024 * 1024) // 8MB for download streaming
opts.InitialWindowSize = (4 * 1024 * 1024) // 4MB per-stream window ~ chunk size
opts.InitialConnWindowSize = (64 * 1024 * 1024) // 64MB per-connection window
opts.MaxConcurrentStreams = 20 // Prevent resource exhaustion
opts.ReadBufferSize = (1 * 1024 * 1024) // 1MB TCP buffer
opts.WriteBufferSize = (1 * 1024 * 1024) // 1MB TCP buffer

for _, address := range addresses {
addr := net.JoinHostPort(strings.TrimSpace(address), strconv.Itoa(server.config.Port))
Expand Down