2011/11/16

Performance Anti-Patterns in Hibernate


Patrycja Wegrzynowicz
Snippets:
  • "premature optimization is the root of all evil"
  • "expect unexpected"...
  • avoid temporary changes
  • careful with Collections: inadequate collection mappings can impact resulting # of queries
  • OneToMany on owning side: lots of unnecessary locking / querying
  • bulk processing through Hibernate --> use database operations instead
Conclusion
  • big data = big problems -- my addition: with hibernate :-)
    • standard mappings don't handle large datasets well
    • smart model, bulk processing, projections
  • read the manual
    • hibernate docs
    • think of consequences
  • hibernate
    • smart policies / data structures
Nothing was said of my personal performance finding with Hibernate: maximally use readonly access whenever possible. The support for 'dirty' objects adds a lot of performance overhead if some model-parts are readonly.

Bleeding Edge HTML5


Paul Kinlan
This presentation demonstrated some ongoing - bleeding edge - development in html5:
  • : section that can be collapsed: no extra javascript required
  • : highlight portions of text
    • less javascript
    • easier for to handle
  • input-tag adds support for speech-to-text input
  • video & animations: check if the current tab is visible. Allows to stop a video when the tab is inactive
  • a link can suggest the browser to pre-fetch the contents of links the user will likely click --> the page is pre-loaded
  • intents: loosely coupling/integration of services from different websites. Cfr Android intents: an application asks a photo viewer and Android lets the user choose which one he wants.
  • check online / offline status in javascript or use a callback. --> clean handling of unconnected status.
  • paste of images in browser
  • camera / microphone support
  • full-screen support, callable from javascript (user must grant permission)
  • WebRTC: real-time communication: Real time Video / audio for communication
  • much better audio support
check out http://html5hacks.com

JDK 7, 8 and 9


Mark Reinhold


Java7
  • Project Coin: small language improvements
    • diamond <> operator: easier generics
    • multi-catch clause
    • ...
  • invokedynamic: bytecode opperation for dynamic languages (e.g. JRuby) and will be used for Lamba expressions in Java 8.
  • fork/join framework
Java8
  • Lambda expressions (aka Closures)
  • Jigsaw: modularity
    • improve performance:
      • only load what's needed
      • more efficient jmod package type
    • dependencies are defined in the module configuration --> better than the current classpath hell
    • jmod modules will be easily packaged into rpm or deb packages ⁻ JavaFX 3.0
  • Type annotations
  • new Date/Time library (cfr. JodaTime)
  • support for Sensors (accelerometer, etc.)
Java9 (not decided yet)
  • self-tuning JVM's
  • better JNI
  • support for Big Data
  • reified generics
  • unified types: int <> Integer etc.
  • optimize tail recursion... finally?
  • resource management / accounting?

Devoxx11: Java EE Keynote


Cameron Purdy
Focus on next Java EE versions 7 & 8:
  • Html 5
  • Modularity
    • jigsaw
    • profiles:JEE providers can choose to not implement part of the SPEC. Eg. some older specs like EJB CMP & BMP will become optional.
  • Cloud
    • elastic
    • auto provisioning
    • Paas
Platform as a Service (Paas) details
  • JEE7 is the service
  • auto-provisioning:
    • DB (incl. init-script)
    • LDAP
    • loadbalancer / clustering settings
  • extensible for frameworks (e.g. Spring, Seam)
  • Quality of Service (QOS)
  • API's for the Cloud: Caching ...
  • Multi-tenant: deploy the same app for multiple / isolated users.
  • Cloud descriptions in meta in the ear
Other:
  • Timeboxed strategy for providing JEE 7 / 8: : everything not ready for JEE7 will shift to JEE8.
  • Glassfish provides the reference implementation of latest JEE developments.

Devoxx11: Java SE Keynote


Henrik Ståhl
Java Standard Edition (SE) 7 achievements:
  • project coin: small language improvements
  • concurrency: fork/join framework
  • JavaFx as part of the java language
Java SE 8 focus:
  • Jigsaw: modularity
  • lambda (aka closures): opens the door for easier to use concurrency api's
  • javaFx 3.0
  • new devices: multi-touch etc.

2011/11/15

Devoxx11: Jackpot 3.0 - Large Custom Refactorings



Jan Lahoda
Jackpot:
  • originally from Sun labs
  • uses the Abstract Syntax Tree (AST) --> knows java-language / syntax: smarter than simple regexp's
  • ideal to refactor deprecated API's
  • remove anti-patterns
Jackpot is now included in Netbeans 7.1
  • use special 'Hint' syntax: Class.oldMethod => NewClass.newMethod ;;
  • completely integrated in standard Netbeans hints / refactoring logic
    • hints are show in the IDE, directly to the developer
    • batch refactorings are allowed: completely integrated in the "Inspect and refactor" dialog (incl. managing hints)
    • run headless from the command line
  • can be highly fine-tuned:
    • use instanceof checks
    • match on specific Java constructs: e.g. only look for Fields
    • check on target java version
    • combine multiple checks
    • write repeatable tests in ".test" file
  • definitely worthwhile looking at for large refactorings of legace Java projects!

Devoxx11: Java 7 toolbox


Project coin brought some minor improvements to the Java language. Most notably:
  • easier generics:
    • diamond operator <>: less copy/paste thanks to smarter compiler
    • less warnings on vararg's
  • easier error-handling:
    • multicatch: less copy/paste
    • 'try-with-resource' contstruct: automatic & correct closing and error handling
  • consistency / clarity
    • Strings in Switch
    • numbers improvements:
      • direct binary format: 0b0101001
      • logical grouping of large number in sub-chunks: 123_435_576L --> java ignores the underscores.
