SlideShare a Scribd company logo
MONTREAL JUNE 30, JULY 1ST AND 2ND 2012




WebObjects Optimization:
EOF and Beyond
Chuck Hill,VP Development
Global Village Consulting, Inc.
  Ranked 76th in 24th annual PROFIT 200 ranking of 
  Canada’s Fastest-Growing Companies by PROFIT Magazine!
WOWODC 2012
Session Overview

•   Outline:

    •   Follow the architecture


•   Three kinds of optimization:

    •   low effort, high effort, application specific

•   Most is pretty easy
A WOrd of Advice

•   Be Productive: Measure, don’t Guess


•   Seek High ROI (Return On Investment)


•   Premature Optimization
Performance Measuring
•   Use realistic set of data

•   Beware the first request!

•   jperf, jmeter, shark, range of options

•   Simple as NSTimestamp and logging

•   Wonder has functionality too

•   WOEvent and EOEvent can be used also
ERProfiling and Heat Map
•   From Mike Schrag and Apple

•   Understand how your app is functioning

•   Understand why it's slow

•   Designed around WebObjects

•   Page-based approach to profiling

•   Look at the statistics for individual pages and actions
End to End


                       WO
                      Adaptor
                                                 Relational Database
Client   Web Server              App Instances
Browser Considerations
•   gzip compression

•   er.extensions.ERXApplication.responseCompressionEnabled=true

•   Minify js

•   Combine CSS

•   Combine images

•   Minify HTML and CSS
WebServer Side
•   mod_gzip

•   mod_deflate

•   mod_expires
       <IfModule mod_expires.c>
               ExpiresActive    On
               ExpiresDefault   A60
               ExpiresByType    application/javascript A3600
               ExpiresByType    text/css A3600
               ExpiresByType    text/html A1
Apache Tuning

•   MinSpareServers 10           •   KeepAliveTimeout 15

•   MaxSpareServers 20           •   ServerLimit 2048

•   MaxRequestsPerChild 10000    •   ListenBackLog 511

•   Timeout 45                   •   MaxClients 128

•   MaxKeepAliveRequests 50000
WO Adaptor Settings
•   FastCGI in Wonder

•   Keep worker threads and listen queue size low




•   Only default (Round Robin) load balancing works(?)

•   Interleave instances across servers
Application and Session
•   setAllowsConcurrentRequestHandling(true);

•   setCachingEnabled(true);

•   -WODebuggingEnabled=false

•   setSessionTimeOut(10 * 60);

•   setPageCacheSize(5);

•   setPermanentPageCacheSize(5);
WOComponents
•   Stateless components are harder to write but lowers memory
    usage

•   Manual binding synchronization requires more code but less
    processing

•   Return context().page() instead of null

•   Lazy creation defers processing and memory usage until needed
        public String someValue() {
            if (someValue == null) {
                // Create someValue here
            }
            return someValue;
        }
Java
•   new Integer(8) Integer.valueOf(8)

•   StringBuffer   StringBuilder

•   Null references when not needed

•   Heap Size
        -Xms256m -Xmx512m

•   Google for advanced heap size tuning articles
Using the Snapshot Cache
•   Rows for fetches objects stored in EODatabase as snapshots

•   Snapshots have a Global ID, retain count, and fetch timestamp

•   Using the row snapshots is fast

    •   following relationships

    •   objectForGlobalID, faultForGlobalID

•   Consider object freshness needs

•   Fetch Specs go to database

•   Raw rows go to database
EOSharedEditingContext
     ERXEnterpriseObjectCache
•   Both address “read mostly” frequent access data

•   Both prevent snapshots from being discarded

•   EOSharedEditingContext requires few changes

•   ... but may introduce bugs. Maybe.

•   ERXEnterpriseObjectCache requires more work

•   Key based object access (or global ID)

•   ... but you have the source and it is commonly used

•   EOModel “Cache in Memory” never refreshes
ERXEnterpriseObjectCache Usage
ERXEnterpriseObjectCache cache = new ERXEnterpriseObjectCache(
    entityName, keyPath, restrictingQualifier, timeout,
    shouldRetainObjects, shouldFetchInitialValues,
    shouldReturnUnsavedObjects);

ERXEnterpriseObjectCache cache = new ERXEnterpriseObjectCache(
    “BranchOffice”, branchCode, null, 0, true, true, true);

public static BranchOffice branchWithCode(EOEditingContext ec, Long id){
    return (BranchOffice)officeCache().objectForKey(ec, id);
}

BranchOffice montrealBranch = BranchOffice.branchWithCode(ec, “MTL”);
Mass Updates
•   Sometimes EOF is not the best solution

