Wednesday, 3 May 2017

AM Pooling

Application Module Responsibilities
  • Manage transaction against a data source
  • Manage session's state
Root vs Nested vs Shared AMs
  • Root AM
    • Created for each user session
    • Stored in the pool
    • Handles transactions, connections, state
  • Nested AM
    • A logical construct only for grouping VOs
    • Are themselves nested under a root AM
    • Delegates all responsibilities to the root AM
    • reference to a nested AM in the pool is really reference to it's parent
  • Shared AM
    • They are shared across all user sessions
Settings
  • AppModule(AppModule.xml) -> Configurations -> 
    • The settings are stored in bc4j.xcfg 
  • Common Passivation Mistakes
  • Variables in AppModuleImpl & ViewObjectImpl
    • Override passivateState() and activateState()
  • ADF BC VO transient attributes to be passivated if needed.
Application Module lifecycle
  • AM statuses are Available, Unavailable or referenced
    • Available - Ready for use
    • Unavailable - Processing, currently checked out to a servlet thread
    • Referenced - Processing complete, Checked into pool, Pinned for session future request
  • Available - All AMs are initially marked available for use in the pool when instantiated
  • Unavailable - Upon new request any available AM will be "checked out" for a servlet thread
  •  

Passivation
  • Offloads AM state to a persistent store -  maintained in table ps_txn in XML format
    • Transactional data - new, modified and deleted entities
    • Non-Transactional data 
      • Current row indicator
      • new rows and their position
      • View Criteria and parameters
      • Flag indicating whether the rowset had been executed 
      • Range start and size
      • Access mode
      • Fetch mode and size
      • Any view object custom data
      • Transient view object attributes if configured
      • Select, from, where and order by clauses if created dynamically
    • Doesn't passivate
      • Query rows - They are passivated only if modified, deleted or new row created
      •  
  • Alternate reasons for Passivation
    • Fail over support
    • Or jbo.ampool.doampooling=false
      • For testing passivation by eagerly turning it on
    • Or jbo.doconnectionpooling=true & jbo.txt.disconnect_level=0(but not 1)
 
Cleaning the Applicaiton Module pool

Passivation Mistakes
  • Using member variables in AppModuleImpl or ViewObjectImpl
    • Adf bc doesn't automatically passivate above member variables by default
    • One need to override passivateState() & activateState() to ensure they are read and written
  • View Object Transient attributes
    • Explictly set VO transient attributes to be passivated if needed

No comments:

Post a Comment