mirror of
https://github.com/libp2p/go-libp2p-resource-manager.git
synced 2025-03-24 16:20:55 +08:00
add a DefaultLimitConfig with infinite limits
This is useful when recording a trace to observe the baseline resource consumption.
This commit is contained in:
parent
5224eb6ad6
commit
005b976a8c
@ -1,5 +1,7 @@
|
|||||||
package rcmgr
|
package rcmgr
|
||||||
|
|
||||||
|
import "math"
|
||||||
|
|
||||||
// DefaultLimitConfig is a struct for configuring default limits.
|
// DefaultLimitConfig is a struct for configuring default limits.
|
||||||
type DefaultLimitConfig struct {
|
type DefaultLimitConfig struct {
|
||||||
SystemBaseLimit BaseLimit
|
SystemBaseLimit BaseLimit
|
||||||
@ -160,3 +162,42 @@ var DefaultLimits = DefaultLimitConfig{
|
|||||||
|
|
||||||
StreamMemory: 16 << 20,
|
StreamMemory: 16 << 20,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var infiniteBaseLimit = BaseLimit{
|
||||||
|
Streams: math.MaxInt,
|
||||||
|
StreamsInbound: math.MaxInt,
|
||||||
|
StreamsOutbound: math.MaxInt,
|
||||||
|
Conns: math.MaxInt,
|
||||||
|
ConnsInbound: math.MaxInt,
|
||||||
|
ConnsOutbound: math.MaxInt,
|
||||||
|
FD: math.MaxInt,
|
||||||
|
}
|
||||||
|
|
||||||
|
var infiniteMemoryLimit = MemoryLimit{
|
||||||
|
MemoryFraction: 1,
|
||||||
|
MinMemory: math.MaxInt64,
|
||||||
|
MaxMemory: math.MaxInt64,
|
||||||
|
}
|
||||||
|
|
||||||
|
// InfiniteLimits are a limiter configuration that uses infinite limits, thus effectively not limiting anything.
|
||||||
|
// Keep in mind that the operating system limits the number of file descriptors that an application can use.
|
||||||
|
var InfiniteLimits = DefaultLimitConfig{
|
||||||
|
SystemBaseLimit: infiniteBaseLimit,
|
||||||
|
SystemMemory: infiniteMemoryLimit,
|
||||||
|
TransientBaseLimit: infiniteBaseLimit,
|
||||||
|
TransientMemory: infiniteMemoryLimit,
|
||||||
|
ServiceBaseLimit: infiniteBaseLimit,
|
||||||
|
ServiceMemory: infiniteMemoryLimit,
|
||||||
|
ServicePeerBaseLimit: infiniteBaseLimit,
|
||||||
|
ServicePeerMemory: infiniteMemoryLimit,
|
||||||
|
ProtocolBaseLimit: infiniteBaseLimit,
|
||||||
|
ProtocolMemory: infiniteMemoryLimit,
|
||||||
|
ProtocolPeerBaseLimit: infiniteBaseLimit,
|
||||||
|
ProtocolPeerMemory: infiniteMemoryLimit,
|
||||||
|
PeerBaseLimit: infiniteBaseLimit,
|
||||||
|
PeerMemory: infiniteMemoryLimit,
|
||||||
|
ConnBaseLimit: infiniteBaseLimit,
|
||||||
|
ConnMemory: math.MaxInt64,
|
||||||
|
StreamBaseLimit: infiniteBaseLimit,
|
||||||
|
StreamMemory: math.MaxInt64,
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user