beyond standard java0921ccnz33vh1pvcmg02.images.s3.amazonaws.com/cdn/beyond-ja… · beyond...
TRANSCRIPT
Beyond Standard Java: from E-Commerce to Industrial Robotics
Beyond Standard Java
From E-Commerce to Industrial Robotics
Eugene [email protected]://eugeneciurana.com
Beyond Standard Java: from E-Commerce to Industrial Robotics
Agenda What is Beyond Standard Java about?
Java applications and the car you drive: an analogy
Case study: check presentment at a large bank
Case study: industrial robots (hard real-time)
Case study: e-commerce in a grand scale
Q&A
Contact information
Beyond Standard Java: from E-Commerce to Industrial Robotics
What is this presentation about? The Java platform runs on everything from micro-controllers
to mainframes
There are APIs and/or JSRs providing (or attempting to replace) almost any service already out there
The richness of APIs and environments creates a problem because you can’t be everything to everyone and do a good job
This presentation is about situations where doing things “the Java way” didn’t produce the desired results
• Thus, standard J2SE or J2EE APIs were ignored or circumvented - you’ll see why, how, and the results
Beyond Standard Java: from E-Commerce to Industrial Robotics
An analogy: if Java on the web were a car...
Beyond Standard Java: from E-Commerce to Industrial Robotics
An analogy: if Java on the web were a car...
You would drive a...Your web platform
would be...
Personal site, small
business
Honda Civic: does the job, no bells and whistles.
Tomcat or Jetty, cut-n-paste components,
open-source, free stuff
E-commerce, intranet,
‘high’ volume site
BMW or Lexus: reliable, lots of
creature comforts, elegant
and functional design
Websphere, JBoss, Weblogic
Very high volume siteFormula 1 Car - something so
customized that it only
works for a single purpose
Tomcat, custom components, open-
source, free stuff
Beyond Standard Java: from E-Commerce to Industrial Robotics
Case study no. 1: check presentment Check presentment system built for a very large
US bank
Use: on-line banking, internal business units• Across 13 US states; images in OH, distribution system in AZ
Technology: web browser presentment, embedded in other applications that will use the
service
Problem: performance; SLA wasn’t met
• In fact, not only it wasn’t met but it was unusable under minimal
load!
Beyond Standard Java: from E-Commerce to Industrial Robotics
Case study no. 1: check presentmentColumbus OH Phoenix AZ The World
ImageServerFarm
Check image(front and back)Uncompressed
TIFF/CCITT
UNIX Server, Oracle
(look up, image
retrieval)
XMLbase64 image
Solaris server
Websphere
(parse XML, decode
image, rasterize,
encode)
Check back Check front
PNG
Internet
On-line customersBank business
unit
SLA = 5 seconds image fetch from a client, max,
from the moment that the system hits
the servlet running in the Solaris server
Beyond Standard Java: from E-Commerce to Industrial Robotics
Case study no. 1: check presentment Estimated load 1,000 concurrent users at peak
• 90% use Internet Explorer; remainder are web service clients
SLA of 5 seconds max with 1,000 users
First implementation used standard Java J2SE/J2EE components to do its job
• Websphere tools
• EJBs
• JIA for image processing
• Standard Java XML parser 0s15s30s45s60s
0 25 50 100 150
Performance
Beyond Standard Java: from E-Commerce to Industrial Robotics
Case study no. 1: check presentmentBottleneck Solution
Database and image server access
Websphere connection pools didn’t perform
Custom, in-memory connections pools
implemented as a circular queue with
connection recovery
Extract base64 encoded image from XML file Custom parser that searched only for
meaningful CDATA sections and tags
base64 decodingJava API call
Custom, ultra-fast base64 transcoder that
operated on byte arrays
Splitting the TIFF image in two (front, back) and rotations
JAI
Gutted Jimi library for graphics operations
Rasterization and encoding as PNGJAI
Gutted Jimi library for graphics operations
Java garbage collector Tuned Hotspot and Websphere as far as it would
go and added custom byte arrays memory
manager so that rasterized, encoded, or
decoded images would never get GC’d
Beyond Standard Java: from E-Commerce to Industrial Robotics
Case study no. 1: check presentment
0s
15s
30s
45s
60s
0 25 50 100 150 200 250 300 400 500 750 10000.0s2.0s
16.3s
3.5s
10.2s
4.0s 3.8s 5.1s 4.0s 3.8s 3.0s 4.1s
Pre-optimizationPost-optimization
Number of concurrent clients
Beyond Standard Java: from E-Commerce to Industrial Robotics
Case study no. 2: industrial robotics Industrial robot controllers that replace
traditional PLCs
Requirements• All logic must be written in Java
• All instrumentation should be presented as web pages + applets
• Support for standard communications protocols
Profibus, Ethernet, TCP/IP
• Support software upgrades without stopping the controller
• No operating system shutdown
• No JVM shutdown
Beyond Standard Java: from E-Commerce to Industrial Robotics
Case study no. 2: industrial robotics Requirements (cont’d)
• Deterministic thread and resource management
• Single configuration point
• Accessible through firewalls
End-user requirements• Access through dedicated console (analog world, touchscreen)
• Technicians with notebooks should have access
• Remote system administration and monitoring
Beyond Standard Java: from E-Commerce to Industrial Robotics
Case study no. 2: industrial robotics
Real-Time Java
Industrial
ControllerLocal end-user
Wonderware
instrumentation
TCP/IP or RS-232C
End-user,
standard
browser
TCP/IP
Beyond Standard Java: from E-Commerce to Industrial Robotics
Case study no. 2: industrial robotics
Hardware and Software
Advantec single board PC* Pentium 300 MMX
* 64 MB RAM* 128 MB CF file system* Shared memory I/O
Real-time Linux base* Custom drivers for fast I/O
* Hard real-time
Applicom dedicated I/O board* Profibus, CANopen, DeviceNet connectivity
* Shared memory I/O (DMA)
RTSJ-compliant JVM* Easy development/deployment cycle
Standard remote I/O modules* Profibus
* Digital/analog inputs
* Digital/analog outputs* ABB, Siemens, GE, Prosoft, OMRON, etc.
CIME DXA (Java OS)* Thread management
* Memory management
* Software load/remove/activate cycle* HTTP 1.1/servlets
* Configuration management
Beyond Standard Java: from E-Commerce to Industrial Robotics
Case study no. 2: industrial robotics
Beyond Standard Java: from E-Commerce to Industrial Robotics
Case study no. 2: industrial robotics
Host system:Real-time Linux on a Pentium MMX 300 MHz, 64 MB RAM
Commercial Real-Time Java Virtual Machine
DXA Kernel
DXA Context
Resolved at runtime based on hardware
and operating system discovery, and by parsing an
environment properties
configuration file.
Co
ntr
oller
Co
mm
Servic
e
Mo
du
le L
oad
er
HT
TP
/ap
p
serv
er
man
ag
er
Data
base
(DX
A M
OO
D,
Po
intB
ase)
Rem
ote
Ad
min
server
Lo
g S
erv
ice
(lo
cal, r
em
ote
,
sh
are
d)
Mission-critical components implemented as real-time/high priority threads
New functionality can be installed on-demand
New functionality can be installed locally or from an HTTP/FTP server
Any module can be activated/deactivated independently of others
All modules are optional
Implemented in a 350 KB .jar -- 2 MB of heap, max
Main
Co
ntr
oller
versio
n 2
Oth
er
mo
du
les, p
ure
Java o
r K
ern
el
Oth
er
mo
du
les, p
ure
Java o
r K
ern
el
Oth
er
mo
du
les, p
ure
Java o
r K
ern
el
Oth
er
mo
du
les, p
ure
Java o
r K
ern
el
Beyond Standard Java: from E-Commerce to Industrial Robotics
Case study no. 2: industrial robotics
Controller Communications Module
From 2 to 14 per rig Manages communication between master and slaves
Always running Manages communication among slaves
Reads hundreds of inputs per pass Each communication module can manage up to 30 concurrent sessions
Implements logic for acting on simple or compound inputs
Uses industry standard I/O transports
Writes hundreds of outputs Exchanges local and remote data between controllers
Unlike a PLC, every cycle is well-defined and predictable (up to 50 times per second!)
100% Java
Cannot be preemptedIn production around the world, 7x24x365 in
the North Sea, Korea, the Gulf of Mexico, and the African coast
Exchanges data with I/O card in memory
100% Java
Critical Components
Beyond Standard Java: from E-Commerce to Industrial Robotics
Case study no. 3: eCommerce Very large eCommerce site - nothing fancy, just huge
Database-driven• Significant portion of the business logic is implemented in stored procedures
• Single database system
High availability during ‘holiday period’
• Retail: most income generated over the last few weeks of the year
Interactions with multiple service providers• Must support standard and non-standard protocols
The Site grew in response to demand
• Engineering decisions are reactive and driven by business
• Monolithic application
Beyond Standard Java: from E-Commerce to Industrial Robotics
HTTP
Case study no. 3: eCommerce
Internet
Load
balancer
Web servers
Session and
catalogue caching
CatalogueCheckout
Order Processing
FTP
Custom
protocol
Updates to
home office,
customer support,
financial reports
Third party
Third party service providers
Fulfillmentsystem
SOAP
Beyond Standard Java: from E-Commerce to Industrial Robotics
Case study no. 3: eCommerce Basic infrastructure
• Apache 2.x
• Tomcat
• JSP
• Struts/JSTL/others
• JMS/MQ
• Java 5 or later
Web site migration completed in mid-2005
Back-end systems completed Q3, 2005
Large commercial database• Business logic built into the database
• Separate code base written in a programming language and SQL
• Custom connection pools
Beyond Standard Java: from E-Commerce to Industrial Robotics
Case study no. 3: eCommerce Estimated load: 100 million page views per day
• 7 - 10 million sessions
SLA: 7x24 availability during a 6-week window• Rest of the year can have maintenance windows
• 10 seconds maximum response time over 56 kbps
Implementation grew from a “home brewed” system• Custom extensions to Tomcat, SSL, instrumentation, JSP, etc.
• Evolutionary implementation of open-source components as they become stable
• Made-to-fit caching mechanism because none of the usual application servers provides a good solution
Beyond Standard Java: from E-Commerce to Industrial Robotics
Case study no. 3: eCommerce SLA: met successfully for the last five years
• Year-over-year traffic increase est. 30%
Development policy: code is released on a fixed schedule
• Eight-weeks development/test/deploy cycles
• A project may span more than one development cycle
Software components policy: use the best of breed• Mix of commercial and open-source components
• Meritocracy: the solution with the best benchmarks wins
• Continuous evaluation an integration of new technologies
Beyond Standard Java: from E-Commerce to Industrial Robotics
Case study no. 3: eCommerceSome Examples
Migration from Java 1.4 to Java 5 - 16 week project, completed
successfully. Early adopter, fully in production
Introduction of an ORM layer - still under investigation.
Hibernate, Cayenne, others under consideration; none will integrate well
Struts, JSTL - completed over a period of 12 months with great
success; integrates well with the rest of the system
SOAP/web services - implemented over a 16 week project, now it
handles over 2M transactions per day against Java and non-Java (i.e. .Net) third party services
Integration with non-web browser clients and devices - under
development for 6 months; under investigation
Beyond Standard Java: from E-Commerce to Industrial Robotics
Beyond Standard Java
Eugene [email protected] can find this presentation at:http://eugeneciurana.com/musings/JavaInAction.html
Q&A