•   e.g. bulk deletions will fetch all of the EOs first

•   ERXEOAccessUtilities

    •   deleteRowsDescribedByQualifier()

    •   updateRowsDescribedByQualifier()

    •   insertRows()

•   ERXEOAccessUtilities.evaluateSQLWithEntityNamed
Using Custom SQL

•   Sometimes there is no other way

•   Easier than writing a custom EOQualifier

•   EOUtilities

•   ERXEOAccessUtilities
ERXBatchingDisplayGroup
•   Drop-in replacement for WODisplayGroup

•   Alternative to limiting data set size

•   Fetches one batch of EOs at a time

•   Low memory and fetch overhead

•   Still fetches all Primary Keys

•   Kieran’s LIMIT option

•   ERXBatchNavigationBar

•   AjaxGrid and AjaxGridNavBar
Batch Faulting (Fetching)
•   Optimistically faults in objects

•   Set in EOModel

•   Entity or Relationship

•   How big should a batch be?

•   Two is twice as good as none

•   10 - 20 is a good guess
Prefetch Relationships
•   Extension/alternative to batch faulting

•   Fetches everything at once

•   Allow for more precise tuning that Batch Faulting

•   Only useful if you need all / most of the objects

•   EOFetchSpecification.setPrefetchingRelationshipKeyPaths()

•   Can only follow class property relationship from root

•   One fetch per relationship key path with migrated qualifier

•   Not optimal if most of objects are in snapshot cache
ERXBatchFetchUtilities

•   Alternative to pre-fetching and batch faulting

•   Very focused batching of fetches

•   Efficiently batch fetch arbitrarily deep key paths

•   batchFetch(NSArray sourceObjects, NSArray keypaths)

•   One Gazillion options to control fetch
When to use Raw Rows
•   Data ONLY, no logic, no methods, no code, no anything

•   NSDictionary of key/value pairs

•   Use with a lot of data from which you only need a few EOs

•   EOFetchSpecification, EOUtilities, ERXEOAccessUtilities

•   Late promotion with:

     •   EOUtilities.objectFromRawRow(ec, entityName, row)

     •   ERXEOControlUtilities.
            faultsForRawRowsFromEntity(ec, rows, entityName)
EOFetchSpecification Limit
•   setFetchLimit(int limit)

•   This may not do what you expect

•   The standard is to fetch ALL rows and limit in memory

•   prefetchingRelationshipKeyPaths do not respect LIMIT

•   Check the SQL!

•   Wonder fixes SOME databases to LIMIT at database

•   YOU can fix the rest! Contribute to Wonder!

•   ERXEOControlUtilities.objectsInRange(ec, spec, start, end, raw)
Don‘t Model It! Just Say NO!
•   Avoid unnecessary relationships

•   Can Model It != Should Model It

•   Relationships from look-up tables to data

•   Address TO Country       Country TO Address

•   EOF will fault in ALL of the data rows,VERY slow

•   Do. Not. Do. This.

•   Fetch the data IF you ever need it
Factor out large CLOBs
•   Simple and easy to avoid

•   Fetching large CLOBs (or BLOBs) consumes resources

•   Move LOB values to their own EO

•   CLOB EO is to-one and Owns destination

•   object.clobValue()         object.clob().value()

•   large values are fetched only on demand
Model Optimization

•   Trim the fat

•   Map multiple Entities to same table (read-only, careful!)

•   Reduce number of attributes locked

•   De-normalize (views, flattening)

•   Keep complex data structures in LOBS

•   Stored Procedures
Inheritance and Optimization
•   Inheritance can be very useful

•   Inheritance can be very slow

•   Keep hierarchies flat

•   Avoid concrete super classes

•   Single Table inheritance is the most efficient

•   Vertical inheritance is the least efficient
Monitor the SQL
•   easiest, cheapest, highest payback performance tuning

•   -EOAdaptorDebugEnabled true

•   Watch for:

    •   repeated single row selects

    •   slow queries (more data makes more obvious)

•   Check for:

    •   indexes for common query terms
ERXAdaptorChannelDelegate
SQLLoggingAdaptorChannelDelegate
• Tracks and logs the SQL that gets sent to the database
• ERXAdaptorChannelDelegate
  • thresholds for logging levels
  • filter by Entity (regex)
• SQLLoggingAdaptorChannelDelegate
  • CSV formatted log message output for Excel analysis
  • can log data fetched
  • can log stack trace of fetch origin
ERChangeNotificationJMS

•   Synchronizes EOs and snapshots between application instances

•   Can reduce fetching

•   Can reduce need to fetch fresh data

•   Will reduce save conflicts
Join Table Indexes

