operations and monitoring with spring
DESCRIPTION
Operations and Monitoring with SpringTRANSCRIPT
![Page 1: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/1.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Operations and Monitoring with Spring
Eberhard Wolff Regional Director and Principal
Consultant SpringSource
![Page 2: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/2.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 2
A Short History of Spring
• Spring is a platform independent framework for the development of (Enterprise) Java Applications
• Originally started as an easier to use alternative for Java EE development
• In particular compared to EJB • See "J2EE Development Without EJB"
• But actually there is more to it
![Page 3: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/3.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 3
Programming Model vs. Infrastructure
• Programming Model: A set of APIs to use as a developer
• Infrastructure: Something to run your software on
• Spring defines a Programming Model but no Infrastructure
• …you can use Java EE, a simple Servlet container…
• Java EE defines a Programming Model and an Infrastructure
![Page 4: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/4.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 4
Bundling Programming Model and Infrastructure
• Bundling leads to some problems
• To upgrade the programming model you need to upgrade the infrastructure
• Operations will not like that idea
• You are limited to a certain infrastructure – what do you do concerning OSGi?
• You only get the benefit from OSGi if you use its non OSGi deployment model
• Users realize how flexible they are using Spring
![Page 5: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/5.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 5
Spring’s Impact on Java EE
Production Environment
Jaav EE Application Server
Servlet Container
• Connection mgmt. • Clustering • Deployment management
EJB Container
EAR EJB
WAR
Production Environment
Tomcat
Production Environment
Java EE Application Server
Servlet Container
• Connection mgmt. • Clustering • Deployment management
WAR Spring
Powered Application
Spring
WAR Spring
Powered Application
Spring
Servlet Container
• Connection mgmt. • Clustering • Deployment management
![Page 6: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/6.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 6
So: What is the advantage of Spring over Java EE 6?
• Type error: Cannot compare infrastructure + programming model to programming model
• But seriously… • Spring actually exists – Java EE 6 is still being
standardized • You don't need to upgrade your server (many are
still on Java EE 5) • Actually this question is not important to many:
They don't run on Java EE anyway
![Page 7: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/7.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 7
0% 10% 20% 30% 40% 50% 60% 70% Java Application Server Usage, Source: 2008 Evans Data Survey
Spring Applications WebLogic 26%
JBoss 38%
WebSphere 43%
Apache Tomcat 68%
Today’s De Facto Standards Spring and Tomcat
• Obviously the Java EE platform is often not needed • A Servlet container is enough • …and too complex
![Page 8: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/8.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 8
Is Spring + Servlet container as powerful as Java EE?
• "Classic" features of a Java EE server Feature Spring Solution
Transactions No real 2PC but smart solutions for many scenarios
Security Spring Security is much better
Distribution Not too important any more Spring Remoting offers even more features
Persistence Java EE's persistence (JPA) can be used – and several other
Naming Supported by Dependency Injection
Connection / Resource Pooling
Supported by Servlet Containers and DataSource implementations
![Page 9: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/9.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 9
So…
• Let's add transaction support (JTA) to Tomcat • Then we have a full blown Application Server
• But Tomcat is very successful already • …and Spring offers solutions
– for O/R mappers – for JMS + a DataSource
• JTA seems to be a not too important
• Is there anything else we need to think about? • Infrastructure is not just for developers!
![Page 10: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/10.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 10
Operations
• Operations cares about – monitoring – administration
• They should be able to look into application
• Usually there is more than one Application Server – how can you handle larger installations?
• Individual updates of parts of an application are important
• Virtualization / Cloud
![Page 11: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/11.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Spring Enterprise - Looking into Applications
![Page 12: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/12.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 12
Your Application
Spring Enterprise - Looking into Applications
• Certified Spring • Instrumented
Spring – Monitor Spring
apps across infrastructure • JMX flows into
Management Application
– Track app performance
• Just different JARs
• No code changes
Enterprise Management Application
JMX
![Page 13: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/13.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Demo: Spring Enterprise
![Page 14: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/14.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Handling large clusters
![Page 15: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/15.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 15
Cluster
• Usually there is more than one Tomcat server in an installation
• How can you manage them?
• Ideally centralized
![Page 16: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/16.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 16
tc Server
Tomcat
Enterprise support
Distributed Operations Diagnostics
Enterprise Capabilities
Tomcat you know. Enterprise capabilities you need.
SpringSource tc Server
![Page 17: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/17.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 17
Product Architecture
tc Server machine 1
Hyperic Agent
Mgmt Server
Hyperic Server
Hyperic Web
Console
Other Manageable Items Apache http Server
Apache Tomcat ActiveMQ
JVM Operating Systems
Scripts
Configs Inventory,
Metric, Audit, …
tc Server
tc Server machine n
Hyperic Agent
Configs
tc Server
![Page 18: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/18.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 18
tc Server
• Binaries almost unchanged – no lock in • Centralized monitoring and administration
• Groups of server allow to deal with a group of servers – not just one – Start / stop / restart – Deployment – Configuration including JVM options
• Easy operations of large Tomcat installations
![Page 19: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/19.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Demo: tc Server
![Page 20: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/20.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 20
Demo
WhiteRabbit
Hyperic Agent
Ubuntu1
Hyperic Server
Hyperic Web
Console Inventory,
Metric, Audit, …
tc Server
Ubuntu1
Hyperic Agent
tc Server
![Page 21: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/21.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Updating parts of an application
![Page 22: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/22.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 22
dm Server
• Modularization is key to maintainable software • Modularization at runtime gives more power to
Operations • Updates of parts of the application • Determining the source of an error • etc
• On the client and in the embedded world OSGi has succeeded as a standard for modularization
• OSGi enters the server market…
![Page 23: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/23.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
OSGi
![Page 24: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/24.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 24
It's a module system
• Partition a system into a number of modules – "bundles"
• Dynamic: Bundles can be installed, started, stopped, uninstalled and updated
• ...at runtime • better operations
• Strict visibility rules • Resolution process satisfies dependencies of a
module • Understands versioning
![Page 25: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/25.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 25
It's even service-oriented
• Bundles can publish services… dynamically!
• Service Registry allows other bundles to consume services
• Services come and go at runtime – … transparently when using Spring-DM
![Page 26: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/26.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 26
OSGi Bundle
• The fundamental unit of deployment and modularity in OSGi
• Just a JAR file – with additional entries in META-INF/MANIFEST.MF
• Common manifest headers: – Bundle-SymbolicName – Bundle-Version – Bundle-Name – Bundle-ManifestVersion – Bundle-Vendor
![Page 27: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/27.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 27
Import / Export -Package
Declares package-level dependencies of your bundle.
Import-Package: com.xyz.foo; Import-Package: com.xyz.foo;version="1.0.3" Import-Package: com.xyz.foo;version="[1.0.3,1.0.3]" Import-Package: com.xyz.foo;version="[1.0.3,1.1.0)", com.xyz.bar;version="[1.0.3,2.0.0)" Export-Package: com.xyz.foo Export-Package: com.xyz.foo;version="1.0.5"
>= 1.0.3; e.g., 1.0.3.GA, 1.0.4, etc.
![Page 28: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/28.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Spring Dynamic Modules & SpringSource dm Server
![Page 29: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/29.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 29
Spring-DM: ApplicationContext
• Configuration files in /META-INF/spring • Automatically merged • ..and ApplicationContext is created
![Page 30: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/30.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 30
Service export and import
<beans ...> <osgi:service ref="customerDAO" interface="dao.ICustomerDAO" />
<osgi:reference id="dataSource" interface="javax.sql.DataSource" />
</beans>
![Page 31: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/31.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 31
Service export and import
• Dynamic services automatically dealt with • i.e. method calls are buffered • Purely declarative • No dependencies on OSGi in the code • No resource leaks
• Not solved in Spring Dynamic Modules: – Easy import of libraries – Using JPA or Hibernate in OSGi – Seamless Web Support – Notion of an application
• Enter dm Server
![Page 32: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/32.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 32
dm Server Platform
• Modular profiles • Bundle repository • Library provisioning • Serviceability
– FFDC – Logging / Tracing
• Built on Equinox • Modular architecture
– Subsystems – Bundles
• Small footprint
WAR Personality
Web Module Personality
Bundle Personality
Tomcat Deployer Management
Dynamic Modules Kernel
Equinox
JVM
![Page 33: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/33.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 33
Bundles for the example
• Web • Service • API: only interfaces and domain
classes – Implementation can be exchanged
• Could add infrastructure: DataSource / PlatformTransactionManager
API
Service
Web
Package Import
![Page 34: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/34.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 34
Bundles & Types
• Only dependencies to the API • Therefore: implementation can be exchanged even
at runtime • No direct dependencies to any implementation • Not shown: dependencies to external bundles • … can be installed in dm Server • … modular middleware!
![Page 35: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/35.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 35
Bundles & Services
Services: Publish / Consume
api
service
web Service Registry
![Page 36: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/36.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 36
Bundles & Services
• Infrastructure can use the same principle as application services
• i.e. DataSource and PlatformTransactionManager are just another service
• Can I still run on plain Java EE? • Yes: instead of OSGi Service directly inject
Spring Beans • no more more dynamic services / modularization • No code change needed • Application can run on Java EE or OSGi
![Page 37: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/37.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 37
PAR
• Packaging format for all modules in an application
• JAR with Application-* manifest headers
• Single unit: deploy, refresh, undeploy
• Application boundaries – Scoping of types and
services – DataSource does not leak
out of the application – Hibernate can change
domain objects
API
Service
Web
Package Import
Spring
Taglibs
Application
![Page 38: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/38.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Web Migration: From WAR to PAR
![Page 39: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/39.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 39
Shared Libraries WAR
Web Application Deployment Options
• Standard Java EE WAR – supported on dm Server as is – converted into an OSGi
bundle • Shared Libraries WAR
– WAR + OSGi package imports – Eradicate library bloat of
monolithic Java EE – WARs
• Shared Services WAR – Uses OSGi services
with Spring's <osgi:reference>
• Web Module
Standard WAR
libs
services Bundle Repository
Shared Services WAR
OSGi Service Registry
services
![Page 40: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/40.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Roadmap
![Page 41: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/41.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 41
dm Server 2.0 Roadmap
• SpringSource dm Server 2.0: 2009 • Cloning bundles
– solves problems around static variables and more • Shared Repository
– make a repository available to other servers • Plan Files
– Define an application as a collection of bundles – Does not contain the bundles, more flexible
• Distributed and improved Management – operation on a group of servers – like tc Server for Tomcat
• Modular Web Applications
![Page 42: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/42.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 42
Support for Enterprise OSGi Standards
• RFC 66: Web Container for OSGi (RI based on dm Server)
• RFC 119: Distributed OSGi • RFC 124: Blueprint Service (RI based on Spring-
DM) • RFC 139: JMX interface for OSGi • RFC 142: JNDI and OSGi integration
![Page 43: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/43.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 43
Note: OSGi has an impact on operations
• New deployment model • Updates of bundles possible • How much less regression testing do you actually
do? • Is redeploying just a part of an application OK for
operations?
![Page 44: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/44.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 44
Virtualization / Cloud
• Deployment blueprints define machines and their characteristics
• vApp define a deployment format based on such blueprints
• dm Server, tc Server etc will be configurable using vApp properties (e.g. ports)
• vApps can be pre defined – just add your application • vApps can optimize for network traffic or availability
• Deployment and set up of the VMs is trivial • …in your private or a public cloud
![Page 45: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/45.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Summary
![Page 46: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/46.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 46
Summary
• Spring is a portable programming model • This help the move from full blown Java EE to
Servlet containers • An important part of infrastructures is support for
operations
• Issues: – Monitoring e.g. Spring Enterprise – Cluster e.g. tc Server – Modularization at runtime e.g. OSGi / dm Server – Virtualization / Cloud
![Page 47: Operations and Monitoring with Spring](https://reader033.vdocuments.us/reader033/viewer/2022061217/54b58e504a795962418b468e/html5/thumbnails/47.jpg)
Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Questions? Eberhard Wolff [email protected] http://SpringSource.com
Run
Manage
Build