Add batch i/o to improve throughput (#2033)

* Add batch i/o to improve throughput

* remove empty line

* Solve comments

* Change rtcconfig.UDPPort to PortRange

* Fix test
This commit is contained in:
cnderrauber
2023-09-06 10:18:20 +08:00
committed by GitHub
parent 1590b96686
commit 9b9298b927
10 changed files with 21 additions and 15 deletions
+1 -2
View File
@@ -308,7 +308,6 @@ var DefaultConfig = Config{
RTCConfig: rtcconfig.RTCConfig{
UseExternalIP: false,
TCPPort: 7881,
UDPPort: 0,
ICEPortRangeStart: 0,
ICEPortRangeEnd: 0,
STUNServers: []string{},
@@ -802,7 +801,7 @@ func (conf *Config) updateFromCLI(c *cli.Context, baseFlags []cli.Flag) error {
conf.RTC.NodeIP = c.String("node-ip")
}
if c.IsSet("udp-port") {
conf.RTC.UDPPort = uint32(c.Int("udp-port"))
conf.RTC.UDPPort = rtcconfig.PortRange{Start: (c.Int("udp-port"))}
}
if c.IsSet("bind") {
conf.BindAddresses = c.StringSlice("bind")
-1
View File
@@ -661,7 +661,6 @@ func newParticipantForTestWithOpts(identity livekit.ParticipantIdentity, opts *p
}
conf, _ := config.NewConfig("", true, nil, nil)
// disable mux, it doesn't play too well with unit test
conf.RTC.UDPPort = 0
conf.RTC.TCPPort = 0
rtcConf, err := NewWebRTCConfig(conf)
if err != nil {
+1 -1
View File
@@ -556,7 +556,7 @@ func (r *RoomManager) rtcSessionWorker(room *rtc.Room, participant types.LocalPa
_ = r.refreshToken(participant)
tokenTicker := time.NewTicker(tokenRefreshInterval)
defer tokenTicker.Stop()
stateCheckTicker := time.NewTicker(time.Millisecond * 50)
stateCheckTicker := time.NewTicker(time.Millisecond * 500)
defer stateCheckTicker.Stop()
for {
select {
+1 -1
View File
@@ -220,7 +220,7 @@ func (s *LivekitServer) Start() error {
if s.config.RTC.TCPPort != 0 {
values = append(values, "rtc.portTCP", s.config.RTC.TCPPort)
}
if !s.config.RTC.ForceTCP && s.config.RTC.UDPPort != 0 {
if !s.config.RTC.ForceTCP && s.config.RTC.UDPPort.Valid() {
values = append(values, "rtc.portUDP", s.config.RTC.UDPPort)
} else {
values = append(values,