•   Join tables only get one index

•   Some EOF generated SQL can’t be optimized

•   Results in table scan

•   Manually add complementary index
Database Tuning

•   Check the plan, Stan

•   Cache, cache, cache

•   RAM, RAM, RAM

•   Check hit ratio and tune cache size
SURVs Optimization
Counters and Concurrency
•   Situation: you need to count records according to some
    criteria

•   Problems:
    • counting with a query is too slow
    • so, create a counters row and update it in real time for new/
      updated data
    • thousands of users creating thousands of events on a short
      time
    • huge resource contention for the counter, lots of retries
Solution
•   Solution: create several sub-counters!




•   Counter identifier is one or more columns with whatever you
    need to identify your counter (FK to other tables, whatever).

•   SubCounter Number is a number identifying one sub counter for
    the counter identifier
How Does it Work?
•   Define a maximum number of sub counters

•   When reading, simply select all counters for your identifier, and
    obtain the sum of the value column.

•   To update, SubCounter is random number 0 ... max counters - 1

•   That’s it.You just reduced the probability of having OL failure and
    repeating by a factor of 10
MONTREAL JUNE 30, JULY 1ST AND 2ND 2012




Q&A
WebObjects Optimization: EOF and Beyond

Chuck Hill
Global Village Consulting
Ad

More Related Content

What's hot (20)

Deployment of WebObjects applications on FreeBSD
Deployment of WebObjects applications on FreeBSDDeployment of WebObjects applications on FreeBSD
Deployment of WebObjects applications on FreeBSD
WO Community
 
Test driving Azure Search and DocumentDB
Test driving Azure Search and DocumentDBTest driving Azure Search and DocumentDB
Test driving Azure Search and DocumentDB
Andrew Siemer
 
D2W Stateful Controllers
D2W Stateful ControllersD2W Stateful Controllers
D2W Stateful Controllers
WO Community
 
Hibernate performance tuning
Hibernate performance tuningHibernate performance tuning
Hibernate performance tuning
Sander Mak (@Sander_Mak)
 
Hibernate ORM: Tips, Tricks, and Performance Techniques
Hibernate ORM: Tips, Tricks, and Performance TechniquesHibernate ORM: Tips, Tricks, and Performance Techniques
Hibernate ORM: Tips, Tricks, and Performance Techniques
Brett Meyer
 
Alfresco Content Modelling and Policy Behaviours
Alfresco Content Modelling and Policy BehavioursAlfresco Content Modelling and Policy Behaviours
Alfresco Content Modelling and Policy Behaviours
J V
 
Hibernate Tips ‘n’ Tricks - 15 Tips to solve common problems
Hibernate Tips ‘n’ Tricks - 15 Tips to solve common problemsHibernate Tips ‘n’ Tricks - 15 Tips to solve common problems
Hibernate Tips ‘n’ Tricks - 15 Tips to solve common problems
Thorben Janssen
 
BeJUG JAX-RS Event
BeJUG JAX-RS EventBeJUG JAX-RS Event
BeJUG JAX-RS Event
Stephan Janssen
 
ORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate OverviewORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate Overview
Brett Meyer
 
No Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with BootiqueNo Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with Bootique
Andrus Adamchik
 
NoSQL into E-Commerce: lessons learned
NoSQL into E-Commerce: lessons learnedNoSQL into E-Commerce: lessons learned
NoSQL into E-Commerce: lessons learned
La FeWeb
 
Gradle - Build System
Gradle - Build SystemGradle - Build System
Gradle - Build System
Jeevesh Pandey
 
CDI 2.0 Deep Dive
CDI 2.0 Deep DiveCDI 2.0 Deep Dive
CDI 2.0 Deep Dive
Thorben Janssen
 
05 integrate redis
05 integrate redis05 integrate redis
05 integrate redis
Erhwen Kuo
 
High Performance Rails with MySQL
High Performance Rails with MySQLHigh Performance Rails with MySQL
High Performance Rails with MySQL
Jervin Real
 
Xml http request
Xml http requestXml http request
Xml http request
Jayalakshmi Ayyappan
 
Ajax
AjaxAjax
Ajax
gauravashq
 
Even faster django
Even faster djangoEven faster django
Even faster django
Gage Tseng
 
Advance Java Training in Bangalore | Best Java Training Institute
Advance Java Training in Bangalore | Best Java Training Institute Advance Java Training in Bangalore | Best Java Training Institute
Advance Java Training in Bangalore | Best Java Training Institute
TIB Academy
 
