第1页
Java App Servers are
Dead!
Eberhard Wolff Freelancer
Head Technology Advisory Board adesso http://ewolff.com
第2页
Code
Eberhard Wolff - @ewolff
第3页
2003
Eberhard Wolff - @ewolff
第4页
App Server =
Java EE or
Servlet Container
第5页
An Application on a server needs an
Application Server!
Eberhard Wolff - @ewolff
第6页
WhyjQuery110206404161732578683_1434503526215
The Price We Pay
What now?
Eberhard Wolff - @ewolff
第7页
App Server...
• …container for multiple applications
• ... infrastructure
• …deployment
• …monitoring
Eberhard Wolff - @ewolff
第8页
App Server...
• …container for multiple applications
• ... infrastructure
• …deployment
• …monitoring
Eberhard Wolff - @ewolff
第9页
Multiple Applications
App 1 App 2 App 3 App 4 App Server
• Isolation • ClassLoader • Can lead to non-trivial problems
Eberhard Wolff - @ewolff
第10页
Isolation
• ClassLoader is not enough • CPU? • Memory? • Filesystems? • Applications are not isolated • Even individual parts are not isolated • i.e. JMS might eat away resources
from web requests
Eberhard Wolff - @ewolff
第11页
Isolation is Impossible
• Operating systems isolate processes from each other
• CPU, memory … • Resource allocation: #1 feature for
operating systems • Either the JVM becomes an
operating systems • …or isolation won’t be perfect
Eberhard Wolff - @ewolff
第12页
Multiple Applications
App 1 App 2 App 3 App 4 App Server
• Is that really what happens?
• Java EE spec talks about “components”
• not Apps
Eberhard Wolff - @ewolff
第13页
One Application
App 1 App 2 App 3 App 4 App Server
Eberhard Wolff - @ewolff
第14页
One Application
Component 1 App Component 2 App Server
• Component e.g. WAR, EJB JAR … • Different ClassLoader isolation
needed • OSGi like • Memory/CPU isolation still missing
Eberhard Wolff - @ewolff
第15页
What It Is More Like…
Cluster
App 1
App 1
App 1
App Server App Server App Server
App 1
App 1
App 1
App Server App Server App Server
Eberhard Wolff - @ewolff
第16页
App Server: container for
one application
第17页
App Server...
• …container for multiple applications
• ... infrastructure
• …deployment
• …monitoring
Eberhard Wolff - @ewolff
第18页
App Server...
• …container for multiple applications
• ... infrastructure
• …deployment
• …monitoring
Eberhard Wolff - @ewolff
第19页
Infrastructure
• Two Phase Commit • Net / Threads • APIs
Eberhard Wolff - @ewolff
第20页
Infrastructure: Two Phase Commit
• Idea: Coordinate multiple transactional resources
• A talk in its own right • 2 DBs: Consider a different
architecture • DB + JMS: Tx Synchronization
might help • http://bit.ly/JMS-2PC
Eberhard Wolff - @ewolff
第21页
Infrastructure: Two Phase Commit
• Slows down the good case in favor of the bad case
• No 100% - 2PC can fail
• Of limited use in distributed systems
• E.g. REST + 2PC?
• NoSQL + 2PC?
• Limits scalability
Eberhard Wolff - @ewolff
第22页
Infrastructure: Net / Threads
• Support i.e. for HTTP and thread pooling
• Connection pooling
• Can be done inside the application • Embedded servers (Tomcat, Jetty)
Eberhard Wolff - @ewolff
第23页
Infrastructure: APIs
• EJB, CDI, JPA, JSF... • Version tied to App Server version • App depends on Application Server • New APIs can’t be used until new
App Server in production • Version conflicts might arise
Eberhard Wolff - @ewolff
第24页
Infrastructure: APIs
• Usually not every need covered • …so additional libraries are used • App Server APIs can be replaced by
libraries • Makes application more portable
Eberhard Wolff - @ewolff
第25页
Infrastructure: Application independent?
• Each application has its own infrastructure
• E.g. database connections • + specific configuration • Might even add its own libraries to
the AppServer • Big no-no if the App Server should
be application independent
Eberhard Wolff - @ewolff
第26页
Dependencies App Server / Application
Cyclic dependency i.e. one component
Application
Specific configuration
Libraries Infrastructure
App Server
Eberhard Wolff - @ewolff
第27页
Application Servers are just
another part of the Application
第28页
You Don‘t Agree?
• Can you deploy your application on a different server? • On a different version of the same server? • Without modifications to the server? • Do you deploy other applications on the App Server? • Could you? • Is the application server or an installation script in your version control?
Eberhard Wolff - @ewolff
第29页
Application Server: Just One Kind of Infrastructure
• App Server focus on interactive (web) applications
• Other types of application:
• Batches
• Integration
• Map / Reduce
• App Servers are no universal
infrastructure
Eberhard Wolff - @ewolff
第30页
App Server...
• …container for multiple applications
• ... infrastructure
• …deployment
• …monitoring
Eberhard Wolff - @ewolff
第31页
App Server...
• …container for multiple applications
• ... infrastructure
• …deployment
• …monitoring
Eberhard Wolff - @ewolff
第32页
Deployment
• Deployment Format: WAR, EAR, JAR... • No way to define dependencies outside
Application • i.e. App Server version, database etc • Operations usually work with deb, RPM… • Completely different tool chain • Also: Usually Unix services to start
applications
Eberhard Wolff - @ewolff
第33页
App Server...
• …container for multiple applications
• ... infrastructure
• …deployment
• …monitoring
Eberhard Wolff - @ewolff
第34页
App Server...
• …container for multiple applications
• ... infrastructure
• …deployment
• …monitoring
Eberhard Wolff - @ewolff
第35页
Monitoring
• Provided by JMX • Can be integrated in SMNP etc J • New tools arise • Logs + Logstash / Kibana or Splunk • REST based monitoring resources • Scripts for monitoring
Eberhard Wolff - @ewolff
第36页
App Server are needed for
monitoring & deployment
第37页
App Server come with their own Ops Tool Set
第38页
App Server...
• …container for multiple applications 1 App per server ..or per cluster
• ... provide infrastructure App Server part of the application
• …support deployment Deployment & monitoring OK but different tools
• …support monitoring
Eberhard Wolff - @ewolff
第39页
The Price We Pay
第40页
Slower Turn Around
• Code
• Package a WAR
• Install it
WhyjQuery110207688659569547883_1434503949000
• Have it unpacked
• Test
• Solutions: JRebel, Spring Loaded • But: Why is it done at all??
Eberhard Wolff - @ewolff
第41页
App Server: Complex Deployment
• Deployment: not just an application
• But also an Application Server • App Server configuration more
complex than Application configuration
• Look at automation scripts with Puppet / Chef etc
Eberhard Wolff - @ewolff
第42页
Cyclic Dependency Application – App Server
• Application and App Server must fit each other
• Configuration must be compatible • For each developer and each testing
stage
• Old configuration e.g. for bug fixes • Hard to get right
Eberhard Wolff - @ewolff
第43页
Deployment Is Important
• Continuous Delivery means a lot more deployment
• Must optimize deployment Many times per day
Commit
Capacity Tests
Production
Acceptance Tests
Explorative Tests
Eberhard Wolff - @ewolff
第44页
Continuous Delivery
• Applications deployed more frequently
• …in many different stages • Simple deployment even more
important • App Servers become bigger headache
Eberhard Wolff - @ewolff
第45页
Continuous Delivery increases
demand for
simple infrastructure.
第46页
Different Ops Mindset
• App Server administrator? • Deployment, monitoring etc. have
been solved already! • Package manager • Ops Monitoring • Why not stick to general solutions?
Eberhard Wolff - @ewolff
第47页
DevOps
• DevOps and Continuous Delivery: focus on “normal” tools and approaches
• Dev will see more than only Java Apps and App Servers
• Need different tools
Eberhard Wolff - @ewolff
第48页
Micro Services
• Build software composed of services • Service has business meaning • i.e. Order, Catalog etc • Services (re)deployed
independently • …instead of deployment monolith • …and communicate e.g. via REST
Eberhard Wolff - @ewolff
第49页
Micro Services: eCommerce
Catalog
Recommendation
Order Processing
Customer
Eberhard Wolff - @ewolff
第50页
Install and configure App
Server for each Microservice??
第51页
Micro Services
• Service might have different non-functional requirements
• So different infrastructure might be needed • E.g. asynchronous applications • Traditional Servlets • Batches • Map / reduce • …. • App Server just provide one kind of
infrastructure
Eberhard Wolff - @ewolff
第52页
The Price We Pay
Slow Turn Around
Standard OPs Tools
Continuous Delivery
Micro Services
App Server specific OPs tools
Deployment complex
App Server
One infrastructure doesn’t fit all
One App Server
Smaller per Micro Service?
deployment units
Eberhard Wolff - @ewolff
第53页
RIP Application Server!
Eberhard Wolff - @ewolff
第54页
What now??
第55页
The Re-Rise of the Applications
• Create a JAR files • …that contains a main class • Custom infrastructure • E.g. HTTP server • Or Batch • …
Eberhard Wolff - @ewolff
第56页
Monitoring & Deployment
• Rely on standard Ops deployment and monitoring tools
• REST based monitoring URLs
• Evaluate log files
Eberhard Wolff - @ewolff
第57页
Application: Benefit
• Easier to Deploy: Just a JAR • + command line • + config file • Debug & run in IDE • Acceptance tests etc much easier • Ensured: Infrastructure compatible
with application
Eberhard Wolff - @ewolff
第58页
Spring Boot Actuator & CRaSH Demo
第59页
Deploy Demo
• mvn package • Show java –jar with JAR
Eberhard Wolff - @ewolff
第60页
Actuator Demo
• Open http://localhost:8080/ monitor.html
• Show metrics / trace • Show info and
application.properties
Eberhard Wolff - @ewolff
第61页
Demo CRaSH
• ssh -p 2000 user@localhost • Password in log output • help • Mention jpa / jdbc / problems • thread top CTRL-C • metrics • dashboard
Eberhard Wolff - @ewolff
第62页
Technologies
• Spring Boot • see my talk on Wednesday
• Dropwizard by Yammer
• Vert.x • see Tim Fox’s talk this evening
• Play Framework
Eberhard Wolff - @ewolff
第63页
Thank You!!
eberhard.wolff@gmail.com @ewolff
Eberhard Wolff - @ewolff