Persistent Session Storage Henceforth referred to as PSS :) - - - PowerPoint PPT Presentation

persistent session storage
SMART_READER_LITE
LIVE PREVIEW

Persistent Session Storage Henceforth referred to as PSS :) - - - PowerPoint PPT Presentation

MONTREAL JUNE 30, JULY 1ST AND 2ND 2012 Persistent Session Storage Henceforth referred to as PSS :) - Ramsey Gurley Demo MONTREAL JUNE 30, JULY 1ST AND 2ND 2012 What does this mean? Robust, scalable, front end apps using component actions.


slide-1
SLIDE 1

MONTREAL JUNE 30, JULY 1ST AND 2ND 2012

Persistent Session Storage

Henceforth referred to as PSS :)

  • Ramsey Gurley
slide-2
SLIDE 2

Demo

slide-3
SLIDE 3

MONTREAL JUNE 30, JULY 1ST AND 2ND 2012

Robust, scalable, front end apps using component actions.

What does this mean?

slide-4
SLIDE 4

Advantages of PSS

  • Memory consumption
  • Long sessions
  • Distribution
slide-5
SLIDE 5

Memory Consumption

  • Sessions storage handled by EOF
  • Session memory freed after each request
  • Drastically improves stateful performance under load
slide-6
SLIDE 6

Long Sessions

  • WOSessionTimeOut=0
  • Bookmarkable component actions
slide-7
SLIDE 7

Distribution

  • WOSession’s setDistributionEnabled()
  • Restart instances anytime
  • Improved scaling
slide-8
SLIDE 8

How do I enable PSS?

slide-9
SLIDE 9

Demo

slide-10
SLIDE 10

Steps to enable PSS

  • Add ERPersistentSessionStorage framework
  • Set up the connection dictionary for the model
  • Generate the schema from the model (Enable migrations)
slide-11
SLIDE 11

MONTREAL JUNE 30, JULY 1ST AND 2ND 2012

How now brown cow?

Why has no one done this before now?

slide-12
SLIDE 12

Serialization Bug

slide-13
SLIDE 13

EOGenericRecord

  • Serialize EO
  • Serializes EC
  • Deserialize EO
  • Deserialize EC
  • Populate EO

EO EC

slide-14
SLIDE 14

Workaround?

  • Serialize EC first!
  • Fails :(
slide-15
SLIDE 15

EOGenericRecord

  • Serialize EO
  • Serializes related
  • Deserialize EO
  • Deserialize related
  • Populate EO

EO EO

slide-16
SLIDE 16

What happens?

  • EOCustomObject classDescription
  • EOGenericRecord serializes classDescription
  • Deserialize EOCustomObject sets values
  • Dictionary not created until EOGenericRecord sets

classDescription

  • NullPointerException
slide-17
SLIDE 17

Serialization Bug Fix

  • Re-implement core classes
  • EOCustomObject
  • EOGenericRecord
slide-18
SLIDE 18

Other WO Serialization Erros

  • WODisplayGroup
  • D2WPage
slide-19
SLIDE 19

Serialization

  • Classpath order - ERD2W & ERPSS
  • General rule - Wonder first
slide-20
SLIDE 20

PSS Requirements

slide-21
SLIDE 21

PSS Requirements

  • Serializable components and classes
  • Serializable session
  • No memory leaks
slide-22
SLIDE 22

Serializable Classes

slide-23
SLIDE 23

serialVersionUID

/** * Do I need to update serialVersionUID? See section 5.6 <cite>Type Changes * Affecting Serialization</cite> on page 51 of the <a * href="http://java.sun.com/j2se/1.4/pdf/serial-spec.pdf">Java Object * Serialization Spec</a> */ private static final long serialVersionUID = 1L;

slide-24
SLIDE 24

Update serialVersionUID?

  • Change class hierarchy
  • Delete fields
  • Make non-static into static
  • Make non-transient into transient
  • Change type of a primitive field
slide-25
SLIDE 25

Serializable Session

slide-26
SLIDE 26

Serializable Session

  • Serializable instance variables
  • Serializable object store contents
slide-27
SLIDE 27

No Memory Leaks

slide-28
SLIDE 28

Helpful Tools

  • FindBugs
  • jvisualvm
  • jMeter
slide-29
SLIDE 29

Find Serialization Errors

slide-30
SLIDE 30

FindBugs

http://findbugs.cs.umd.edu/eclipse/

slide-31
SLIDE 31

FindBugs

slide-32
SLIDE 32

Serialization Debug Property

sun.io.serialization.extendedDebugInfo=true

slide-33
SLIDE 33

Serialization Debug Property

Caused by: java.io.NotSerializableException: er.extensions.localization.ERXLocalizer

  • field (class "er.modern.directtoweb.components.ERMDBatchSizeControl", name: "_localizer", ...
  • object (class "er.modern.directtoweb.components.ERMDBatchSizeControl",...
  • element of array (index: 5)
  • array (class "[Ljava.lang.Object;", size: 7)
  • field (class "com.webobjects.foundation.NSDictionary", name: "objects", type: "class [Ljava.lang.Object;")
  • custom writeObject data (class "com.webobjects.foundation.NSDictionary")
  • object (class "com.webobjects.foundation.NSMutableDictionary", ...
  • custom writeObject data (class "com.webobjects.appserver.WOComponent")
  • object (class "er.modern.look.pages.ERMODListPage", ...
  • field (class "com.webobjects.appserver._private.WOTransactionRecord", name: ...
  • object (class "com.webobjects.appserver._private.WOTransactionRecord", ...
  • element of array (index: 1)
  • array (class "[Ljava.lang.Object;", size: 2)
  • field (class "com.webobjects.foundation.NSDictionary", name: "objects", type: "class [Ljava.lang.Object;")
  • custom writeObject data (class "com.webobjects.foundation.NSDictionary")
  • object (class "com.webobjects.foundation.NSMutableDictionary",
  • field (class "com.webobjects.appserver.WOSession", name: "_contextRecords", ...
  • root object (class "wowodc.modernpss.Session", ...
slide-34
SLIDE 34

Other Serialization Issues

slide-35
SLIDE 35

D2WContext

  • D2WContext is not serializable
  • ERD2WContext is serializable
  • Use ERD2WContext factory
slide-36
SLIDE 36

ERD2WContext

  • Does not serialize entire context
  • frame
  • task
  • entity
  • propertyKey
  • pageConfiguration
  • object
slide-37
SLIDE 37

ERXEC

  • calls dispose() during writeObject()
slide-38
SLIDE 38

Find Memory Leaks

slide-39
SLIDE 39

jvisualvm

  • Installed with Java 1.6+
  • Just type ‘jvisualvm’ into Terminal.app to launch
  • View CPU and memory usage
slide-40
SLIDE 40

No Memory Leak

slide-41
SLIDE 41

Memory Leak

slide-42
SLIDE 42

Analyzing Memory

  • Heap Dump
  • Object Query Language (OQL)
  • http://visualvm.java.net/oqlhelp.html
slide-43
SLIDE 43

Load Testing With JMeter

slide-44
SLIDE 44

JMeter

  • http://jmeter.apache.org/
slide-45
SLIDE 45

Finding a Memory Leak Demo

slide-46
SLIDE 46

Q & A