Atlanta JUG - Integrating Spring Batch and Spring Integration
Atlanta JUG - Integrating Spring Batch and Spring IntegrationAtlanta JUG - Integrating Spring Batch and Spring Integration
Atlanta JUG - Integrating Spring Batch and Spring Integration
Gunnar Hillert
 
Deployment of WebObjects applications on FreeBSD
Deployment of WebObjects applications on FreeBSDDeployment of WebObjects applications on FreeBSD
Deployment of WebObjects applications on FreeBSD
WO Community
 
Test driving Azure Search and DocumentDB
Test driving Azure Search and DocumentDBTest driving Azure Search and DocumentDB
Test driving Azure Search and DocumentDB
Andrew Siemer
 
D2W Stateful Controllers
D2W Stateful ControllersD2W Stateful Controllers
D2W Stateful Controllers
WO Community
 
Hibernate ORM: Tips, Tricks, and Performance Techniques
Hibernate ORM: Tips, Tricks, and Performance TechniquesHibernate ORM: Tips, Tricks, and Performance Techniques
Hibernate ORM: Tips, Tricks, and Performance Techniques
Brett Meyer
 
Alfresco Content Modelling and Policy Behaviours
Alfresco Content Modelling and Policy BehavioursAlfresco Content Modelling and Policy Behaviours
Alfresco Content Modelling and Policy Behaviours
J V
 
Hibernate Tips ‘n’ Tricks - 15 Tips to solve common problems
Hibernate Tips ‘n’ Tricks - 15 Tips to solve common problemsHibernate Tips ‘n’ Tricks - 15 Tips to solve common problems
Hibernate Tips ‘n’ Tricks - 15 Tips to solve common problems
Thorben Janssen
 
ORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate OverviewORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate Overview
Brett Meyer
 
No Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with BootiqueNo Container: a Modern Java Stack with Bootique
No Container: a Modern Java Stack with Bootique
Andrus Adamchik
 
NoSQL into E-Commerce: lessons learned
NoSQL into E-Commerce: lessons learnedNoSQL into E-Commerce: lessons learned
NoSQL into E-Commerce: lessons learned
La FeWeb
 
05 integrate redis
05 integrate redis05 integrate redis
05 integrate redis
Erhwen Kuo
 
High Performance Rails with MySQL
High Performance Rails with MySQLHigh Performance Rails with MySQL
High Performance Rails with MySQL
Jervin Real
 
Even faster django
Even faster djangoEven faster django
Even faster django
Gage Tseng
 
Advance Java Training in Bangalore | Best Java Training Institute
Advance Java Training in Bangalore | Best Java Training Institute Advance Java Training in Bangalore | Best Java Training Institute
Advance Java Training in Bangalore | Best Java Training Institute
TIB Academy
 
Atlanta JUG - Integrating Spring Batch and Spring Integration
Atlanta JUG - Integrating Spring Batch and Spring IntegrationAtlanta JUG - Integrating Spring Batch and Spring Integration
Atlanta JUG - Integrating Spring Batch and Spring Integration
Gunnar Hillert
 

Similar to WebObjects Optimization (20)

Dev nexus 2017
Dev nexus 2017Dev nexus 2017
Dev nexus 2017
Roy Russo
 
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
DATAVERSITY
 
Multi-tier-performance-analysis-of-ADF-applications.pptx
Multi-tier-performance-analysis-of-ADF-applications.pptxMulti-tier-performance-analysis-of-ADF-applications.pptx
Multi-tier-performance-analysis-of-ADF-applications.pptx
Kuncoro21
 
DOTNET8.pptx
DOTNET8.pptxDOTNET8.pptx
DOTNET8.pptx
Udaiappa Ramachandran
 
SeaJUG May 2012 mybatis
SeaJUG May 2012 mybatisSeaJUG May 2012 mybatis
SeaJUG May 2012 mybatis
Will Iverson
 
OracleStore: A Highly Performant RawStore Implementation for Hive Metastore
OracleStore: A Highly Performant RawStore Implementation for Hive MetastoreOracleStore: A Highly Performant RawStore Implementation for Hive Metastore
OracleStore: A Highly Performant RawStore Implementation for Hive Metastore
DataWorks Summit
 
Why ruby and rails
Why ruby and railsWhy ruby and rails
Why ruby and rails
Reuven Lerner
 
Store
StoreStore
Store
ESUG
 
How does Apache Pegasus (incubating) community develop at SensorsData
How does Apache Pegasus (incubating) community develop at SensorsDataHow does Apache Pegasus (incubating) community develop at SensorsData
How does Apache Pegasus (incubating) community develop at SensorsData
acelyc1112009
 
Facebook Presto presentation
Facebook Presto presentationFacebook Presto presentation
Facebook Presto presentation
Cyanny LIANG
 
