SlideShare a Scribd company logo
IBM ConnectED 2015 - MAS103 XPages Performance and Scalability
Click to edit Master subtitle style
MAS103: XPages
Performance and Scalability
Tony McGuckin, IBM
Paul Withers, Intec
3
This session draws upon material taken from
the Mastering XPages, Second Edition book
from IBM Press.
Where applicable the presenters will suggest
further reading available from this book about
topics in this session.
It is available to order from Amazon.com and
all good bookshops!
Reference material...
Tony McGuckin
Senior Software Engineer / Technical Lead, IBM
XPages Core Runtime
XPages Bluemix Buildpack / Runtime
Author Mastering XPages (1st
and 2nd
Editions) and
XPages Portable Command Guide books
OpenNTF Contributor
Paul Withers
XPages Developer since 2009
IBM Champion
OpenNTF Board Member
Author of XPages Extension Library
Developer XPages OpenLog Logger
Co-Developer of OpenNTF Domino API
Coding for
Performance
Architect for Performance
Avoid large pages
“Reports” of large numbers of documents
Multiple on-the-fly dashboards
Data pulled from large variety of sources
Less server-side processing, less HTML to push down network
Design for the web not for printing!
Understand performance of code
You’ve been using Agent Profiling, right?
μηδέν άγαν
Don’t over-complicate a small, simple page!
Cache for Performance
Cache data in application / session / view / request scopes as appropriate
XSnippet for caching header resources (SSJS / Java) http://openntf.org/XSnippets.nsf/snippet.xsp?
id=set-cache-headers-on-an-xpage
XSnippet for Keyword caching bean (Java) http://openntf.org/XSnippets.nsf/snippet.xsp?id=keyword-
caching-bean
XSnippet for refreshing individual scoped variables (Java) http://openntf.org/XSnippets.nsf/snippet.xsp?
id=refresh-applicationscope-variables-with-individual-timeout
Add code to keyword / config document save to update scopes
Languages for Performance
Hierarchy of Languages
Literal content > Expression Language > SSJS
SSJS is stored as string, parsed and evaluated at runtime
“Custom” allows combining all three in one component’s value
Less HTML emitted
Not picked up by in-built localization
Some SSJS code can be converted to Expression Language
E.g. #{database.title} instead of #{javascript:database.getTitle()}
Java?
#{myBean.myProperty} = Expression Language
#{javascript:myBean.runMyMethod()} = SSJS, but just one line
Compute for Performance
Compute On Page Load where possible
${javascript:session.getEffectiveUserName()} because it cannot change during page’s life
Lazy Load
Easier with Java Beans
Can be triggered from Expression Language
Possible with SSJS
Compute using view.isRenderingPhase() where appropriate
Code will only calculate once during partial refresh
Good for properties only affecting HTML output – rendered, style, styleClass, value property of Computed
Field components
Load for Performance
Use dataContexts for duplicate properties, especially “rendered”
E.g. #{userIsAdmin} (Expression Language) pointing to dataContext computing on page load whether
user has admin role
dataContexts set to compute dynamically refresh a number of times
If bound to panels, get cleaned up during Invoke Application phase http://avatar.red-pill.mobi/tim/blog.nsf/
d6plinks/TTRY-9CD3JN
Use if (view.isRenderingPhase()) to avoid errors and only run during Render Response
Use Dynamic Content control
Only the live “rendered” area is in the Component Tree
Scope for Performance
Scope data to the lowest scope
If used on one page only, viewScope
If used on multiple pages for one user, sessionScope
Scope data to smallest component
dataContexts allow variables to be “scoped” to XPages, Custom Controls or Panels
Same applies to dominoView / dominoData / dataObjects variables
Refresh for
Performance
Component Tree?!
Partial Refresh – Step 1: Submission
Browser → Server
In-built Partial Refresh
Full web page submitted
XSP.partialRefreshGet()
Nothing submitted
Server-side processing ignores any user action since last refresh
XSP.partialRefreshPost()
By default, full web page submitted
Can override with options {clearForm: true, additionalFields: [‘#{inputText1}’, ‘#{inputText2}’]}
Only send inputText1 and inputText2 content
Partial Refresh – Step 1: Submission
Combine optimised XSP.partialRefreshPost and in-built Partial Refresh
See XSnippet from Per Henrik Lausten extending work by Sven Hasselbach
http://openntf.org/XSnippets.nsf/snippet.xsp?id=optimized-partial-refresh-with-support-for-server-side-
actions
Partial Refresh – Step 2: Execution (High Level)
Server → Server
By default full component tree is processed
execMode=“partial” execId=“processId”
Only the component with that ID and all descendants are processed
User content outside that execId is ignored
Partial Refresh – Step 3: Refresh
Server → Browser
refreshMode=“partial” refreshId=“processId”
Only HTML for component with that ID and all descendants is passed to browser
XPages Lifecycle
Six Phases
Restore View
Component Tree retrieved
Apply Request Values
this.setSubmittedValue(stringFromBrowser) runs on all or execId
Any event logic runs if immediate=“true”
Process Validation
Any converters applied for all or execId
Any validators applied for all or execId
Six Phases
Update Model Values
this.setValue(this.setSubmittedValue()) runs on all or execId
this.setSubmittedValue(null) runs on all or execId
e.g. dominoDocument.replaceItemValue(this.getValue())
Invoke Application
Any event logic run
Render Response
HTML rendered and state saved
Only event that runs during page load
Debugging XPages Lifecycle
Always, always, ALWAYS include a Display Errors control in refresh area
Otherwise validation / conversion errors will not be displayed on browser
Doc Brown: “Marty, it’s perfect, you’re just not thinking fourth dimensionally”
When does server-side code run?
What HTML is passed to the browser?
Use DebugBean XSnippet to inspect phases
http://openntf.org/XSnippets.nsf/snippet.xsp?id=xrpl-isphase-api
XSP.partialRefreshGet()
No updates to component tree
beforeRestoreView
afterRestoreView
beforeRenderResponse
afterRenderResponse
Basic Partial Refresh
Validation fails
beforeRestoreView
afterRestoreView
beforeApplyRequestValues
afterApplyRequestValues
beforeProcessValidations
beforeRenderResponse
Event logic does not run
No Validation
Conversion still honoured
If failed, skips from ProcessValidations to RenderResponse
Event Logic not run
If no conversion errors, all phases run
Values passed from submittedValue to value
Component tree updated
Immediate=“true”
Same as basic XPage processing wiith validation failure
beforeRestoreView
afterRestoreView
beforeApplyRequestValues
afterApplyRequestValues
beforeRenderResponse
afterRenderResponse
Event logic run in ApplyRequestValues phase
Component value never goes past submittedValue
Data model not updated
Developing for
Performance
The “XPages Toolbox” → XPages based Application (The “XPages Swiss Army Knife”)
Runs on the Domino server or the Notes client
XPagesToolbox.nsf needs to be installed on the Domino server or XPiNC client
A profiler .jar file needs to be added to the JVM launch options & JVM java.policy updated
Should be used regularly during development / testing cycles to:
Profile CPU performance & Memory usage (per request or periodically) / Backend usage
Create Java Heap Dumps / XML Memory Dumps
Production use only for problem resolution - sensitive data collection capabilities
Available from OpenNTF.org
Free open source project / Search for “XPages Toolbox”
Full readme.pdf instructions within the project download files
Developing for Performance
The XPages Toolbox
Provides insight into custom SSJS code using Profile Blocks
__profile(“blockIdentifier”, “optionalInformation”){
// profile my custom code...
var nd:NotesDocument = document1.getDocument();
....
__profile(“blockIdentifier”, “optionalInformation”){
// profile my nested profile block...
var x = nd.getItemValueString(“x”);
....
}
}
Developing for Performance
Using the XPages Toolbox
Provides insight into custom Java code using Profile Block Decorator
private static final ProfilerType pt = new ProfilerType("MyBlock");
public void myMethod() {
if(Profiler.isEnabled()) {
ProfilerAggregator pa = Profiler.startProfileBlock(pt, null);
long startTime = Profiler.getCurrentTime();
try { _myMethod(); } finally {
Profiler.endProfileBlock(pa, startTime);
}
} else { _myMethod(); }
}
private void _myMethod() { // real implementation of myMethod … }
Developing for Performance
Using the XPages Toolbox
Profile Blocks in SSJS / Java are Non-Invasive and Supportive
Leave the custom Profile Blocks in your SSJS / Java Code
No negative performance impact on any application even if the XPages Toolbox is
not installed on a server or XPiNC client
Therefore supporting you for future profiling & maintenance tasks
Developing for Performance
Using the XPages Toolbox
Key elements:
Profile XPages Request using Wall and CPU Profilers...
Perform CPU and Wall time intensive tasks...
Analyze profiling results and identify issues in the
XPages Toolbox!
Developing for Performance
The XPages Toolbox
Persist for Scalability
Persistence Summary
HTTP is stateless, XPages is stateful by default
xsp.session.transient=true makes XPage stateless
For each browser session, for every XPage component trees need storing
xsp.persistence.tree.maxviews=4 – default number of trees stored in memory
xsp.persistence.file.maxviews=16 – default number of trees stored on disk
xsp.session.timeout=30 – default inactivity timeout for browser stateful session
(xsp.application.timeout=30 – default applicationScope timeout)
Recommendation: reduce timeout and use Keep Session Alive
Persistence Summary
xsp.persistence.mode=basic
Keep pages in memory: best for quick retrieval, few browser sessions
xsp.persistence.mode=file
Keep pages on disk: best for lots of browser sessions, slower retrieval
xsp.persistence.mode=fileex
Keep latest page in memory, rest on disk: best for lots of users, quick retrieval of latest page
Persistence Summary
xsp.persistence.file.gzip
Before storing to disk, gzip the content: smaller files, but slower to store / retrieve
xsp.persistence.dir.xspstate
Default folder for storing pages to disk
Similar options for default location for file uploads and attachments
Page Persistence
xsp.persistence.viewstate=fulltree
Default, whole tree is persisted and update
xsp.persistence.viewstate=delta
Only stores changes since page first loaded
Valid if pages are stored in memory
xsp.persistence.viewstate=deltaex
Stores full component tree for current page, deltas for others
Valid if pages are only stored in memory
Page Persistence
xsp.persistence.viewstate=nostate
No component tree is stored, similar to xsp.session.transient=true
Page persistence settings can be set on individual XPages
Great for large, readonly XPages with no paging, state not persisted
Go to next page from default, not go to next page from current
Toggle show detail from default, not toggle show detail from current
Unless showDetailsOnClient=true
Recommendation: set xsp.persistence.viewstate=nostate on XAgents
Developing for
Scalability
CPU, Wall Time, and Backend profiling gives insight into the vertical
processing costs for any given XPage request
But what about vertical and horizontal memory costs?
Requires analysis using JVM Heap Dumps
Requires analysis using JVM System Dumps
Requires analysis using XML Session Dumps
Developing for Scalability
Surface Zero - Analysing Memory Usage
Generate a JVM Heap or System Dump of the HTTP task JVM memory
A button in the XPages Toolbox generates a JVM Heap Dump
XSP Commands on the Domino Server console allow spontaneous Heap / System Dump creation
tell http xsp heapdump (triggers com.ibm.jvm.Dump.HeapDump())
tell http xsp systemdump (triggers com.ibm.jvm.Dump.SystemDump())
Analyze Heap / System Dumps using the Eclipse Memory Analyzer
http://www.eclipse.org/mat/
Also install Eclipse Extension: IBM Diagnostic Tool Framework for Java Version 1.1
http://www.ibm.com/developerworks/java/jdk/tools/dtfj.html
Heap Dumps automatically occur in production when certain conditions occur
Eg: By default when an XPage fails due to the server running out of JVM Memory
java.lang.OutOfMemoryError
Developing for Scalability
Analysing Memory Usage – JVM Heap & System Dumps
Generate XML Session Dumps of the HTTP task JVM memory
Two options available under the XPages Toolbox → Session Dumps Tab
Full XML Session Dump
Partial XML Session Dump
Analyze XML Session Dumps using any Browser/XML/Text Editor
Caution required on production systems as sensitive data is collected
within the XML Session Dump file
Developing for Scalability
Analysing Memory Usage – XML Session Dumps
Key elements:
Make XPages Requests...
Generate Heap/System/XML Session Dumps...
Analyze memory usage in each type of Dump format to
identify issues!
Developing for Scalability
Heap/System/XML Session Dumps
Developing for Scalability
Heap/System Dumps – OQL / Navigating XSP Objects Entry Point...
Developing for Scalability
Heap/System Dumps – OQL / Navigating XSP Objects Entry Point...
Developing for Scalability
Heap/System Dumps – OQL / Navigating XSP Objects Entry Point...
IBM ConnectED 2015 - MAS103 XPages Performance and Scalability
Other Great XPages Sessions On The Way
49
Technical Education
IBM Press Books and eBooks
Three best-selling publications
50
More Information – Summary
OpenNTF – Open Source Community
http://www.openntf.org
XPages.info – One Stop Shopping for XPages
http://xpages.info
XPages Forum – Got Questions, Need Answers?
http://xpages.info/forum
Domino Application Development Wiki
http://www.lotus.com/ldd/ddwiki.nsf
Stackoverflow
http://stackoverflow.com/questions/tagged/xpages
Engage Online
SocialBiz User Group: socialbizug.org
Join the epicenter of Notes and Collaboration user groups
Social Business Insights blog: ibm.com/blogs/socialbusiness
Read and engage with our bloggers
Follow us on Twitter
@IBMConnect and @IBMSocialBiz
LinkedIn: http://bit.ly/SBComm
Participate in the IBM Social Business group on LinkedIn
Facebook: https://www.facebook.com/IBMConnected
Like IBM Social Business on Facebook
Notices and Disclaimers
Copyright © 2015 by International Business Machines Corporation (IBM). No part of this document may be reproduced or transmitted in any form without written permission from IBM.
U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSAADP Schedule Contract with IBM.
Information in these presentations (including information relating to products that have not yet been announced by IBM) has been reviewed for accuracy as of the date of initial publication and could include unintentional
technical or typographical errors. IBM shall have no responsibility to update this information. THIS DOCUMENT IS DISTRIBUTED "AS IS" WITHOUT ANY WARRANTY, EITHER EXPRESS OR IMPLIED. IN NO EVENT
SHALL IBM BE LIABLE FOR ANY DAMAGEARISING FROM THE USE OF THIS INFORMATION, INCLUDING BUT NOT LIMITED TO, LOSS OF DATA, BUSINESS INTERRUPTION, LOSS OF PROFIT OR LOSS OF
OPPORTUNITY. IBM products and services are warranted according to the terms and conditions of the agreements under which they are provided.
Any statements regarding IBM's future direction, intent or product plans are subject to change or withdrawal without notice.
Performance data contained herein was generally obtained in a controlled, isolated environments. Customer examples are presented as illustrations of how those customers have used IBM products and the results
they may have achieved. Actual performance, cost, savings or other results in other operating environments may vary.
References in this document to IBM products, programs, or services does not imply that IBM intends to make such products, programs or services available in all countries in which IBM operates or does business.
Workshops, sessions and associated materials may have been prepared by independent session speakers, and do not necessarily reflect the views of IBM. All materials and discussions are provided for informational
purposes only, and are neither intended to, nor shall constitute legal or other guidance or advice to any individual participant or their specific situation.
It is the customer’s responsibility to insure its own compliance with legal requirements and to obtain advice of competent legal counsel as to the identification and interpretation of any relevant laws and regulatory
requirements that may affect the customer’s business and any actions the customer may need to take to comply with such laws. IBM does not provide legal advice or represent or warrant that its services or products
will ensure that the customer is in compliance with any law.
Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not tested those products in connection with this
publication and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of
those products. IBM does not warrant the quality of any third-party products, or the ability of any such third-party products to interoperate with IBM’s products. IBM EXPRESSLY DISCLAIMSALL WARRANTIES,
EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITYAND FITNESS FOR APARTICULAR PURPOSE.
The provision of the information contained herein is not intended to, and does not, grant any right or license under any IBM patents, copyrights, trademarks or other intellectual property right.
IBM, the IBM logo, ibm.com, BrassRing®, Connections™, Domino®, Global Business Services®, Global Technology Services®, SmartCloud®, Social Business®, Kenexa®, Notes®, PartnerWorld®, Prove It!®,
PureSystems®, Sametime®, Verse™, Watson™, WebSphere®, Worklight®, are trademarks of International Business Machines Corporation, registered in many jurisdictions worldwide. Other product and service
names might be trademarks of IBM or other companies. Acurrent list of IBM trademarks is available on the Web at "Copyright and trademark information" at: www.ibm.com/legal/copytrade.shtml.

More Related Content

PPTX
Take Your XPages Development to the Next Level
PDF
BP204 It's Not Infernal: Dante's Nine Circles of XPages Heaven
PPTX
[DanNotes] XPages - Beyound the Basics
PPTX
MWLUG 2015 - AD114 Take Your XPages Development to the Next Level
PPTX
The Grid the Brad and the Ugly: Using Grids to Improve Your Applications
PPT
XPages Workshop: Concepts And Exercises
PDF
OpenNTF Domino API (ODA): Super-Charging Domino Development
ODP
Java and XPages
Take Your XPages Development to the Next Level
BP204 It's Not Infernal: Dante's Nine Circles of XPages Heaven
[DanNotes] XPages - Beyound the Basics
MWLUG 2015 - AD114 Take Your XPages Development to the Next Level
The Grid the Brad and the Ugly: Using Grids to Improve Your Applications
XPages Workshop: Concepts And Exercises
OpenNTF Domino API (ODA): Super-Charging Domino Development
Java and XPages

What's hot (20)

PPTX
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
PPTX
Batching and Java EE (jdk.io)
PDF
SHOW107: The DataSource Session: Take XPages data boldly where no XPages data...
PDF
Java EE 7 Recipes for Concurrency - JavaOne 2014
PPTX
Exactpro Systems for KSTU Students in Kostroma
PPT
XPages -Beyond the Basics
PPT
J2EE Batch Processing
PDF
Take a Trip Into the Forest: A Java Primer on Maps, Trees, and Collections
PDF
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
PDF
Jdbc Complete Notes by Java Training Center (Som Sir)
PPT
Jspprogramming
PPTX
Hibernate
PDF
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
PDF
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
PPTX
ASP.NET MVC Performance
PPTX
Play framework : A Walkthrough
PDF
NLOUG 2017- Oracle WebCenter Portal 12c Performance
PDF
NLOUG 2018 - Future of JSF and ADF
PPTX
TestComplete 7.50 New Features
PDF
JavaFX Enterprise (JavaOne 2014)
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
Batching and Java EE (jdk.io)
SHOW107: The DataSource Session: Take XPages data boldly where no XPages data...
Java EE 7 Recipes for Concurrency - JavaOne 2014
Exactpro Systems for KSTU Students in Kostroma
XPages -Beyond the Basics
J2EE Batch Processing
Take a Trip Into the Forest: A Java Primer on Maps, Trees, and Collections
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Jdbc Complete Notes by Java Training Center (Som Sir)
Jspprogramming
Hibernate
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
ASP.NET MVC Performance
Play framework : A Walkthrough
NLOUG 2017- Oracle WebCenter Portal 12c Performance
NLOUG 2018 - Future of JSF and ADF
TestComplete 7.50 New Features
JavaFX Enterprise (JavaOne 2014)
Ad

Viewers also liked (19)

PPTX
Speed up your XPages Application performance
PDF
IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...
PDF
Ad109 - XPages Performance and Scalability
PDF
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshell
PDF
XPages Performance Master Class - Survive in the fast lane on the Autobahn (E...
PDF
XPages: Performance-Optimierung - Ulrich Krause (eknori) SNoUG 2013
PPTX
IBM Connections Cloud Administration
PPTX
Life in the fast lane. Full speed XPages
PDF
BP205: There’s an API for that! Why and how to build on the IBM Connections P...
ODP
IBM ConnectED 2015 - AD302 - Responsive Application Development for XPages
PDF
IBM ConnectED 2015 BP110: Mastering Your Logs, Everything You Should Know abo...
PDF
The future of web development write once, run everywhere with angular js an...
PDF
BP201 Creating Your Own Connections Confection - Getting The Flavour Right
PPTX
ConnectED 2015 - IBM Notes Traveler Daily Business
PDF
Connections Directory Integration: A Tour Through Best Practices for Directo...
PDF
External Users Accessing Connections
ODP
MAS202 - Customizing IBM Connections
PPTX
Customizing the Mobile Connections App
PDF
GraphQL 101
Speed up your XPages Application performance
IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...
Ad109 - XPages Performance and Scalability
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshell
XPages Performance Master Class - Survive in the fast lane on the Autobahn (E...
XPages: Performance-Optimierung - Ulrich Krause (eknori) SNoUG 2013
IBM Connections Cloud Administration
Life in the fast lane. Full speed XPages
BP205: There’s an API for that! Why and how to build on the IBM Connections P...
IBM ConnectED 2015 - AD302 - Responsive Application Development for XPages
IBM ConnectED 2015 BP110: Mastering Your Logs, Everything You Should Know abo...
The future of web development write once, run everywhere with angular js an...
BP201 Creating Your Own Connections Confection - Getting The Flavour Right
ConnectED 2015 - IBM Notes Traveler Daily Business
Connections Directory Integration: A Tour Through Best Practices for Directo...
External Users Accessing Connections
MAS202 - Customizing IBM Connections
Customizing the Mobile Connections App
GraphQL 101
Ad

Similar to IBM ConnectED 2015 - MAS103 XPages Performance and Scalability (20)

PDF
540slidesofnodejsbackendhopeitworkforu.pdf
PPTX
Module design pattern i.e. express js
ODP
Workflow Management with Espresso Workflow
ODP
Eureka moment
PDF
AD102 - Break out of the Box
PDF
Camunda BPM 7.2: Performance and Scalability (English)
ODP
Caerusone
PDF
Divide and Conquer – Microservices with Node.js
PPTX
North east user group tour
PDF
Apache Samza 1.0 - What's New, What's Next
PPTX
QSpiders - Installation and Brief Dose of Load Runner
PDF
Meetup Performance
PDF
Meetup Performance
PPT
Migration from ASP to ASP.NET
PDF
Celery with python
PDF
SamzaSQL QCon'16 presentation
PDF
Boot Loot
PDF
Release with confidence
PPTX
ADF Gold Nuggets (Oracle Open World 2011)
PPTX
Testing Ext JS and Sencha Touch
540slidesofnodejsbackendhopeitworkforu.pdf
Module design pattern i.e. express js
Workflow Management with Espresso Workflow
Eureka moment
AD102 - Break out of the Box
Camunda BPM 7.2: Performance and Scalability (English)
Caerusone
Divide and Conquer – Microservices with Node.js
North east user group tour
Apache Samza 1.0 - What's New, What's Next
QSpiders - Installation and Brief Dose of Load Runner
Meetup Performance
Meetup Performance
Migration from ASP to ASP.NET
Celery with python
SamzaSQL QCon'16 presentation
Boot Loot
Release with confidence
ADF Gold Nuggets (Oracle Open World 2011)
Testing Ext JS and Sencha Touch

More from Paul Withers (20)

PDF
Engage 2019: Introduction to Node-Red
PDF
Engage 2019: Modernising Your Domino and XPages Applications
PDF
Engage 2019: AI What Is It Good For
PDF
Social Connections 14 - ICS Integration with Node-RED and Open Source
PDF
ICONUK 2018 - Do You Wanna Build a Chatbot
PDF
IBM Think Session 8598 Domino and JavaScript Development MasterClass
PDF
IBM Think Session 3249 Watson Work Services Java SDK
PDF
GraphQL 101
PDF
AD1279 "Marty, You're Not Thinking Fourth Dimensionally" - Troubleshooting XP...
PDF
Social Connections 2015 CrossWorlds and Domino
PDF
ICON UK 2015 - ODA and CrossWorlds
PPTX
OpenNTF Domino API - Overview Introduction
PDF
What's New and Next in OpenNTF Domino API (ICON UK 2014)
PDF
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
PDF
Engage 2014 OpenNTF Domino API Slides
PDF
IBM Connect 2014 BP204: It's Not Infernal: Dante's Nine Circles of XPages Heaven
PDF
Embracing the power of the notes client
PDF
Beyond Domino Designer
PDF
DanNotes 2013: OpenNTF Domino API
PDF
BP206 It's Not Herculean: 12 Tasks Made Easier with IBM Domino XPages
Engage 2019: Introduction to Node-Red
Engage 2019: Modernising Your Domino and XPages Applications
Engage 2019: AI What Is It Good For
Social Connections 14 - ICS Integration with Node-RED and Open Source
ICONUK 2018 - Do You Wanna Build a Chatbot
IBM Think Session 8598 Domino and JavaScript Development MasterClass
IBM Think Session 3249 Watson Work Services Java SDK
GraphQL 101
AD1279 "Marty, You're Not Thinking Fourth Dimensionally" - Troubleshooting XP...
Social Connections 2015 CrossWorlds and Domino
ICON UK 2015 - ODA and CrossWorlds
OpenNTF Domino API - Overview Introduction
What's New and Next in OpenNTF Domino API (ICON UK 2014)
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
Engage 2014 OpenNTF Domino API Slides
IBM Connect 2014 BP204: It's Not Infernal: Dante's Nine Circles of XPages Heaven
Embracing the power of the notes client
Beyond Domino Designer
DanNotes 2013: OpenNTF Domino API
BP206 It's Not Herculean: 12 Tasks Made Easier with IBM Domino XPages

Recently uploaded (20)

PDF
Network Security Unit 5.pdf for BCA BBA.
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
cuic standard and advanced reporting.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
A Presentation on Artificial Intelligence
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Approach and Philosophy of On baking technology
PDF
Electronic commerce courselecture one. Pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
Network Security Unit 5.pdf for BCA BBA.
The AUB Centre for AI in Media Proposal.docx
cuic standard and advanced reporting.pdf
Spectral efficient network and resource selection model in 5G networks
Review of recent advances in non-invasive hemoglobin estimation
A Presentation on Artificial Intelligence
“AI and Expert System Decision Support & Business Intelligence Systems”
Building Integrated photovoltaic BIPV_UPV.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Approach and Philosophy of On baking technology
Electronic commerce courselecture one. Pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
NewMind AI Monthly Chronicles - July 2025
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Digital-Transformation-Roadmap-for-Companies.pptx
Big Data Technologies - Introduction.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
The Rise and Fall of 3GPP – Time for a Sabbatical?

IBM ConnectED 2015 - MAS103 XPages Performance and Scalability

  • 2. Click to edit Master subtitle style MAS103: XPages Performance and Scalability Tony McGuckin, IBM Paul Withers, Intec
  • 3. 3 This session draws upon material taken from the Mastering XPages, Second Edition book from IBM Press. Where applicable the presenters will suggest further reading available from this book about topics in this session. It is available to order from Amazon.com and all good bookshops! Reference material...
  • 4. Tony McGuckin Senior Software Engineer / Technical Lead, IBM XPages Core Runtime XPages Bluemix Buildpack / Runtime Author Mastering XPages (1st and 2nd Editions) and XPages Portable Command Guide books OpenNTF Contributor
  • 5. Paul Withers XPages Developer since 2009 IBM Champion OpenNTF Board Member Author of XPages Extension Library Developer XPages OpenLog Logger Co-Developer of OpenNTF Domino API
  • 7. Architect for Performance Avoid large pages “Reports” of large numbers of documents Multiple on-the-fly dashboards Data pulled from large variety of sources Less server-side processing, less HTML to push down network Design for the web not for printing! Understand performance of code You’ve been using Agent Profiling, right? μηδέν άγαν Don’t over-complicate a small, simple page!
  • 8. Cache for Performance Cache data in application / session / view / request scopes as appropriate XSnippet for caching header resources (SSJS / Java) http://openntf.org/XSnippets.nsf/snippet.xsp? id=set-cache-headers-on-an-xpage XSnippet for Keyword caching bean (Java) http://openntf.org/XSnippets.nsf/snippet.xsp?id=keyword- caching-bean XSnippet for refreshing individual scoped variables (Java) http://openntf.org/XSnippets.nsf/snippet.xsp? id=refresh-applicationscope-variables-with-individual-timeout Add code to keyword / config document save to update scopes
  • 9. Languages for Performance Hierarchy of Languages Literal content > Expression Language > SSJS SSJS is stored as string, parsed and evaluated at runtime “Custom” allows combining all three in one component’s value Less HTML emitted Not picked up by in-built localization Some SSJS code can be converted to Expression Language E.g. #{database.title} instead of #{javascript:database.getTitle()} Java? #{myBean.myProperty} = Expression Language #{javascript:myBean.runMyMethod()} = SSJS, but just one line
  • 10. Compute for Performance Compute On Page Load where possible ${javascript:session.getEffectiveUserName()} because it cannot change during page’s life Lazy Load Easier with Java Beans Can be triggered from Expression Language Possible with SSJS Compute using view.isRenderingPhase() where appropriate Code will only calculate once during partial refresh Good for properties only affecting HTML output – rendered, style, styleClass, value property of Computed Field components
  • 11. Load for Performance Use dataContexts for duplicate properties, especially “rendered” E.g. #{userIsAdmin} (Expression Language) pointing to dataContext computing on page load whether user has admin role dataContexts set to compute dynamically refresh a number of times If bound to panels, get cleaned up during Invoke Application phase http://avatar.red-pill.mobi/tim/blog.nsf/ d6plinks/TTRY-9CD3JN Use if (view.isRenderingPhase()) to avoid errors and only run during Render Response Use Dynamic Content control Only the live “rendered” area is in the Component Tree
  • 12. Scope for Performance Scope data to the lowest scope If used on one page only, viewScope If used on multiple pages for one user, sessionScope Scope data to smallest component dataContexts allow variables to be “scoped” to XPages, Custom Controls or Panels Same applies to dominoView / dominoData / dataObjects variables
  • 15. Partial Refresh – Step 1: Submission Browser → Server In-built Partial Refresh Full web page submitted XSP.partialRefreshGet() Nothing submitted Server-side processing ignores any user action since last refresh XSP.partialRefreshPost() By default, full web page submitted Can override with options {clearForm: true, additionalFields: [‘#{inputText1}’, ‘#{inputText2}’]} Only send inputText1 and inputText2 content
  • 16. Partial Refresh – Step 1: Submission Combine optimised XSP.partialRefreshPost and in-built Partial Refresh See XSnippet from Per Henrik Lausten extending work by Sven Hasselbach http://openntf.org/XSnippets.nsf/snippet.xsp?id=optimized-partial-refresh-with-support-for-server-side- actions
  • 17. Partial Refresh – Step 2: Execution (High Level) Server → Server By default full component tree is processed execMode=“partial” execId=“processId” Only the component with that ID and all descendants are processed User content outside that execId is ignored
  • 18. Partial Refresh – Step 3: Refresh Server → Browser refreshMode=“partial” refreshId=“processId” Only HTML for component with that ID and all descendants is passed to browser
  • 20. Six Phases Restore View Component Tree retrieved Apply Request Values this.setSubmittedValue(stringFromBrowser) runs on all or execId Any event logic runs if immediate=“true” Process Validation Any converters applied for all or execId Any validators applied for all or execId
  • 21. Six Phases Update Model Values this.setValue(this.setSubmittedValue()) runs on all or execId this.setSubmittedValue(null) runs on all or execId e.g. dominoDocument.replaceItemValue(this.getValue()) Invoke Application Any event logic run Render Response HTML rendered and state saved Only event that runs during page load
  • 22. Debugging XPages Lifecycle Always, always, ALWAYS include a Display Errors control in refresh area Otherwise validation / conversion errors will not be displayed on browser Doc Brown: “Marty, it’s perfect, you’re just not thinking fourth dimensionally” When does server-side code run? What HTML is passed to the browser? Use DebugBean XSnippet to inspect phases http://openntf.org/XSnippets.nsf/snippet.xsp?id=xrpl-isphase-api
  • 23. XSP.partialRefreshGet() No updates to component tree beforeRestoreView afterRestoreView beforeRenderResponse afterRenderResponse
  • 24. Basic Partial Refresh Validation fails beforeRestoreView afterRestoreView beforeApplyRequestValues afterApplyRequestValues beforeProcessValidations beforeRenderResponse Event logic does not run
  • 25. No Validation Conversion still honoured If failed, skips from ProcessValidations to RenderResponse Event Logic not run If no conversion errors, all phases run Values passed from submittedValue to value Component tree updated
  • 26. Immediate=“true” Same as basic XPage processing wiith validation failure beforeRestoreView afterRestoreView beforeApplyRequestValues afterApplyRequestValues beforeRenderResponse afterRenderResponse Event logic run in ApplyRequestValues phase Component value never goes past submittedValue Data model not updated
  • 28. The “XPages Toolbox” → XPages based Application (The “XPages Swiss Army Knife”) Runs on the Domino server or the Notes client XPagesToolbox.nsf needs to be installed on the Domino server or XPiNC client A profiler .jar file needs to be added to the JVM launch options & JVM java.policy updated Should be used regularly during development / testing cycles to: Profile CPU performance & Memory usage (per request or periodically) / Backend usage Create Java Heap Dumps / XML Memory Dumps Production use only for problem resolution - sensitive data collection capabilities Available from OpenNTF.org Free open source project / Search for “XPages Toolbox” Full readme.pdf instructions within the project download files Developing for Performance The XPages Toolbox
  • 29. Provides insight into custom SSJS code using Profile Blocks __profile(“blockIdentifier”, “optionalInformation”){ // profile my custom code... var nd:NotesDocument = document1.getDocument(); .... __profile(“blockIdentifier”, “optionalInformation”){ // profile my nested profile block... var x = nd.getItemValueString(“x”); .... } } Developing for Performance Using the XPages Toolbox
  • 30. Provides insight into custom Java code using Profile Block Decorator private static final ProfilerType pt = new ProfilerType("MyBlock"); public void myMethod() { if(Profiler.isEnabled()) { ProfilerAggregator pa = Profiler.startProfileBlock(pt, null); long startTime = Profiler.getCurrentTime(); try { _myMethod(); } finally { Profiler.endProfileBlock(pa, startTime); } } else { _myMethod(); } } private void _myMethod() { // real implementation of myMethod … } Developing for Performance Using the XPages Toolbox
  • 31. Profile Blocks in SSJS / Java are Non-Invasive and Supportive Leave the custom Profile Blocks in your SSJS / Java Code No negative performance impact on any application even if the XPages Toolbox is not installed on a server or XPiNC client Therefore supporting you for future profiling & maintenance tasks Developing for Performance Using the XPages Toolbox
  • 32. Key elements: Profile XPages Request using Wall and CPU Profilers... Perform CPU and Wall time intensive tasks... Analyze profiling results and identify issues in the XPages Toolbox! Developing for Performance The XPages Toolbox
  • 34. Persistence Summary HTTP is stateless, XPages is stateful by default xsp.session.transient=true makes XPage stateless For each browser session, for every XPage component trees need storing xsp.persistence.tree.maxviews=4 – default number of trees stored in memory xsp.persistence.file.maxviews=16 – default number of trees stored on disk xsp.session.timeout=30 – default inactivity timeout for browser stateful session (xsp.application.timeout=30 – default applicationScope timeout) Recommendation: reduce timeout and use Keep Session Alive
  • 35. Persistence Summary xsp.persistence.mode=basic Keep pages in memory: best for quick retrieval, few browser sessions xsp.persistence.mode=file Keep pages on disk: best for lots of browser sessions, slower retrieval xsp.persistence.mode=fileex Keep latest page in memory, rest on disk: best for lots of users, quick retrieval of latest page
  • 36. Persistence Summary xsp.persistence.file.gzip Before storing to disk, gzip the content: smaller files, but slower to store / retrieve xsp.persistence.dir.xspstate Default folder for storing pages to disk Similar options for default location for file uploads and attachments
  • 37. Page Persistence xsp.persistence.viewstate=fulltree Default, whole tree is persisted and update xsp.persistence.viewstate=delta Only stores changes since page first loaded Valid if pages are stored in memory xsp.persistence.viewstate=deltaex Stores full component tree for current page, deltas for others Valid if pages are only stored in memory
  • 38. Page Persistence xsp.persistence.viewstate=nostate No component tree is stored, similar to xsp.session.transient=true Page persistence settings can be set on individual XPages Great for large, readonly XPages with no paging, state not persisted Go to next page from default, not go to next page from current Toggle show detail from default, not toggle show detail from current Unless showDetailsOnClient=true Recommendation: set xsp.persistence.viewstate=nostate on XAgents
  • 40. CPU, Wall Time, and Backend profiling gives insight into the vertical processing costs for any given XPage request But what about vertical and horizontal memory costs? Requires analysis using JVM Heap Dumps Requires analysis using JVM System Dumps Requires analysis using XML Session Dumps Developing for Scalability Surface Zero - Analysing Memory Usage
  • 41. Generate a JVM Heap or System Dump of the HTTP task JVM memory A button in the XPages Toolbox generates a JVM Heap Dump XSP Commands on the Domino Server console allow spontaneous Heap / System Dump creation tell http xsp heapdump (triggers com.ibm.jvm.Dump.HeapDump()) tell http xsp systemdump (triggers com.ibm.jvm.Dump.SystemDump()) Analyze Heap / System Dumps using the Eclipse Memory Analyzer http://www.eclipse.org/mat/ Also install Eclipse Extension: IBM Diagnostic Tool Framework for Java Version 1.1 http://www.ibm.com/developerworks/java/jdk/tools/dtfj.html Heap Dumps automatically occur in production when certain conditions occur Eg: By default when an XPage fails due to the server running out of JVM Memory java.lang.OutOfMemoryError Developing for Scalability Analysing Memory Usage – JVM Heap & System Dumps
  • 42. Generate XML Session Dumps of the HTTP task JVM memory Two options available under the XPages Toolbox → Session Dumps Tab Full XML Session Dump Partial XML Session Dump Analyze XML Session Dumps using any Browser/XML/Text Editor Caution required on production systems as sensitive data is collected within the XML Session Dump file Developing for Scalability Analysing Memory Usage – XML Session Dumps
  • 43. Key elements: Make XPages Requests... Generate Heap/System/XML Session Dumps... Analyze memory usage in each type of Dump format to identify issues! Developing for Scalability Heap/System/XML Session Dumps
  • 44. Developing for Scalability Heap/System Dumps – OQL / Navigating XSP Objects Entry Point...
  • 45. Developing for Scalability Heap/System Dumps – OQL / Navigating XSP Objects Entry Point...
  • 46. Developing for Scalability Heap/System Dumps – OQL / Navigating XSP Objects Entry Point...
  • 48. Other Great XPages Sessions On The Way
  • 49. 49 Technical Education IBM Press Books and eBooks Three best-selling publications
  • 50. 50 More Information – Summary OpenNTF – Open Source Community http://www.openntf.org XPages.info – One Stop Shopping for XPages http://xpages.info XPages Forum – Got Questions, Need Answers? http://xpages.info/forum Domino Application Development Wiki http://www.lotus.com/ldd/ddwiki.nsf Stackoverflow http://stackoverflow.com/questions/tagged/xpages
  • 51. Engage Online SocialBiz User Group: socialbizug.org Join the epicenter of Notes and Collaboration user groups Social Business Insights blog: ibm.com/blogs/socialbusiness Read and engage with our bloggers Follow us on Twitter @IBMConnect and @IBMSocialBiz LinkedIn: http://bit.ly/SBComm Participate in the IBM Social Business group on LinkedIn Facebook: https://www.facebook.com/IBMConnected Like IBM Social Business on Facebook
  • 52. Notices and Disclaimers Copyright © 2015 by International Business Machines Corporation (IBM). No part of this document may be reproduced or transmitted in any form without written permission from IBM. U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSAADP Schedule Contract with IBM. Information in these presentations (including information relating to products that have not yet been announced by IBM) has been reviewed for accuracy as of the date of initial publication and could include unintentional technical or typographical errors. IBM shall have no responsibility to update this information. THIS DOCUMENT IS DISTRIBUTED "AS IS" WITHOUT ANY WARRANTY, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL IBM BE LIABLE FOR ANY DAMAGEARISING FROM THE USE OF THIS INFORMATION, INCLUDING BUT NOT LIMITED TO, LOSS OF DATA, BUSINESS INTERRUPTION, LOSS OF PROFIT OR LOSS OF OPPORTUNITY. IBM products and services are warranted according to the terms and conditions of the agreements under which they are provided. Any statements regarding IBM's future direction, intent or product plans are subject to change or withdrawal without notice. Performance data contained herein was generally obtained in a controlled, isolated environments. Customer examples are presented as illustrations of how those customers have used IBM products and the results they may have achieved. Actual performance, cost, savings or other results in other operating environments may vary. References in this document to IBM products, programs, or services does not imply that IBM intends to make such products, programs or services available in all countries in which IBM operates or does business. Workshops, sessions and associated materials may have been prepared by independent session speakers, and do not necessarily reflect the views of IBM. All materials and discussions are provided for informational purposes only, and are neither intended to, nor shall constitute legal or other guidance or advice to any individual participant or their specific situation. It is the customer’s responsibility to insure its own compliance with legal requirements and to obtain advice of competent legal counsel as to the identification and interpretation of any relevant laws and regulatory requirements that may affect the customer’s business and any actions the customer may need to take to comply with such laws. IBM does not provide legal advice or represent or warrant that its services or products will ensure that the customer is in compliance with any law. Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not tested those products in connection with this publication and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. IBM does not warrant the quality of any third-party products, or the ability of any such third-party products to interoperate with IBM’s products. IBM EXPRESSLY DISCLAIMSALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITYAND FITNESS FOR APARTICULAR PURPOSE. The provision of the information contained herein is not intended to, and does not, grant any right or license under any IBM patents, copyrights, trademarks or other intellectual property right. IBM, the IBM logo, ibm.com, BrassRing®, Connections™, Domino®, Global Business Services®, Global Technology Services®, SmartCloud®, Social Business®, Kenexa®, Notes®, PartnerWorld®, Prove It!®, PureSystems®, Sametime®, Verse™, Watson™, WebSphere®, Worklight®, are trademarks of International Business Machines Corporation, registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. Acurrent list of IBM trademarks is available on the Web at "Copyright and trademark information" at: www.ibm.com/legal/copytrade.shtml.