Batch subscriber updates to reduce noise (#703)
Improve scalability by batching subscriber updates on an interval. When lots of subscribers join, the server ends up spending 20% CPU sending each state change to everyone. There's a non-trivial amount of overhead with each send operation. For publishers, updates are sent right away.
This commit is contained in:
@@ -328,6 +328,7 @@ func TestSubscriberAsPrimary(t *testing.T) {
|
||||
type participantOpts struct {
|
||||
permissions *livekit.ParticipantPermission
|
||||
protocolVersion types.ProtocolVersion
|
||||
publisher bool
|
||||
}
|
||||
|
||||
func newParticipantForTestWithOpts(identity livekit.ParticipantIdentity, opts *participantOpts) *ParticipantImpl {
|
||||
@@ -362,6 +363,8 @@ func newParticipantForTestWithOpts(identity livekit.ParticipantIdentity, opts *p
|
||||
PLIThrottleConfig: conf.RTC.PLIThrottle,
|
||||
Grants: grants,
|
||||
})
|
||||
p.isPublisher.Store(opts.publisher)
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user