Revision
RevisionRevision
Revision
David Sherlock
 
OrigoDB - take the red pill
OrigoDB - take the red pillOrigoDB - take the red pill
OrigoDB - take the red pill
Robert Friberg
 
Where to save my data, for devs!
Where to save my data, for devs!Where to save my data, for devs!
Where to save my data, for devs!
SharePoint Saturday New Jersey
 
Data Modeling for NoSQL
Data Modeling for NoSQLData Modeling for NoSQL
Data Modeling for NoSQL
Tony Tam
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your Website
Acquia
 
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
Malin Weiss
 
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
Speedment, Inc.
 
ORM Pink Unicorns
ORM Pink UnicornsORM Pink Unicorns
ORM Pink Unicorns
Ortus Solutions, Corp
 
hibernateormfeatures-140223193044-phpapp02.pdf
hibernateormfeatures-140223193044-phpapp02.pdfhibernateormfeatures-140223193044-phpapp02.pdf
hibernateormfeatures-140223193044-phpapp02.pdf
Patiento Del Mar
 
Caching your rails application
Caching your rails applicationCaching your rails application
Caching your rails application
ArrrrCamp
 
Dev nexus 2017
Dev nexus 2017Dev nexus 2017
Dev nexus 2017
Roy Russo
 
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
DATAVERSITY
 
Multi-tier-performance-analysis-of-ADF-applications.pptx
Multi-tier-performance-analysis-of-ADF-applications.pptxMulti-tier-performance-analysis-of-ADF-applications.pptx
Multi-tier-performance-analysis-of-ADF-applications.pptx
Kuncoro21
 
SeaJUG May 2012 mybatis
SeaJUG May 2012 mybatisSeaJUG May 2012 mybatis
SeaJUG May 2012 mybatis
Will Iverson
 
OracleStore: A Highly Performant RawStore Implementation for Hive Metastore
OracleStore: A Highly Performant RawStore Implementation for Hive MetastoreOracleStore: A Highly Performant RawStore Implementation for Hive Metastore
OracleStore: A Highly Performant RawStore Implementation for Hive Metastore
DataWorks Summit
 
Store
StoreStore
Store
ESUG
 
How does Apache Pegasus (incubating) community develop at SensorsData
How does Apache Pegasus (incubating) community develop at SensorsDataHow does Apache Pegasus (incubating) community develop at SensorsData
How does Apache Pegasus (incubating) community develop at SensorsData
acelyc1112009
 
Facebook Presto presentation
Facebook Presto presentationFacebook Presto presentation
Facebook Presto presentation
Cyanny LIANG
 
OrigoDB - take the red pill
OrigoDB - take the red pillOrigoDB - take the red pill
OrigoDB - take the red pill
Robert Friberg
 
Data Modeling for NoSQL
Data Modeling for NoSQLData Modeling for NoSQL
Data Modeling for NoSQL
Tony Tam
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your Website
Acquia
 
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
Malin Weiss
 
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
Speedment, Inc.
 
hibernateormfeatures-140223193044-phpapp02.pdf
hibernateormfeatures-140223193044-phpapp02.pdfhibernateormfeatures-140223193044-phpapp02.pdf
hibernateormfeatures-140223193044-phpapp02.pdf
Patiento Del Mar
 
Caching your rails application
Caching your rails applicationCaching your rails application
Caching your rails application
ArrrrCamp
 
Ad

More from WO Community (20)

KAAccessControl
KAAccessControlKAAccessControl
KAAccessControl
WO Community
 
In memory OLAP engine
In memory OLAP engineIn memory OLAP engine
In memory OLAP engine
WO Community
 
Using Nagios to monitor your WO systems
Using Nagios to monitor your WO systemsUsing Nagios to monitor your WO systems
Using Nagios to monitor your WO systems
WO Community
 
Build and deployment
Build and deploymentBuild and deployment
Build and deployment
WO Community
 
High availability
High availabilityHigh availability
High availability
WO Community
 
Reenabling SOAP using ERJaxWS
Reenabling SOAP using ERJaxWSReenabling SOAP using ERJaxWS
Reenabling SOAP using ERJaxWS
WO Community
 
Chaining the Beast - Testing Wonder Applications in the Real World
Chaining the Beast - Testing Wonder Applications in the Real WorldChaining the Beast - Testing Wonder Applications in the Real World
Chaining the Beast - Testing Wonder Applications in the Real World
WO Community
 
Deploying WO on Windows
Deploying WO on WindowsDeploying WO on Windows
Deploying WO on Windows
WO Community
 
Unit Testing with WOUnit
Unit Testing with WOUnitUnit Testing with WOUnit
Unit Testing with WOUnit
WO Community
 
