Migration toMobicents SIP Servlets Mobicents Summit 2012 Rio de Janeiro, Brazil
● Founded in 2003● Privately held● Operations in 150 countries● Corporate headquarters in Miami, Florida● Technical facilities in Virginia, Brazil, Argentina● Four primary lines of business ● InPhonex Business including ● InPhonex Resale ● InPhonex Personal ● InPhonex Platform Solutions
Reasons to Migrate● Currently using the old BEAs WebLogic 3.1 ○ JSR116 ○ Old version of JRockit ○ Bugs, etc.Looking for alternatives, we wanted a more dynamic solution.● Open Source● Active Maintainers● Active Community● Support● Response time for reported issues● Range of products ○ Mobicents SIP Servlets ○ RestComm ○ Media Server
Descriptor ChangesBEA is older and sip.xml doctype is from previous spec<!DOCTYPE sip-app PUBLIC "-//Java Community Process//DTD SIPApplication 1.0//EN" "sip-app_1_0.dtd">● Moved from servlet-mapping to servlet-selection to allow further configuration from the management console● Overall refactoring to avoid having to rely on the BEA JNDI.
Descriptor Changesweb.xml doctype is from previous spec<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTDWeb Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">● Everything else is the same
Application code changes● In BEA HTTP sessions are eagerly created so request.getSession().invalidate() is required, but in JBoss it throws exception because it is lazy-created● Derived sessions are invalidated together in BEA, in Mobicents they continue separately● Change the datasource JNDI lookup code● MAX_LISTENER_RESPONSE_TIME because of long 183s● Can not bind object to session that has been invalidated!!
Database configuration● Add the mysql driver in the server/default/lib directory● JBoss has completely different datasource deployment descriptors and configuration (see route-ds.xml)● BEA connection pooling vs DBCP (overall 90% the same options with different names)● BEA connection load balancing vs mysql JDBC driver built-in load balancing vs JBoss load balancing (large topic)● In the end the mysql driver can do equivalent load balancing of the writes with jdbc:mysql:loadbalance: //host1,host2/database
JBoss 7 datasources● Completely different from JBoss 5 datasource descriptors● Still uses DBCP, but the configuration file syntax is different
BEA IDE projectThe original inphonex project was Eclipse WTPproject with self-contained dependencies andsome BEA dependencies.
Moving to Maven● By far the most difficult task.● Swap the bea sip servlet api jar with the mobicents sip servlet api jar● Hunting down the required dependencies with google● Must use mvn clean war:inplace war:war install to be sure the build is refreshed ○ simply doing war:war caches an older copy sometimes
Logging● Three completely different logging configurations ○ JBoss AS 5 (log4j xml) ○ JBoss AS 7 (jboss logging + log4j behind it) ○ Tomcat (log4j propeties)
Logging in JBoss 5● In Mobicents STDOUT logging is rendered only as much as log4j allows, so application logging was moved to log4j● Log4j configuration entries may need to be added to jboss-log4j.xml for the app● Of course the logging output is completely different than BEA and log4j must be mastered
JBoss AS 7 Logging● Different from the JBoss 5 logging● Centralized configuration● https://community.jboss. org/wiki/JBossAS7Logging● Use admin console at http://127.0.0.1:9990 to make quick edits that take effect immediately ○ Output handlers ○ Categories ○ Levels ○ Somewhat like Oracle/BEA
How to isolate only the inphonexlogging into separate fileKnow your category and level<category name="com.inphonex"> <priority value="DEBUG"/> <appender-ref ref="MY_OWN_APPENDER"/></category>Make sure the appender and root thresholdsallow your level of logging<appender name="MY_OWN_APPENDER" class="org.jboss.logging.appender.DailyRollingFileAppender"> <param name="File" value="/log/inphonex.log"/> <param name="Threshold" value="DEBUG"/>
JRockit vs Hotspot● Most settings are portable between the JVMs, but JRockit management configuration is different and it lacks some diagnostic options● The hotspot parallel garbage collection with incremental CMS seems just as capable as jrockits for the current load● The garbage collection patterns are different
JVM optionsHotspot 1.6 anyJAVA_OPTS="-Xms2g -Xmx2g -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=7091 -Dcom.sun.management.jmxremote.ssl=false-Dcom.sun.management.jmxremote.authenticate=false -XX:+HeapDumpOnOutOfMemoryError -XX:PermSize=128M -XX:MaxPermSize=256M -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"JRockit R27.4.0-jdk1.5.0_12-server -Xms2048m -Xmx2048m -Xgc:gencon -XXnosystemgc -XXtlasize:min=3k -XXkeeparearatio=0-Xns:40m -Xmanagement:ssl=false,authenticate=false,port=7091 -XXdisableFatSpin -XX:+HeapDumpOnOutOfMemoryError -XX:-UseFatSpin -XX:+HeapDiagnosticsOnOutOfMemoryError(only available in R28, so no luck with those)
Management and Monitoring forMobicents● jconsole - JMX monitoring and management and JVM stats● http://127.0.0.1:8080/jmx-console - same with Web UI● http://127.0.0.1:8080/sip-servlets-management - Sip Servlets specific administration● http://127.0.0.1:8080/admin-console - JBoss global administration Web console● twiddle - command line tool for JMX management● http://127.0.0.1:9990 - JBoss 7 is much more like BEA, can configure the datasources in similar way● JBoss 7 suffers from https://issues.jboss. org/browse/JBAS-7427 ○ many hacks are needed to have a working JMX!
Management and Monitoring forJRockit and BEA● JRockit Mission Control - glorified jconsole● http://127.0.0.1:7001/console/console.portal ○ Unified Web UI for the BEA server, including SIP● Command line ○ Mission control from the command line (jrmc) ○ Application server administration from the command line ○ jrcmd - replaces the Hotspot JDK tools such as jps, jstack and so on