Reducing RTMPT disconnects on RED5

This specific content was written 8 years ago. Please keep this in mind as it may be outdated and not adhering to best-practices.

RED5RTMPT streams provided by RED5 are notorious for randomly disconnecting.

Chris Georgoulis and I extensively debugged this for a project and were able to reduce the disconnection rate from 90% to 40% for connections that lasted over 5 minutes. This was for a teleconferencing application that required 4 RTMPT streams in total (2 outgoing, 2 incoming) with a maximum buffer of 200ms.

RED5 by default has a maximum of 100 keep-alive requests. On the 100th request the server returns connection-close . By setting the limit to infinite we were able to improve the performance. RTMPT is quite vulnerable to disconnections and closing and reopening the socket connection plays a role.

As described by Chris, please go to /{red5_folder}/conf/jee-container.xml and modify the following element group with the extra <property> tags(this should be at line 21), and then restart red5:

<property name="connectors">
<list>
<bean name="httpConnector" class="org.red5.server.tomcat.TomcatConnector">
<property name="protocol" value="org.apache.coyote.http11.Http11NioProtocol"/>
<property name="address" value="${http.host}:${http.port}"/>
<property name="redirectPort" value="${https.port}"/>
<property name="connectionProperties">
<map>
<entry key="maxKeepAliveRequests" value="-1"/>
<entry key="keepAliveTimout" value="-1"/>
</map>
</property>
</bean>
</list>
</property>



Menelaos Bakopoulos

Mr. Menelaos Bakopoulos is currently pursuing his PhD both at Center for TeleInFrastruktur (CTiF) at Aalborg University (AAU) in Denmark and Athens Information Technology (AIT) in Athens, Greece. He received a Master in Information Technology and Telecommunications Systems from Athens Information Technology and a B.Sc. in Computer Science & Management Information Systems from the American College of Thessaloniki. Since April 2008 he has been a member of the Multimedia, Knowledge, and Web Technologies Group.

More Posts