Upload
joelisson-laurido
View
217
Download
0
Tags:
Embed Size (px)
DESCRIPTION
desenvolvimento java
Citation preview
12005 JavaOneSM Conference | Session TS-1188
John ArmstrongArchitectural LeadYolus Limitedhttp://www.yolus.comSession TS-1188
Developing a Scalable Distributed Server with JMX™
2005 JavaOneSM Conference | Session TS-1188 | 2
Learn how Java™ ManagementExtensions “JMX™” were used as the cornerstone of a scalable and manageable banking system distributed across several servers
Configuring and managing a Distributed ApplicationAchieving Scalability With JMX
2005 JavaOneSM Conference | Session TS-1188 | 3
Agenda
Outline of the problemWriting self describing servicesManaging complexityReducing the develop/deploy/test cycleImplementation difficulties
2005 JavaOneSM Conference | Session TS-1188 | 4
Outline of the problemWriting self describing servicesManaging complexityReducing the develop/deploy/test cycleImplementation difficulties
Agenda
2005 JavaOneSM Conference | Session TS-1188 | 5
The Problem
• It is a given that you must componentize• Scaling to 1000s of interdependent components
is the major challenge• Separation of development and deployment• Reduce the develop/deploy/test cycle• Achieve code reuse in the large
2005 JavaOneSM Conference | Session TS-1188 | 6
Three Tier Architecture
2005 JavaOneSM Conference | Session TS-1188 | 7
JMX API Based Component Architecture
2005 JavaOneSM Conference | Session TS-1188 | 8
DEMOConfiguration of a Risk Management Server
2005 JavaOneSM Conference | Session TS-1188 | 9
Outline of the problemWriting self describing servicesManaging complexityReducing the develop/deploy/test cycleImplementation difficulties
Agenda
2005 JavaOneSM Conference | Session TS-1188 | 10
The Different Types of MBean
2005 JavaOneSM Conference | Session TS-1188 | 11
Choosing the Type of MBean
• Writing an MBean should be as easy as possible• All MBeans should have documentation• MBeans should have a reasonable GUI to
configure them• It should be easy to write management tools
2005 JavaOneSM Conference | Session TS-1188 | 12
Comparing the Types of MBean
ModelOpenDynamicStandard
YesBuilt in features
YesEasy to write tools
YesAuto GUI
OptionalRequiredOptionalDocumented
YesEasy to write
2005 JavaOneSM Conference | Session TS-1188 | 13
The Hello World Standard MBeanpublic class MyService implements MyServiceMBean {
private String message = "Hello World!";
public String getMessage() {return message;
}
public void setMessage( String message ) {this.message = message;
}
public void printMessage() {System.out.println( message );
}}
2005 JavaOneSM Conference | Session TS-1188 | 14
Making OpenMBeans Easy
• Generate a wrapper (OpenProxy) for your service that uses restricted parameter types:• Primitives → Wrapper classes• JavaBeans™ Specification → CompositeData
• Generate MBeanInfo using introspection and serialize it so it’s available even if the class is not
• Use Annotations or XDoclet to add metadata• Automate this with ant
2005 JavaOneSM Conference | Session TS-1188 | 15
Auto Generated Proxy and MBeanInfo
2005 JavaOneSM Conference | Session TS-1188 | 16
An MBean With Annotations@MBean (
description="A service that prints a message")public class MyService {
private String message = "Hello World!";
@MBean (description="The message to print out"
)public String getMessage() {
return message;}
...}
2005 JavaOneSM Conference | Session TS-1188 | 17
Outline of the problemWriting self describing servicesManaging complexityReducing the develop/deploy/test cycleImplementation difficulties
Agenda
2005 JavaOneSM Conference | Session TS-1188 | 18
Issues Not Addressed by JMX API
• A naming convention• Hierarchical path names/Standard keys
• A component lifecycle• An “mbean deployed” method at least
• An index of available MBeans• A format must be defined
• An error reporting convention• An “mbean OK” property at least
• Starting JVM™• Use a JMX API enabled daemon process
2005 JavaOneSM Conference | Session TS-1188 | 19
Finding Other Components
• Synchronous or asynchronous lookup?• Simplicity vs. flexibility and robustness
• Start-up order• Deduce, configure or don’t care?
• Attribute based lookup or naming
2005 JavaOneSM Conference | Session TS-1188 | 20
Variations
• Maintain consistency between similar but distinct configurations• Development, UAT and Production• Production and a Failover system• Tokyo Server and New York Server
2005 JavaOneSM Conference | Session TS-1188 | 21
J.F.C/Swing Applications
• Build your own “J.F.C./Swing” clients from configurable components, for example:• Charting plugin• Menu Manager• Options property sheet
• Monitor client components at runtime• Guarantee the same code is used by client
and server
2005 JavaOneSM Conference | Session TS-1188 | 22
Outline of the problemWriting self describing servicesManaging complexityReducing the develop/deploy/test cycleImplementation difficulties
Agenda
2005 JavaOneSM Conference | Session TS-1188 | 23
Testing
• Lightweight JMX technology can be used to deploy components in unit tests
• Configure and manage automated tests• Add self tests to your components
2005 JavaOneSM Conference | Session TS-1188 | 24
Class Loading
• Hot deploy components• Reduce the develop-deploy-test cycle
• Deploy all code to a web server• Consistent code across the network• Simply build code to deploy it
2005 JavaOneSM Conference | Session TS-1188 | 25
Problems With Class Loading
• Conceptually difficult—one classpath causes enough problems!• Use a simple class loader hierarchy• Add classpath entries to your jar files
2005 JavaOneSM Conference | Session TS-1188 | 26
Problems With Class Loading
• You must use a decent security policy• Use a custom SecurityManager to provide diagnostics• Use https in development
• Downloading code is slow• Use a custom “jar” URL protocol handler
2005 JavaOneSM Conference | Session TS-1188 | 27
Outline of the problemWriting self describing servicesManaging complexityReducing the develop/deploy/test cycleImplementation difficulties
Agenda
2005 JavaOneSM Conference | Session TS-1188 | 28
Implementation Difficulties
• Complexity of asynchronous lookup• Security and robustness of lookup service• Lack of tool support for RMI activation
2005 JavaOneSM Conference | Session TS-1188 | 29
Summary
• Manageability is the key to building a scalable distributed server• Self documenting components• Automated lookup• Variations
• Manageability speeds development• Visualize the architecture• Easily deploy new code• Automate testing
2005 JavaOneSM Conference | Session TS-1188 | 30
Q&A
2005 JavaOneSM Conference | Session TS-1188 | 31
Submit Session Evaluations for Prizes!
• You can win a $75.00 gift certificate to the on-site Retail Store by telling Sun what you think!
• Turn in completed forms to enter the daily drawing• Each evaluation must be turned in the same day as
the session presentation• Five winners will be chosen each day (Sun will send
the winners e-mail)• Drop-off locations: give to the room monitors or use any
of the three drop-off stations in the North and South Halls
Note: Winners on Thursday, 6/30, will receive and can redeem certificates via e-mail.
Your opinions are important to Sun
322005 JavaOneSM Conference | Session TS-1188
John ArmstrongArchitectural LeadYolus Limitedhttp://www.yolus.comSession TS-1188
Developing a Scalable Distributed Server with JMX