Oracle Optimized Java SE for Embedded Platforms DOAG 2010

Transcription

Oracle Optimized Java SE for Embedded Platforms DOAG 2010
<Insert Picture Here>
DOAG 2010, Nürnberg
Oracle Optimized Java SE for Embedded Platforms
Dr. Rainer Eschrich
Principal Sales Consultant Java Embedded Business Unit
The preceding is intended to outline our general
product direction. It is intended for information
purposes only, and may not be incorporated into
any contract. It is not a commitment to deliver
any material, code, or functionality, and should
not be relied upon in making purchasing
decisions.
The development, release, and timing of any
features or functionality described for Oracle’s
products remains at the sole discretion of
Oracle.
© Oracle 2010
2
Topics
Why Java
Java SE Embedded
Technical Details
Use Cases
Conclusions
© Oracle 2010
©2010 Oracle Corporation
3
Java in Embedded – An Introduction
Embedded Microprocessor Trends
• Atom Dual Core Processors
• Cortex A5 Dual Core
• Cortex A9 Dual/Quad Core
• 250mw power 1ghz today
•ARM Eagle Cortex A15 Coming
• Quad 2.5 ghz!
• Nvidia Tegra 2 – 1ghz Dual A9
• PowerPC QorIQ Family
• N550 1.5ghz 8.5w
• P2020 Dual Core 1.2ghz
• D525 1.8ghz 13w
• P4080 Quad Core 1.5ghz
• D510 1.66ghz 13w
Embedded Communication
• 330 1.6ghz 8w
Processors
• Marvell Quad-Core
•TI OMAP4 Dual core Cortex-A9
Common Themes
• Embedded Multi-Core is everywhere
• ARM continuing low power legacy, Intel
moving into that space with Atom
• ARM setting sights on server market
© Oracle 2010
5
Java Features
•
•
•
•
•
Proven & Stable
Huge Developer Base
Rapid Application Development
Fully Object Oriented
Run on a Virtual Machine
–
•
•
•
•
Memory Management, Portability, Cross Platform …
Multi-Thread, -Process and -CPU/Core support
Security
Networking
Deployment
©2010 Oracle Corporation
The Java Embedded Continuum
Java Card
Java ME(CLDC)
Embedded Space
©2010 Oracle Corporation
Java ME(CDC)
Java SE
What I will
talk about!
Java in Embedded – Java SE Embedded
What does “Embedded” mean?
• Two definitions used: Legal and Technical
• Legal definition of Embedded SE:
Designates a Field Of Use (FOU)
– Embedded FOU defined in the license file as anything that is not a
“general purpose desktop computer or server”
•
e.g : “industrial control systems, wireless mobile telephones,
wireless handheld devices, kiosks, TV/STB, Blu-ray Disc devices,
ATM's etc...”
– Applies to both embedded (footprint-reduced) SE
implementations and “regular” SE implementations
– Royalty bearing, affordable pricing
•
©2010 Oracle Corporation
Dedicated, flexible, versatile pricing model applies:
based on unit cost and volume.
Java SE Embedded Only Implementation
●
Embedded Only Features:
−
Memory reductions/optimizations
−
Disk/Flash/ROM size reductions
●
Headless Configuration
●
Removal of optional files and Java classes
−
Low Power Handling
−
Additional Platforms (Linux/ARM, Linux/Power,
WinXP Embedded)
And of course all the good stuff Java SE brings out
of the box and via third party libraries/apps … (like
Java EE ...)
© Oracle 2010
10
Targeted Configurations
(Today)
Processor
Operating
System
Headless or FPU
Headful
Java SE
Version
ARMv5
Linux
Headless
Soft-Float
6U21
ARMv6/v7
Linux
Headless &
Headfull
(v7)
Hard-Float
6U21
PowerPC
e600 core
Linux
Headless
Classic
Hard-Float
6U21
PowerPC
Linux
e500v2 core
Headless
Embedded
Hard-Float
6U21
X86
Linux
Headless
X86
6U21
X86
XP
Embedded
Headful
x86
5U10
© Oracle 2010
11
Java in Embedded – Tech Stuff
Small Footprint for Embedded
The standard release’s ROM/disk footprint
is too big for many embedded devices
●
−
Memory getting cheaper, but cost remains
a factor: Profit = Margin x Volume
Small footprint optimizations
●
−
−
©2010 Oracle Corporation
Additional Compression, File Removal
Footprint reduction of up to 56%
●
e.g 6.0 for ARM around 32 MB
●
e.g., for 5.0 on Linux/x86: from 68MB to
29.5MB
Java SE – Custom Embedded Builds
• Technical definition of embedded SE:
Custom – footprint-reduced – but still SE
compatible
SE
specification
“Regular” SE
implementation
Embedded SE
implementation
NOT an SE
implementation
©2010 Oracle Corporation
optional
components
Small Footprint for Embedded
File removal includes
Deployment: Java Web Start, Plug-in, Pack2000
and Unpack2000
●
IDL and RMI: rmiregistery, rmid, servertool,tnameserv
●
Security: Policytool, keytool, ktab, klist, kinit
●
Orbd
●
Man pages
●
Localization
−
Character convertors (charsets.jar)
●
Remove either Client Compiler or Server Compiler
●
©2010 Oracle Corporation
Headless Feature for SE Embedded
●
Headless option
−
−
●
No support for keyboard, mouse, video
Otherwise full SE functionality, including
printing
Runtime and build implementation
−
−
©2010 Oracle Corporation
Headless flag hard-wired on
●
Djava.awt.headless=true
“Headful” files removed, including libmawt.so
Low Memory Support
The Linux community has been searching for solutions to
handle low memory conditions
●
●
●
Killing processes is NOT the answer (SIGABORT, ouch!)
We chose to support /dev/mem_notify
−
Linux kernel driver monitoring available memory
/
dev/me
m_notif
y
avail?
NO
Feature
Unavailable
©2010 Oracle Corporation
YES
Create
Monitoring
Thread
Open
/dev/mem
notify
Block Waiting
for Input
from Device
Full GC
*Release Additional
VM Memory
(JIT Buffers, etc)
Java SE Embedded Feature
Power Conservation
•
Goal
–
•
Reduce CPU usage to 0% when Java
applications are idle in order to allow CPU clock
to be reduced or suspended
Modifications Performed
–
–
©2010 Oracle Corporation
Hotspot Virtual Machine
• Eliminated all Polling Threads
Java SE AWT/Swing Changes
• Eliminated Polling for X Events when idle
Embedded Caffeine Mark Performance
Improvements
+29%
+22%
+21%
© Oracle 2010
19
specJVM98 Performance Improvements
+19%
+17%
© Oracle 2010
20
Performance Java SE 6 versus Android2.2
2.5X
2.16X
© Oracle 2010
1.53X
2.15X
21
Tuning your Embedded Java Solution
Default configuration
●
Improving Startup Time
●
Taking Advantage of Multi-core processors
●
Picking the Right Garbage Collector
●
Throughput/Response Time
Memory Consumption
Disk/Flash Consumption
Clock Speed, Number of CPUs
Heap Size
?
Startup Time
JIT Strategy
Garbage Collection Policy
© Oracle 2010
22
Java SE Embedded Design Focus
• Assumptions leading to our default configuration
of SE Embedded
– Most embedded devices are resource constrained
– Keeping per unit device cost low is high priority
– Use lower clocked processors
Option
Java SE Embedded
Default State
Performance Monitoring
Off by Default
Compression of JAR Files All Jar File Compressed
© Oracle 2010
All JRE Files Included
Optional Files Removed
Class Data Sharing
Off by Default
JIT Compiler
Only –client JIT available
23
Improving Startup Time
●
Class Data Sharing (If classloading is bottleneck)
−
−
−
●
Uncompressing jar files (If disk space is available)
−
●
Enabling Class Data Sharing
Customizing Class Data Sharing Archive
Can improve Startup by 25%-30%
Gain is dependent on disk access and CPU clock speed
Lower Compilation Threshold (If MP device)
-XX:CompilationThreshold=xxxx (default is 1500)
Deferring Initialization or Class Loading in your
application
●
© Oracle 2010
24
Enabling and Configuring Class Data
Sharing
●
Enabling CDS with default classlist
−
java –Xshare:dump
−
Once complete, CDS is automatically enabled
Use java –Xshare:on OR –Xshare:off to compare
startup times.
●
The default classlist is for GUI Swing Based Apps
●
© Oracle 2010
25
Customizing Class Data Sharing for
Embedded Java Applications
1. Create a list of classes loaded at the startup of your application
java –Xshare:off –XX:+TraceClassLoadingPreorder {your app}
>my_class_list
*exit your app soon after startup
2. Extract only bootclass loaded classes. Outputs classlist.linux.
java MakeClassList my_class_list >new_classlist
3. Add checksum to end of new_classlist
java AddJsum new_classlist classlist
4. Copy classlist to {JRE}/lib directory
5. Create classes.jsa file
java –Xshare:dump
– You now have a customized classes.jsa file!
Tools referenced on this page can be found in openjdk sources here: jdk/make/tools/src/build/tools
© Oracle 2010
26
Taking Advantage of Multi-Core
Processors with Java
●
Built in VM Features that take advantage of SMP
−
−
−
●
© Oracle 2010
Parallel Garbage Collection
Concurrent Garbage Collection
Background JIT Compilation
●
Lower Compilation Threshold
Parallelize your Java Application Code
27
Which Garbage Collector Should I Use?
Java SE Embedded Contains all of the standard collectors
Collector
Option
Pro
Serial
-XX:+UseSerialGC
(default)
Best Choice for single
CPU
Concurrent
-XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode
Better if response
time is highest
priority
Shorter GC pauses
Uses processor
resources while
embedded app is
running
Y
Parallel
(Young)
-XX:+UseParallelGC
Better if throughput is
highest priority.
Uses multiple
processors to speed
up GC collection
GC must still pause
embedded app during
collections.
Y
Parallel (Old)
-XX:+UseParallelOldGC
Con
MP
N
For more details on GC tuning options see:
http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html
© Oracle 2010
28
Reducing System Resource Requirements
(Reducing Memory Consumption)
Customizing Heap Sizes
-Xms -Xmx
●
Adjust Free Ratios
-XX:MaxHeapFreeRatio=xx (control heap reduction, default 70)
-XX:MinHeapFreeRatio=xx (controls heap expansion, default 40)
●
Reducing JIT CodeBuffer
-XX:ReservedCodeCacheSize=xxM
●
Standard Java SE tools can be used to identify potential memory savings
−
Use jvisualvm with Linux x86 JDK
●
Heapdump option
●
© Oracle 2010
29
Java in Embedded – Use Cases
Java SE for Embedded - Example devices
•
•
•
•
ATMs
Parking Meters
POS Systems
Lottery/Gaming
Systems
• Multi Function Printers
• Intelligent Power
Module
• Netbooks
© Oracle 2010
• Routers & Switches
• Storage Appliances
• Network Management
Systems
• Medical Imaging Systems
• Radar Systems
• Industrial PCs
• Factory Automation Systems
• Geo-Imaging Devices
• Smart Meters
• RFID Readers
• Video Conferencing
Systems
• In-Flight Entertainment
Systems
• Video Streaming Systems
• Electronic Voting
Systems
• Voice Messaging
Systems
• Security Systems
31
Java SE Embedded in Smart Metering
EnergyICT
Java SE Embedded Based
Smart Meter Concentrator
© Oracle 2010
32
Java SE Embedded – Sheeva Plug
●
Low Power ARM/Linux based device design by Maxwell
−
512 MB RAM, 512 MB Flash, USB & Gigabit Ethernet
−
ca. 100-120 US$ for single devices
●
Flexible and Capable
●
Runs Java SE Arm v5/Linux headless
Low Power Java Web Server:
http://www.theregister.co.uk/2010/11/11/diy_zero_energy_home_server/
●
© Oracle 2010
33
Java in Embedded – Conclusion
Future Enhancements under
Consideration
• Performance, Startup and Size Reduction always top
priority
• Server (C2) JIT for ARM Platforms
• Bundled Solutions for Specific Markets
• Embedded specific Module implementations
• JDK7
• G1 – Garbage First Collector
• MVM – Multi-Tasking Virtual Machine
© Oracle 2010
35
Benefits of Java SE Based Embedded
Solutions
1
Decouples Software Development from
Hardware Development Cycle
5
Most Popular Embedded Processors
Supported Allowing Design Flexibility
2
Development and Testing Can be Done
Using Standard Desktop Systems
6
Java SE embedded isolates your apps
from Linux kernel, glibc differences
3
Rich set of standard APIs For Quick
Time To Market
7
All Standard Java SE Garbage
Collectors Supported
4
Same Versions of Java as Desktop &
Server Releases
8
Customized for Embedded Devices To
Reduce Production Cost
© Oracle 2010
36
Questions?
For more information on Embedded Java:
http://www.oracle.com/technetwork/java/embedded/overview/index.html
© Oracle 2010
37