IDE support
  • Netbeans & Intellij have excellent support for Java 7
    • inline hints and refactorings are offered
    • batch refactorings throughout the 'inspect and transform' dialog
  • Eclipse is somewhat lagging behind.

Devoxx11: Real-world deep-dive into Infinispan - the open source data grid platform


Sanne Grinovero, Pete Muir and Mircea Markus
Infinispan details
  • developed & provided by JBoss
  • Open Source license
  • distributed, in-memory data structure
  • High Available: configuration options depending on your safety / performance considerations
    • Total replication
    • Partial replication ("distribution mode")
  • Elastic:
    • easy to scale up / down
    • deal with node stops / crashes
    • accept additional nodes
    • managed through JGroups
Capabilities:
  • Transactions
  • Map / Reduce
  • Query
  • JMX access
Two access modes to inifinispan:
  • embedded mode: in the JVM
  • client / server mode: different protocols supported:
    • REST
    • memcached
    • hotrod
Possible setups:
  • local cache: Simple Map-like interface, with advanced cache-features (eviction, etc.)
  • cluster cache: all caches are kept in sync between JVM's, the developer is responsible for accessing the persistence layer (DB)
  • grid cache: the cache itself handles the persisting of the data to the DB.
JGroups
  • reliable cluster communication
  • developed by JBoss, and used by Infinispan
  • Node / cluster config (incl. auto-discover setup)
  • focus on performance: e.g. UDP, but with reliability handled by JGroups
  • support for reliable multicast messages

Devoxx11: Building Web Applications with MongoDB

Brendan McAdams

mongoDB is a nosql DB, ie. a "non-relational" DB

  • no joins
  • no referential integrity
  • no complex transactions --> not suitable for higly transactional apps
  • but: focus on horizontal scalability
    • sharding
    • replica's
  • a scheme-less DB
    • unique ObjectID is automatically generated (based on time, machine, pid & counter)
    • flexible structures: adding/omitting elements is easy
  • native JSON support
    • hierarchical 'documents'
    • arrays
    • internally, an optimized format is used: BSON:http://bsonspec.org
  • support for indexes (+ 'multi-indexes' on arrays)

technical specifics:

  • based on memory mapped files:
    • OS maps the files in the RAM.
    • pagefaults are expensive --> keep working set in RAM
      • provide sufficient RAM
      • prewarm the DB
    • only use 64bit OS & binaries
  • Intel-only (little endian)
  • filesystem
    • Ext4 & Xfs: only filesystems with support for posix_fallocate()
    • set noatime, noadirtime in /etc/fstab
  • 'documents' (i.e. objects) have a max. size of 16mb
  • accessible over tcp/ip: Mongo Wire Protocol
  • UTF-8
  • the data is stored in fysical files / 'extents'

modeling for mongoDB:

  • think of 'documents' instead of 'rows'
  • favor embedding over referencing -- mongoDB offers no referential integrity (aka foreign keys)
  • think of the access patterns of your data

other specifics:

  • support for MapReduce
  • geospatial indexing
  • indexes (internally btrees)
  • query optimization
  • advanced queries ($lt, $all, $in...)
  • gridfs:
    • large 'chunked' files
    • distributed (sharded)
    • accessible through a regular java.io.File

2011/11/14

Devoxx11: Codereview with GIT / Gerrit

Matthias Sohn

Git:

  • decentralized source version control
  • good at merging
  • cryptographic hashes to prevent modifications to history
  • works well off-line
  • personal branches
  • JGit: written in Java
  • eGit: eclipse plugin for Git

Adopters of GIT:

  • Linux
  • CVS will be deprecated in 2012
  • eclipse.org: converting from CVS to Git

Gerrit:

  • Code-review based on Git
  • parallel work-flow based on branches
  • web based interface

Devoxx11: Android awesomeness

Chet Haase, Romain Guy and Philip Milne

Android 4.0: Tablet (3.0) & Phone (2.3) reunited

GridLayout: powerful & flexible lay-outing -- way too complex explanation.

Tools for profiling / debugging Android apps. "Experience matters"

  • Memory
    • dumpsys: dump info of processes running on the device
      • adb shell dumpsys meminfocom.android.Launcher: dumps heap usage details
      • dumpsys gfxinfo: graphics chip
      • dumpsys window: decompose window objects used
    • DDMS: heap dump
    • jhat:
      • generate hprof
      • convert it with hprof-conv
      • in eclipse
      • check out "rootset references" for potentially memory leaks
    • MAT: Eclipse Allocation Tracker - http://eclipse.org/mat
  • Performance
    • "use your eyes"
    • DDMS
    • track frames per second -> "trackFPS()" call in a PreDrawListener
  • UI
    • 'crazy' stuff like high speed cams: Casio Ex-F1: replay the animation in slow motion
    • HierarchyViewer:
      • ViewTree
      • PixelPerfectTree
    • ViewServer

Devoxx11: Android Jumpstart

Lars Vogel

Excellent introduction to the Android development experience.

  • tutorials on Android: www.vogella.de
  • java --> class -- through dx-tool --> dex
  • development environment: ADT for eclipse.
    • emulator: QEMU
    • DDMS: very powerful device debug mode
  • API Components:
    • View for single views & ViewGroup for combining
    • Activity: app lifecycle - onPause() is the guaranteed last call to persist data
    • Intent: transitions to other apps
      • Implicit: Android decides
      • explicit: hard coded coupling to called app
    • Toast class: display quick temporary message
    • Preferences
    • DIY Views:
      • onDraw() method
      • Path class
      • selective invalidate() call to improve performance
    • ListActivity & ListAdapter
    • Threading & Async behaviour:
      • Threads: use runOnUiThread for async updates of the UI
      • Services
      • Broadcast & Receiver