Life outside WO
Life outside WOLife outside WO
Life outside WO
WO Community
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO Devs
WO Community
 
Advanced Apache Cayenne
Advanced Apache CayenneAdvanced Apache Cayenne
Advanced Apache Cayenne
WO Community
 
Migrating existing Projects to Wonder
Migrating existing Projects to WonderMigrating existing Projects to Wonder
Migrating existing Projects to Wonder
WO Community
 
iOS for ERREST - alternative version
iOS for ERREST - alternative versioniOS for ERREST - alternative version
iOS for ERREST - alternative version
WO Community
 
iOS for ERREST
iOS for ERRESTiOS for ERREST
iOS for ERREST
WO Community
 
"Framework Principal" pattern
"Framework Principal" pattern"Framework Principal" pattern
"Framework Principal" pattern
WO Community
 
Filtering data with D2W
Filtering data with D2W Filtering data with D2W
Filtering data with D2W
WO Community
 
WOver
WOverWOver
WOver
WO Community
 
Localizing your apps for multibyte languages
Localizing your apps for multibyte languagesLocalizing your apps for multibyte languages
Localizing your apps for multibyte languages
WO Community
 
WOdka
WOdkaWOdka
WOdka
WO Community
 
In memory OLAP engine
In memory OLAP engineIn memory OLAP engine
In memory OLAP engine
WO Community
 
Using Nagios to monitor your WO systems
Using Nagios to monitor your WO systemsUsing Nagios to monitor your WO systems
Using Nagios to monitor your WO systems
WO Community
 
Build and deployment
Build and deploymentBuild and deployment
Build and deployment
WO Community
 
Reenabling SOAP using ERJaxWS
Reenabling SOAP using ERJaxWSReenabling SOAP using ERJaxWS
Reenabling SOAP using ERJaxWS
WO Community
 
Chaining the Beast - Testing Wonder Applications in the Real World
Chaining the Beast - Testing Wonder Applications in the Real WorldChaining the Beast - Testing Wonder Applications in the Real World
Chaining the Beast - Testing Wonder Applications in the Real World
WO Community
 
Deploying WO on Windows
Deploying WO on WindowsDeploying WO on Windows
Deploying WO on Windows
WO Community
 
Unit Testing with WOUnit
Unit Testing with WOUnitUnit Testing with WOUnit
Unit Testing with WOUnit
WO Community
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO Devs
WO Community
 
Advanced Apache Cayenne
Advanced Apache CayenneAdvanced Apache Cayenne
Advanced Apache Cayenne
WO Community
 
Migrating existing Projects to Wonder
Migrating existing Projects to WonderMigrating existing Projects to Wonder
Migrating existing Projects to Wonder
WO Community
 
iOS for ERREST - alternative version
iOS for ERREST - alternative versioniOS for ERREST - alternative version
iOS for ERREST - alternative version
WO Community
 
"Framework Principal" pattern
"Framework Principal" pattern"Framework Principal" pattern
"Framework Principal" pattern
WO Community
 
Filtering data with D2W
Filtering data with D2W Filtering data with D2W
Filtering data with D2W
WO Community
 
Localizing your apps for multibyte languages
Localizing your apps for multibyte languagesLocalizing your apps for multibyte languages
Localizing your apps for multibyte languages
WO Community
 
Ad

Recently uploaded (20)

AI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamsonAI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamson
UXPA Boston
 
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier VroomAI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
UXPA Boston
 
AsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API DesignAsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API Design
leonid54
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptxTop 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
mkubeusa
 
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient CareAn Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
Cyntexa
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
IT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information TechnologyIT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information Technology
SHEHABALYAMANI
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
João Esperancinha
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Cyntexa
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
AI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamsonAI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamson
UXPA Boston
 
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier VroomAI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
UXPA Boston
 
AsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API DesignAsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API Design
leonid54
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptxTop 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
mkubeusa
 
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient CareAn Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
Cyntexa
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
IT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information TechnologyIT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information Technology
SHEHABALYAMANI
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
João Esperancinha
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Cyntexa
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 

