Tuning and development with     SIP Servlet on MobicentsNaoki NishiharaOKI Electric Industry Co.,LtdJean DeruelleMobicents...
Agenda•    Introduction•    SIP Application behavior•    How to tune the JavaVM for SIP Servlet•    How to develop SIP Ser...
Introduction–  Mobicents fellow  •  Member of mobicents core team from March     2011–  Leading mobicents SSF project  •  ...
About OKI•  Founded  –  January 1881•  Major Operation  –  Manufacturing and sales of products,     technologies, software...
Current works•  Support Japanese carrier (They are evaluating the OSS platform)•  Customize MSS for proprietary  ex) NOT i...
SIP Servlet Behavior
SIP Servlet Behavior (1)•  To establish one session, some   messages are sent and received.
Basic B2BUA sequenceUAC                   MSS                    UAS      INVITE                                 INVITE   ...
SIP Servlet Behavior (2)•  Many object will be generated in one   sequence.
Created instances   After 10,000 calls (NOT TERMINATED SESSION)                                                 Instance c...
Mobicents SIP Servlet          own behavior•  JAIN-SIP, SIP Servlet, JBoss(J2EE)…   About 200 Threads run on MSS   (for tr...
Other problems related to SIP•  Retransmissions will occur, if response was   sent late over 500ms with UDP transport   – ...
Conclusion•  MSS will discard many objects in one session.•  When retransmissions of UDP messages occurred,   –  Many thre...
How To Tune the Java VM
Plan•  Reduce retransmissions of UDP  –  Response time less than 200ms  –  Measure the performance on tuned JVM     •  400...
Test Sequence        UAC                   Mobicnets                UAS                INVITE                             ...
Recommended Sun Java VM          Options•  -server   –  -XX:+UseTLAB is enabled.•  -XX:+UseConcMarkSweepGC   –  CMS GC red...
Other performance options(1)•  -XX:MaxTenuringThreshold=0 -XX:SurvivorRatio=128   –  Object that related to SipSessions wi...
Other performance options (2)•  -XX:+UseStringCache   –  Enables caching of commonly allocated strings•  -XX:+OptimizeStri...
Data and results1.    Default GC2.    CMS GC without tuning the duty cycle3.    CMS GC with tuning the duty cycle4.    Add...
GC options (1)-Xms6g-Xmx6g-XX:PermSize=256m-XX:MaxPermSize=256m
Default GC                   Over thousands failed calls                   And retransmissions“Stop The World”     Thousan...
GC options (2)-Xms6g-Xmx6g-XX:PermSize=256m-XX:MaxPermSize=256m-XX:UseConcMarkSweepGC-XX:+CMSIncrementalMode
CMS GCwithout tuning the duty cycleCPU usage increased     0 failed call                      Decreased  GC pause time    ...
GC options (3)-XX:UseConcMarkSweepGC-XX:+CMSIncrementalMode-XX:-CMSIncrementalPacing	-XX:CMSIncrementalDutyCycle=100-XX:CM...
CMS GC with      tuning the duty cycleCPU usage decreased                      Retransmissions decreased                  ...
GC options (4)-XX:-CMSIncrementalPacing	-XX:CMSIncrementalDutyCycle=100-XX:CMSIncrementalDutyCycleMin=100-XX:+UseStringCac...
Add parallel NewGC and      performance options  CPU usage decreased                         Retransmissions increased    ...
Results•  Recommended VM options are useful.  –  Reduce pause times  –  No failed calls  –  Reduce retransmissions•  Tunin...
Developing SIP Servlet with       frameworks
SIP Servlet FrameworksMobicents has 2 SIP Servlet Frameworks• SSF (Spring Signaling Framework)   –  Based on Spring Framew...
Spring Signaling Framework           SSF
How to develop SIP Servlet  application with SSF
Why using Spring Framework?•  Standard DI Container  –  Familiar to many Java Developers•  Customizable Context  –  SSF pr...
Create SIP Servlet with POJO@Component                                                              Component Scanpublic c...
Easy to add functions•  Of course, you can use AOP function•  Try to add the Call-Blocking function to   the proxy service...
Add Call-Blocking function (1)•  Create new POJO for Call-Blocking @Component public class CallBlockingBean {   public voi...
Add Call-Blocking function(2)•  Create Aspect class for Advice @Aspect public class ProxyAround {   @Autowired   CallBlock...
Add Call-Blocking function (3)•  Add configurations for AOP     <aop:aspectj-autoproxy proxy-target-class="true"/>      <c...
CDI-Telco-Framework        CTF
CDI JSR-299CDI is the Java standard for dependency injection andcontextual lifecycle management, led by Gavin King forRed ...
CDI-Telco-Framework 	Mobicents brings the power and productivity benefits of CDI intothe Mobicents Sip Servlets platform p...
CDI-Telco-Framework 	Mission Statement  •  simplify SipServlets development by     introducing a clean programming model  ...
CDI-Telco-Framework 	public class SipRegistarClient {....@InjectSipFactory sipFactory;protected void doRegister(@Observes ...
Contact•  Naoki Nishihara  –  nisihara562@gmail.com•  Jean Deruelle  –  jean.deruelle@gmail.com•  Georges  –  gvagenas@gma...
Gratitude
Appendix
Configuration•  mss-1.6.0-snapshot-jboss-   jdk6-5.1.0GA-1103310643  –  With Simple B2BUA application•  SIPp as UAC & UAS•...
Target server machineHP PROLIANT DL360 G6(504634-291)•  Intel(R) Xeon(R) CPU E5540 @   2.53GHz stepping 05  –  4 core•  Me...
Default GC
Long Load
Over Load
Tunning mobicent-jean deruelle
Upcoming SlideShare
Loading in …5
×

Tunning mobicent-jean deruelle

1,328 views

Published on

Performance Tuning Mobicents SIP Servlets. JUDCon 2011 presentation by Jean Deruelle and Naoki Nishihara.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,328
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
20
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Tunning mobicent-jean deruelle

  1. 1. Tuning and development with SIP Servlet on MobicentsNaoki NishiharaOKI Electric Industry Co.,LtdJean DeruelleMobicents Sip Servlets Lead
  2. 2. Agenda•  Introduction•  SIP Application behavior•  How to tune the JavaVM for SIP Servlet•  How to develop SIP Servlet Application with Frameworks
  3. 3. Introduction–  Mobicents fellow •  Member of mobicents core team from March 2011–  Leading mobicents SSF project •  For developing SIP Servlet Application with Spring Framework–  OKI has been involved SIP Servlet development since 2003
  4. 4. About OKI•  Founded –  January 1881•  Major Operation –  Manufacturing and sales of products, technologies, software and solutions for telecommunications systems and information systems
  5. 5. Current works•  Support Japanese carrier (They are evaluating the OSS platform)•  Customize MSS for proprietary ex) NOT include internal IP Address in SIP header fields•  Developing customized SIP Load balancer
  6. 6. SIP Servlet Behavior
  7. 7. SIP Servlet Behavior (1)•  To establish one session, some messages are sent and received.
  8. 8. Basic B2BUA sequenceUAC MSS UAS INVITE INVITE 180/INVITE 180/INVITE 200/INVITE 200/INVITE • 2 dialogs ACK • 6 transactions ACK • 12 messages Established Session BYE BYE 200/BYE 200/BYE
  9. 9. SIP Servlet Behavior (2)•  Many object will be generated in one sequence.
  10. 10. Created instances After 10,000 calls (NOT TERMINATED SESSION) Instance counts gov.nist.core. NameValueList :810,041 NameValue :330,015 HostPort :310,036 Host :310,036 DuplicateNameValueList :290,049 MultiValueMapImpl :290,049gov.nist.javax.sip. SipURI :240,006 Authority :240,006 AddressImpl :210,003
  11. 11. Mobicents SIP Servlet own behavior•  JAIN-SIP, SIP Servlet, JBoss(J2EE)… About 200 Threads run on MSS (for transport, timer, cluster…)
  12. 12. Other problems related to SIP•  Retransmissions will occur, if response was sent late over 500ms with UDP transport –  In normal case, UDP transport will be used.•  If JVM was stopped long time by GC –  Call failure will be occurred and error handling may not work properly. –  SIP has many timers, they could not work properly.•  It’s relatively easy to retry with HTTP, but you would have to start over from scratch to initiate session with SIP
  13. 13. Conclusion•  MSS will discard many objects in one session.•  When retransmissions of UDP messages occurred, –  Many threads runs at the same time –  Many objects are discarded –  CPU usage go up –  GC will be missed –  Full GC will run Fall in a vicious cycle
  14. 14. How To Tune the Java VM
  15. 15. Plan•  Reduce retransmissions of UDP –  Response time less than 200ms –  Measure the performance on tuned JVM •  400call/sec(1440,000BHCA) •  Effective use of multiple CPU –  Most of server-machine have multiple CPU•  Reduce pause times by “Stop-The-World”
  16. 16. Test Sequence UAC Mobicnets UAS INVITE INVITE 180/INVITE 180/INVITE 200/INVITE 10sec 200/INVITE ACK ACK30sec Established Session BYE BYE 200/BYE 200/BYE About 16,000 sessions will remain on JVM
  17. 17. Recommended Sun Java VM Options•  -server –  -XX:+UseTLAB is enabled.•  -XX:+UseConcMarkSweepGC –  CMS GC reduce the “Stop the World”. •  -XX:+CMSIncrementalMode –  Enable the incremental mode. You should tune the below options •  -XX:CMSIncrementalDutyCycle=<N> •  -XX:CMSIncrementalDutyCycleMin=<N>
  18. 18. Other performance options(1)•  -XX:MaxTenuringThreshold=0 -XX:SurvivorRatio=128 –  Object that related to SipSessions will NOT be collected in NewGC. This option will make the full NewSize available to every NewGC cycle.•  -XX:+UseParNewGC –  Enable a parallel young generation GC. (for multiple cpu machine)•  -XX:CMSInitiatingOccupancyFraction=75 –  Set the level at which the collection is started•  -XX:+CMSParallelRemarkEnabled –  Reduce remark pause with multi threads
  19. 19. Other performance options (2)•  -XX:+UseStringCache –  Enables caching of commonly allocated strings•  -XX:+OptimizeStringConcat –  Optimize String concatenation operations where possible•  -XX:+UseCompressedStrings –  Use a byte[] for Strings which can be represented as pure ascii•  -XX:+UseCompressedOops –  Enables the use of compressed pointers for optimized 64-bit performance
  20. 20. Data and results1.  Default GC2.  CMS GC without tuning the duty cycle3.  CMS GC with tuning the duty cycle4.  Add parallel NewGC and performance options Analyze: GC, CPU usage, failed call, succeeded call, Retransmissions, Average response time,…
  21. 21. GC options (1)-Xms6g-Xmx6g-XX:PermSize=256m-XX:MaxPermSize=256m
  22. 22. Default GC Over thousands failed calls And retransmissions“Stop The World” Thousands responsesabout 8 seconds took more than 200ms
  23. 23. GC options (2)-Xms6g-Xmx6g-XX:PermSize=256m-XX:MaxPermSize=256m-XX:UseConcMarkSweepGC-XX:+CMSIncrementalMode
  24. 24. CMS GCwithout tuning the duty cycleCPU usage increased 0 failed call Decreased GC pause time time-consuming less than 100ms response
  25. 25. GC options (3)-XX:UseConcMarkSweepGC-XX:+CMSIncrementalMode-XX:-CMSIncrementalPacing -XX:CMSIncrementalDutyCycle=100-XX:CMSIncrementalDutyCycleMin=100
  26. 26. CMS GC with tuning the duty cycleCPU usage decreased Retransmissions decreased Decreased GC pause time time-consuming less than 100ms response
  27. 27. GC options (4)-XX:-CMSIncrementalPacing -XX:CMSIncrementalDutyCycle=100-XX:CMSIncrementalDutyCycleMin=100-XX:+UseStringCache-XX:+OptimizeStringConcat-XX:+UseCompressedStrings-XX:MaxTenuringThreshold=0-XX:SurvivorRatio=128-XX:+UseParNewGC-XX:+UseCompressedOops-XX:CMSInitiatingOccupancyFraction=75-XX:+CMSParallelRemarkEnabled
  28. 28. Add parallel NewGC and performance options CPU usage decreased Retransmissions increased IncreasedMemory usage decreased time-consuming response
  29. 29. Results•  Recommended VM options are useful. –  Reduce pause times –  No failed calls –  Reduce retransmissions•  Tuning options of the duty cycle are very useful•  Other performance options are slightly useful
  30. 30. Developing SIP Servlet with frameworks
  31. 31. SIP Servlet FrameworksMobicents has 2 SIP Servlet Frameworks• SSF (Spring Signaling Framework) –  Based on Spring Framework• CTF(CDI-Telco-Framework) –  CDI Based frameworkThese frameworks have same concept… Simplify SipServlets developmentWe want to merge these framework’s functions andsupport many developers!
  32. 32. Spring Signaling Framework SSF
  33. 33. How to develop SIP Servlet application with SSF
  34. 34. Why using Spring Framework?•  Standard DI Container –  Familiar to many Java Developers•  Customizable Context –  SSF provide customized Context for SIP Servlet•  Many functionality modules are working on Spring Framework. –  You can create the converged application with Spring Framework modules.
  35. 35. Create SIP Servlet with POJO@Component Component Scanpublic class ProxyHandler { @Autowired Autowired ProxyBean proxyBean; @Autowired CheckRequireBean checkRequire; @SipServletRequestMapping(methods = { "INVITE", "UPDATE", Original annotation "MESSAGE", "PUBLISH" }) public void handleRequest(SipServletRequest req) throws Exception { // start checkRequire.handleRequest(req); Call bean’s method if (req.isCommitted()) { return; } proxyBean.startProxy(req); // end } ….
  36. 36. Easy to add functions•  Of course, you can use AOP function•  Try to add the Call-Blocking function to the proxy service. 
  37. 37. Add Call-Blocking function (1)•  Create new POJO for Call-Blocking @Component public class CallBlockingBean { public void handleRequest(SipServletRequest req) throws IOException { if(isBlocked(req)) { SipServletResponse res = req.createResponse(SipServletResponse.SC_SERVICE_UNAVAILABLE); res.send(); return; } } ….
  38. 38. Add Call-Blocking function(2)•  Create Aspect class for Advice @Aspect public class ProxyAround { @Autowired CallBlockingBean callBlocking; @Around(“execution(ProxyHandler.handleRequest(..)) && args(req)”) public void handleRequest(ProceedingJointPoint pjp, SipServletRequest req) throws IOException { callBlocking.handleRequest(req); pjp.proceed(new Object[]{req}); } ….
  39. 39. Add Call-Blocking function (3)•  Add configurations for AOP <aop:aspectj-autoproxy proxy-target-class="true"/> <context:component-scan base-package="org.mobicents.ssf.examples.sip.beans"> <context:include-filter type="aspectj" expression="org..ProxyAround*" /> </context:component-scan> <context:component-scan base-package="org.mobicents.ssf.examples.sip.sipserver“/> Just Do It! 
  40. 40. CDI-Telco-Framework CTF
  41. 41. CDI JSR-299CDI is the Java standard for dependency injection andcontextual lifecycle management, led by Gavin King forRed Hat, Inc. and is a Java Community Process(JCP)specification that integrates cleanly with the Java EEplatform. Any Java EE 6-compliant application serverprovides support for JSR-299 (even the web profile).• Loose coupling with strong typing• Well-defined lifecycle for stateful objects bound tolifecycle contexts• Support for Java EE modularity and the Java EEcomponent architecture
  42. 42. CDI-Telco-Framework Mobicents brings the power and productivity benefits of CDI intothe Mobicents Sip Servlets platform providing dependency injectionand contextual lifecycle management for converged HTTP/SIPapplications.
  43. 43. CDI-Telco-Framework Mission Statement •  simplify SipServlets development by introducing a clean programming model •  ease of development by making available SIP utilities out of the box •  providing dependency injection and contextual lifecycle management to the SipServlets.
  44. 44. CDI-Telco-Framework public class SipRegistarClient {....@InjectSipFactory sipFactory;protected void doRegister(@Observes @RegisterSipServletRequest req) throws ServletException, IOException { .... register user here ...}
  45. 45. Contact•  Naoki Nishihara –  nisihara562@gmail.com•  Jean Deruelle –  jean.deruelle@gmail.com•  Georges –  gvagenas@gmail.com•  Vladimir Ralev –  vladimir.ralev@gmail.com
  46. 46. Gratitude
  47. 47. Appendix
  48. 48. Configuration•  mss-1.6.0-snapshot-jboss- jdk6-5.1.0GA-1103310643 –  With Simple B2BUA application•  SIPp as UAC & UAS•  Jdk1.6.0_24•  RHEL5 2.6.18-164.el5
  49. 49. Target server machineHP PROLIANT DL360 G6(504634-291)•  Intel(R) Xeon(R) CPU E5540 @ 2.53GHz stepping 05 –  4 core•  Memory: 32G
  50. 50. Default GC
  51. 51. Long Load
  52. 52. Over Load

×