msgbartop
Various ramblings-on, mostly about Red5
msgbarbottom

28 Sep 08 Tomcat connectors

In Red5, you have pretty much full access to manipulate the embedded Tomcat engine via Spring. With that being said I would like to give details on how to change the http connector between two available options; there are several other options, but I’ll only be covering NIO and BIO. First a quick explanation of these two options:

  • BIO – Blocking Input / Output, this has been around since the beginning of internet time. It uses one thread per socket connnection to handle requests.
  • NIO – Non-blocking Input / Output, this has been available in the JDK since 1.4. It uses a single thread to handle many socket connections.
In most cases, you should find NIO to be much faster and more able to handle a lot more connections than BIO will. The default connector was set to NIO until today when I switched it to BIO to prevent problems with Unix-based systems (OSX / Linux).
The configuration of Tomcat in Red5 for HTTP, RTMPT, and RTMPS is nearly identical so you may apply the configuration items below to any of the embedded servers. To configure with a BIO connector, locate the connector section and change the constructor arg value:

<property name=”connector”>
  <bean class=”org.apache.catalina.connector.Connector”>
    <constructor-arg type=”java.lang.String” value=”org.apache.coyote.http11.Http11Protocol” />
    <property name=”port”><value>80</value></property>
    <property name=”redirectPort”><value>443</value></property>
    <property name=”enableLookups”><value>false</value></property>
  </bean>
</property>

To use the NIO connector simply change the constructor arg as shown below:

<property name=”connector”>
  <bean class=”org.apache.catalina.connector.Connector”>
    <constructor-arg type=”java.lang.String” value=”org.apache.coyote.http11.Http11NioProtocol” />
    <property name=”port”><value>80</value></property>
    <property name=”redirectPort”><value>443</value></property>
    <property name=”enableLookups”><value>false</value></property>
  </bean>
</property>

Tags: , , , , , , , ,



Reader's Comments

  1. |

    What kind of problems did you have? Did you try to disable epoll in the arguments to the Java VM?

  2. |

    I didnt look into it, I just went by all the problems posted on the list. Have you found success disabling the epoll?

  3. |

    No, but I’ve recently stumbled over at least two blog posts which mentioned the problem. I can only find one which is this one:

    http://www.rogue-development.com/blog2/2007/09/red5-11-and-epoll/

    From 2007 which means its quite old but maybe worth a try…

  4. |

    hey u know how to change the version of tomcat that is automatically called by the red5 start up batch file?



Leave a Comment


Fatal error: Call to undefined function akismet_counter() in C:\xampp\htdocs\paulgregoireblog\wp-content\themes\googlechrome\footer.php on line 9