WebObjects Optimization

  • 1. MONTREAL JUNE 30, JULY 1ST AND 2ND 2012 WebObjects Optimization: EOF and Beyond Chuck Hill,VP Development Global Village Consulting, Inc. Ranked 76th in 24th annual PROFIT 200 ranking of  Canada’s Fastest-Growing Companies by PROFIT Magazine! WOWODC 2012
  • 2. Session Overview • Outline: • Follow the architecture • Three kinds of optimization: • low effort, high effort, application specific • Most is pretty easy
  • 3. A WOrd of Advice • Be Productive: Measure, don’t Guess • Seek High ROI (Return On Investment) • Premature Optimization
  • 4. Performance Measuring • Use realistic set of data • Beware the first request! • jperf, jmeter, shark, range of options • Simple as NSTimestamp and logging • Wonder has functionality too • WOEvent and EOEvent can be used also
  • 5. ERProfiling and Heat Map • From Mike Schrag and Apple • Understand how your app is functioning • Understand why it's slow • Designed around WebObjects • Page-based approach to profiling • Look at the statistics for individual pages and actions
  • 6. End to End WO Adaptor Relational Database Client Web Server App Instances
  • 7. Browser Considerations • gzip compression • er.extensions.ERXApplication.responseCompressionEnabled=true • Minify js • Combine CSS • Combine images • Minify HTML and CSS
  • 8. WebServer Side • mod_gzip • mod_deflate • mod_expires <IfModule mod_expires.c> ExpiresActive On ExpiresDefault A60 ExpiresByType application/javascript A3600 ExpiresByType text/css A3600 ExpiresByType text/html A1
  • 9. Apache Tuning • MinSpareServers 10 • KeepAliveTimeout 15 • MaxSpareServers 20 • ServerLimit 2048 • MaxRequestsPerChild 10000 • ListenBackLog 511 • Timeout 45 • MaxClients 128 • MaxKeepAliveRequests 50000
  • 10. WO Adaptor Settings • FastCGI in Wonder • Keep worker threads and listen queue size low • Only default (Round Robin) load balancing works(?) • Interleave instances across servers
  • 11. Application and Session • setAllowsConcurrentRequestHandling(true); • setCachingEnabled(true); • -WODebuggingEnabled=false • setSessionTimeOut(10 * 60); • setPageCacheSize(5); • setPermanentPageCacheSize(5);
  • 12. WOComponents • Stateless components are harder to write but lowers memory usage • Manual binding synchronization requires more code but less processing • Return context().page() instead of null • Lazy creation defers processing and memory usage until needed public String someValue() { if (someValue == null) { // Create someValue here } return someValue; }
  • 13. Java • new Integer(8) Integer.valueOf(8) • StringBuffer StringBuilder • Null references when not needed • Heap Size -Xms256m -Xmx512m • Google for advanced heap size tuning articles
  • 14. Using the Snapshot Cache • Rows for fetches objects stored in EODatabase as snapshots • Snapshots have a Global ID, retain count, and fetch timestamp • Using the row snapshots is fast • following relationships • objectForGlobalID, faultForGlobalID • Consider object freshness needs • Fetch Specs go to database • Raw rows go to database
  • 15. EOSharedEditingContext ERXEnterpriseObjectCache • Both address “read mostly” frequent access data • Both prevent snapshots from being discarded • EOSharedEditingContext requires few changes • ... but may introduce bugs. Maybe. • ERXEnterpriseObjectCache requires more work • Key based object access (or global ID) • ... but you have the source and it is commonly used • EOModel “Cache in Memory” never refreshes
  • 16. ERXEnterpriseObjectCache Usage ERXEnterpriseObjectCache cache = new ERXEnterpriseObjectCache( entityName, keyPath, restrictingQualifier, timeout, shouldRetainObjects, shouldFetchInitialValues, shouldReturnUnsavedObjects); ERXEnterpriseObjectCache cache = new ERXEnterpriseObjectCache( “BranchOffice”, branchCode, null, 0, true, true, true); public static BranchOffice branchWithCode(EOEditingContext ec, Long id){ return (BranchOffice)officeCache().objectForKey(ec, id); } BranchOffice montrealBranch = BranchOffice.branchWithCode(ec, “MTL”);
  • 17. Mass Updates • Sometimes EOF is not the best solution • e.g. bulk deletions will fetch all of the EOs first • ERXEOAccessUtilities • deleteRowsDescribedByQualifier() • updateRowsDescribedByQualifier() • insertRows() • ERXEOAccessUtilities.evaluateSQLWithEntityNamed
  • 18. Using Custom SQL • Sometimes there is no other way • Easier than writing a custom EOQualifier • EOUtilities • ERXEOAccessUtilities
  • 19. ERXBatchingDisplayGroup • Drop-in replacement for WODisplayGroup • Alternative to limiting data set size • Fetches one batch of EOs at a time • Low memory and fetch overhead • Still fetches all Primary Keys • Kieran’s LIMIT option • ERXBatchNavigationBar • AjaxGrid and AjaxGridNavBar
  • 20. Batch Faulting (Fetching) • Optimistically faults in objects • Set in EOModel • Entity or Relationship • How big should a batch be? • Two is twice as good as none • 10 - 20 is a good guess
  • 21. Prefetch Relationships • Extension/alternative to batch faulting • Fetches everything at once • Allow for more precise tuning that Batch Faulting • Only useful if you need all / most of the objects • EOFetchSpecification.setPrefetchingRelationshipKeyPaths() • Can only follow class property relationship from root • One fetch per relationship key path with migrated qualifier • Not optimal if most of objects are in snapshot cache
  • 22. ERXBatchFetchUtilities • Alternative to pre-fetching and batch faulting • Very focused batching of fetches • Efficiently batch fetch arbitrarily deep key paths • batchFetch(NSArray sourceObjects, NSArray keypaths) • One Gazillion options to control fetch
  • 23. When to use Raw Rows • Data ONLY, no logic, no methods, no code, no anything • NSDictionary of key/value pairs • Use with a lot of data from which you only need a few EOs • EOFetchSpecification, EOUtilities, ERXEOAccessUtilities • Late promotion with: • EOUtilities.objectFromRawRow(ec, entityName, row) • ERXEOControlUtilities. faultsForRawRowsFromEntity(ec, rows, entityName)
  • 24. EOFetchSpecification Limit • setFetchLimit(int limit) • This may not do what you expect • The standard is to fetch ALL rows and limit in memory • prefetchingRelationshipKeyPaths do not respect LIMIT • Check the SQL! • Wonder fixes SOME databases to LIMIT at database • YOU can fix the rest! Contribute to Wonder! • ERXEOControlUtilities.objectsInRange(ec, spec, start, end, raw)
  • 25. Don‘t Model It! Just Say NO! • Avoid unnecessary relationships • Can Model It != Should Model It • Relationships from look-up tables to data • Address TO Country Country TO Address • EOF will fault in ALL of the data rows,VERY slow • Do. Not. Do. This. • Fetch the data IF you ever need it
  • 26. Factor out large CLOBs • Simple and easy to avoid • Fetching large CLOBs (or BLOBs) consumes resources • Move LOB values to their own EO • CLOB EO is to-one and Owns destination • object.clobValue() object.clob().value() • large values are fetched only on demand
  • 27. Model Optimization • Trim the fat • Map multiple Entities to same table (read-only, careful!) • Reduce number of attributes locked • De-normalize (views, flattening) • Keep complex data structures in LOBS • Stored Procedures
  • 28. Inheritance and Optimization • Inheritance can be very useful • Inheritance can be very slow • Keep hierarchies flat • Avoid concrete super classes • Single Table inheritance is the most efficient • Vertical inheritance is the least efficient
  • 29. Monitor the SQL • easiest, cheapest, highest payback performance tuning • -EOAdaptorDebugEnabled true • Watch for: • repeated single row selects • slow queries (more data makes more obvious) • Check for: • indexes for common query terms
  • 30. ERXAdaptorChannelDelegate SQLLoggingAdaptorChannelDelegate • Tracks and logs the SQL that gets sent to the database • ERXAdaptorChannelDelegate • thresholds for logging levels • filter by Entity (regex) • SQLLoggingAdaptorChannelDelegate • CSV formatted log message output for Excel analysis • can log data fetched • can log stack trace of fetch origin
  • 31. ERChangeNotificationJMS • Synchronizes EOs and snapshots between application instances • Can reduce fetching • Can reduce need to fetch fresh data • Will reduce save conflicts
  • 32. Join Table Indexes • Join tables only get one index • Some EOF generated SQL can’t be optimized • Results in table scan • Manually add complementary index
  • 33. Database Tuning • Check the plan, Stan • Cache, cache, cache • RAM, RAM, RAM • Check hit ratio and tune cache size
  • 35. Counters and Concurrency • Situation: you need to count records according to some criteria • Problems: • counting with a query is too slow • so, create a counters row and update it in real time for new/ updated data • thousands of users creating thousands of events on a short time • huge resource contention for the counter, lots of retries
  • 36. Solution • Solution: create several sub-counters! • Counter identifier is one or more columns with whatever you need to identify your counter (FK to other tables, whatever). • SubCounter Number is a number identifying one sub counter for the counter identifier
  • 37. How Does it Work? • Define a maximum number of sub counters • When reading, simply select all counters for your identifier, and obtain the sum of the value column. • To update, SubCounter is random number 0 ... max counters - 1 • That’s it.You just reduced the probability of having OL failure and repeating by a factor of 10
  • 38. MONTREAL JUNE 30, JULY 1ST AND 2ND 2012 Q&A WebObjects Optimization: EOF and Beyond Chuck Hill Global Village Consulting
  翻译: