Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Upcoming SlideShare
CDI: How do I ?
CDI: How do I ?
Loading in …3
×
1 of 60

Just enough app server

6

Share

Download to read offline

Are Websphere or Weblogic appropriate for your project? Too big" ? Do Jetty or Tomcat actually meet your needs? Too "small"?

Neither too big nor too small. What you need is "just enough app server" to support only the subset of APIs and services your application needs.

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Just enough app server

  1. 1. Just Enough App Server by antonio goncalves @agoncal
  2. 2. 2@agoncal Antonio Goncalves
  3. 3. Take what you need from Java EE and resize your App Server
  4. 4. 4@agoncal How do we see Java EE App Servers ? One Monolith ! Slow Fat Heavyweight Old Not sexy Boring
  5. 5. App servers are monolithic !
  6. 6. 6@agoncal Java EE
  7. 7. 7@agoncal Web Profile
  8. 8. 8@agoncal Servlets
  9. 9. 9@agoncal Three types of Java EE App Servers Three Monoliths !
  10. 10. 10@agoncal Bits & Pieces
  11. 11. 11@agoncal Servlets JSP Expression Language Servlets JSTL
  12. 12. 12@agoncal Web Profile JSP Expression Language Servlets JSTL Interceptors JAX-RS JSON-P CDI JPAWebSocket JTA Bean Validation
  13. 13. 13@agoncal Java EE JSP Expression Language Servlets JSTL Interceptors JAX-RS JSON-P CDI JPAWebSocket JTA Bean Validation JMSJSFJAX-WS EJB JavaMail JCA Concurrency Batch JASPIC
  14. 14. 14@agoncal JVM JSP Expression Language Servlets JSTL Interceptors JAX-RS JSON-P CDI JPAWebSocket JTA Bean Validation JMSJSFJAX-WS EJB JavaMail JCA Concurrency Batch JASPIC JVM
  15. 15. 15@agoncal JVM JTA JMS JSP Interceptors JAX-RS Expression Language JSF Servlets JSON-P CDI JAX-WS JPA Bean Validation EJB JavaMail WebSocket JSTL JCA Concurrency Batch JASPIC JDBC JNDI Logging JAX-B JMX Commons Annotations
  16. 16. 16@agoncal Your own app JTA JMS JSP Interceptors JAX-RS Expression Language JSF Servlets JSON-P CDI JAX-WS JPA Bean Validation EJB JavaMail WebSocket JSTL JCA Concurrency Batch JASPIC JDBC JNDI Logging JAX-B JMX Commons Annotations My code
  17. 17. 17@agoncal Your own app dependencies JTA JMS JSP Interceptors JAX-RS Expression Language JSF Servlets JSON-P CDI JAX-WS JPA Bean Validation EJB JavaMail WebSocket JSTL JCA Concurrency Batch JASPIC JDBC JNDI Logging JAX-B JMX Commons Annotations My code SLF4J Angular ReactPrimefaces Bootstrap JQuery
  18. 18. App servers are slow !
  19. 19. 19@agoncal Startup time of App Servers
  20. 20. 20@agoncal Startup time of JBoss Using a Windows XP virtual machine (Virtual Box) 3.2.8 4.2.3 5.1 6.1 7 Beta 0 5 10 15 20 25 30 35 40 Startup time Specs
  21. 21. App servers consume resources !
  22. 22. 22@agoncal Memory consumption of App Servers
  23. 23. App servers use outdated packaging !
  24. 24. 24@agoncal Your own app… needs packaging JTA JMS JSP Interceptors JAX-RS Expression Language JSF Servlets JSON-P CDI JAX-WS JPA Bean Validation EJB JavaMail WebSocket JSTL JCA Concurrency Batch JASPIC JDBC JNDI Logging JAX-B JMX Commons Annotations My code SLF4J Angular ReactPrimefaces Bootstrap JQuery
  25. 25. 25@agoncal Skinny War JTA JMS JSP Interceptors JAX-RS Expression Language JSF Servlets JSON-P CDI JAX-WS JPA Bean Validation EJB JavaMail WebSocket JSTL JCA Concurrency Batch JASPIC JDBC JNDI Logging JAX-B JMX Commons Annotations My code SLF4J Angular ReactPrimefaces Bootstrap JQuery
  26. 26. 26@agoncal My code Fat War JTA JMS JSP Interceptors JAX-RS Expression Language JSF Servlets JSON-P CDI JAX-WS JPA Bean Validation EJB JavaMail WebSocket JSTL JCA Concurrency Batch JASPIC JDBC JNDI Logging JAX-B JMX Commons Annotations SLF4J Apache Commons Drools SLF4J Angular React
  27. 27. Demo CD-BookStore Top Books Top CDs https://github.com/agoncal/agoncal-sample-javaee/06-EnoughAppServer
  28. 28. 3 apps 3 different needs !
  29. 29. 29@agoncal CD-Book Store JTA JMS JSP Interceptors JAX-RS Expression Language JSF Servlets JSON-P CDI JAX-WS JPA Bean Validation EJB JavaMail WebSocket JSTL JCA Concurrency Batch JASPIC JDBC JNDI Logging JAX-B JMX Commons Annotations My code Primefaces Bootstrap JQuery
  30. 30. 30@agoncal Top Books JTA JMS JSP Interceptors JAX-RS Expression Language JSF Servlets JSON-P CDI JAX-WS JPA Bean Validation EJB JavaMail WebSocket JSTL JCA Concurrency Batch JASPIC JDBC JNDI Logging JAX-B JMX Commons Annotations My code
  31. 31. 31@agoncal Top CDs JTA JMS JSP Interceptors JAX-RS Expression Language JSF Servlets JSON-P CDI JAX-WS JPA Bean Validation EJB JavaMail WebSocket JSTL JCA Concurrency Batch JASPIC JDBC JNDI Logging JAX-B JMX Commons Annotations My code
  32. 32. What a Waste ! Let's package what we need… ...in a “uber” Jar
  33. 33. 33@agoncal My code CD-Book Store JTAInterceptors JAX-RS Expression Language JSF Servlets JSON-PCDI JPA Bean Validation EJB JDBC JNDI Logging JAX-B Commons Annotations Primefaces Bootstrap JQuery
  34. 34. 34@agoncal My code Top Books JTAInterceptors Expression Language Servlets JSON-PCDI JPA Bean Validation JDBC JNDI Logging JAX-B Commons Annotations JAX-RS
  35. 35. 35@agoncal My code Top CDs Servlets Commons Annotations Logging
  36. 36. 36@agoncal Several solutions to choose from ● Full Java EE ● WildFly Swarm ● Payara Micro ● TomEE ● KumuluzEE ● “Sort of” Java EE ● Spring Boot ● Other ● Dropwizard ● Lagom
  37. 37. Demo WildFly Swarm https://github.com/agoncal/agoncal-sample-javaee/06-EnoughAppServer
  38. 38. And what about multiple apps ?
  39. 39. 39@agoncal My code Top CDsssssssss Servlets Commons Annotations Logging My code Servlets Commons Annotations Logging My code Servlets Commons Annotations Logging My code Servlets Commons Annotations Logging My code Servlets Commons Annotations Logging My code Servlets Commons Annotations Logging
  40. 40. 40@agoncal My code Top CDsssssssss Commons Annotations Logging My code Commons Annotations Logging My code Commons Annotations Logging My code Commons Annotations Logging My code Commons Annotations Logging My code Commons Annotations Logging Servlets Local Maven Repo If only we had Jigsaw !
  41. 41. Demo WildFly Swarm with M2_REPO https://github.com/agoncal/agoncal-sample-javaee/06-EnoughAppServer
  42. 42. Some metrics
  43. 43. 43@agoncal Packaging Size
  44. 44. 44@agoncal Startup time
  45. 45. And how do I manage it now ?
  46. 46. 46@agoncal Configure your app public class MyMain { public static void main(String...args) { new Container() .fraction(new DatasourcesFraction() .jdbcDriver("h2", (d) -> { d.driverClassName("org.h2.Driver"); d.driverModuleName("com.h2database.h2"); }) .dataSource("ExampleDS", (ds) -> { ds.driverName("h2"); ds.connectionUrl("jdbc:h2:mem:test"); ds.userName("foo"); ds.password("bar"); })) .start() .deploy();
  47. 47. Demo WildFly Swarm with management https://github.com/agoncal/agoncal-sample-javaee/06-EnoughAppServer
  48. 48. And what about Docker ?
  49. 49. 49@agoncal Dockerfile FROM java:openjdk-8-jdk EXPOSE 8081 ADD target/topcds-swarm.jar /opt/topcds-swarm.jar ENTRYPOINT ["java", "-jar", "/opt/topcds-swarm.jar"]
  50. 50. Demo Docker https://github.com/agoncal/agoncal-sample-javaee/06-EnoughAppServer
  51. 51. Demo Raspberry PI https://github.com/agoncal/agoncal-sample-javaee/06-EnoughAppServer
  52. 52. Final word
  53. 53. 53@agoncal Wildfly Swarm ● Based on good old JBoss AS ● Bundles several fractions ● Java EE ● Netflix OSS (Ribbon, Hystrix, RxJava) ● Spring ● Logstash ● Swagger ● ...
  54. 54. 54@agoncal Java EE App Servers ● Java EE app server have changed ● Are not monolithic, slow, consume resources ● Package the way you want (skinny/fat war, uber jar) ● Re-use your Java EE expertise ● Look Ma, « Microservices inside » ● « I’m centralised and I’m proud! »
  55. 55. That's it !
  56. 56. 56@agoncal http://amazon.com/author/agoncal
  57. 57. 57@agoncal https://www.pluralsight.com/authors/antonio-goncalves
  58. 58. Thanks www.antoniogoncalves.org antonio.goncalves@gmail.com @agoncal @pluralsight @devoxxfr @lescastcodeurs
  59. 59. Q & A
  60. 60. 60antonio goncalves Creative Commons ● Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). ● Noncommercial — You may not use this work for commercial purposes. ● Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.

×