xpages performance auf client und server

86
© 2013 IBM Corporation EntwicklerCamp 2013 XPages Performance auf Client und Server Workshop Track 4 – Session 6 – 16:00 – 17:30 Stefan Neth – Senior Client Technical Professional, IBM

Upload: others

Post on 12-Sep-2021

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: XPages Performance auf Client und Server

© 2013 IBM Corporation

EntwicklerCamp 2013

XPages Performance auf Client und Server

Workshop Track 4 – Session 6 – 16:00 – 17:30

Stefan Neth – Senior Client Technical Professional, IBM

Page 2: XPages Performance auf Client und Server

2 © 2013 IBM Corporation

Please note:

IBM’s statements regarding its plans, directions, and intent are subject to change or withdrawal without notice at IBM’s sole discretion. Information regarding potential future products is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information mentioned regarding potential future products is not a commitment, promise, or legal obligation to deliver any material, code or functionality. Information about potential future products may not be incorporated into any contract. The development, release, and timing of any future features or functionality described for our products remains at our sole discretion.

Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual throughput or performance that any user will experience will vary depending upon many factors, including considerations such as the amount of multiprogramming in the user's job stream, the I/O configuration, the storage configuration, and the workload processed. Therefore, no assurance can be given that an individual user will achieve results similar to those stated here.

Page 3: XPages Performance auf Client und Server

© 2013 IBM Corporation

About your Presenter...

Stefan Neth─ Senior CTP: IBM Deutschland

▬ ICS Technical Sales ▬ XPages Ansprechpartner

● Entwicklungsthemen● Deployment● Integration IBM Connections und IBM Exceptional Web Experience

▬ IBM Notes / Domino 9 Evangelist

● Publications▬ Redbook Customizing Portal Express

for Small to Medium Business

3

Page 4: XPages Performance auf Client und Server

© 2013 IBM Corporation

About this session...

Page 5: XPages Performance auf Client und Server

© 2013 IBM Corporation

Goal

“Bullet points for your XPages performance”

Page 6: XPages Performance auf Client und Server

© 2013 IBM Corporation

Session Agenda

● Understanding an XPages Request and Tooling● Best practices for Server configuration● Best practices XPiNC● Real World example

Page 7: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding an XPages Request

The requesting User Agent has work to do in order to process any given request or response:

● Resource Caching● Size of request or response● Number of requests and responses● Parsing of JavaScript / CSS● Calculating the layout● Painting / Rendering the final page

The Network experiences its own stress and load issues:

● Bandwidth● Latency● Contention

Server/Client hardware has two critical parts that determine how an application behaves:

● CPU● Memory

A Distributed System Architecture presents its own challenges:

● Data Replication &Indexing● Conflict Resolution● Remote / Local Execution● Node Availability / Failover● Design Propagation

Page 8: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding an XPages Request

The requesting User Agent has work to do in order to process any given request or response:

● Resource Caching● Size of request or response● Number of requests and responses● Parsing of JavaScript / CSS● Calculating the layout● Painting / Rendering the final page

The Network experiences its own stress and load issues:

● Bandwidth● Latency● Contention

Server/Client hardware has two critical parts that determine how an application behaves:

● CPU● Memory

A Distributed System Architecture presents its own challenges:

● Data Replication &Indexing● Conflict Resolution● Remote / Local Execution● Node Availability / Failover● Design Propagation

Page 9: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding an XPages Request

The requesting User Agent has work to do in order to process any given request or response:

● Resource Caching● Size of request or response● Number of requests and responses● Parsing of JavaScript / CSS● Calculating the layout● Painting / Rendering the final page

The Network experiences its own stress and load issues:

● Bandwidth● Latency● Contention

Server/Client hardware has two critical parts that determine how an application behaves:

● CPU● Memory

A Distributed System Architecture presents its own challenges:

● Data Replication &Indexing● Conflict Resolution● Remote / Local Execution● Node Availability / Failover● Design Propagation

Page 10: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding an XPages Request

The requesting User Agent has work to do in order to process any given request or response:

● Resource Caching● Size of request or response● Number of requests and responses● Parsing of JavaScript / CSS● Calculating the layout● Painting / Rendering the final page

The Network experiences its own stress and load issues:

● Bandwidth● Latency● Contention

Server/Client hardware has two critical parts that determine how an application behaves:

● CPU● Memory

A Distributed System Architecture presents its own challenges:

● Data Replication &Indexing● Conflict Resolution● Remote / Local Execution● Node Availability / Failover● Design Propagation

Page 11: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding an XPages Request

The requesting User Agent has work to do in order to process any given request or response:

● Resource Caching● Size of request or response● Number of requests and responses● Parsing of JavaScript / CSS● Calculating the layout● Painting / Rendering the final page

The Network experiences its own stress and load issues:

● Bandwidth● Latency● Contention

Server hardware has two critical parts that determine how an application behaves:

● CPU● Memory

A Distributed System Architecture presents its own challenges:

● Data Replication &Indexing● Conflict Resolution● Remote / Local Execution● Node Availability / Failover● Design Propagation

Understanding the XPages Request Processing Lifecycle is critical to effectively minimize CPU and Memory usage.

Page 12: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding an XPages Request nhttp.exe

nlnotes.exe

Page 13: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding an XPages Request nhttp.exe

OSGi Framework

nlnotes.exe

Page 14: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding an XPages Request nhttp.exe

OSGi Framework

XPagesRuntime

nlnotes.exe

Backend, C/C++ Services (NSF, NIF, etc), Database Layers

Page 15: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding an XPages Request nhttp.exe

OSGi Framework

XPagesRuntime

JavaServer FacesFramework

nlnotes.exe

Backend, C/C++ Services (NSF, NIF, etc), Database Layers

X-RPL Process

Page 16: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding an XPages Request nhttp.exe

OSGi Framework

XPagesRuntime

XPagesExtensions

[OSGi Bundles]

JavaServer FacesFramework

nlnotes.exe

Backend, C/C++ Services (NSF, NIF, etc), Database Layers

XLIB

X-RPL Process

Page 17: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding an XPages Request nhttp.exe

OSGi Framework

XPagesRuntime

XPagesExtensions

[OSGi Bundles]

JavaServer FacesFramework

nlnotes.exe

Backend, C/C++ Services (NSF, NIF, etc), Database Layers

NSF Applications[ Component Modules ]

XLIB

*.nsf

X-RPL Process

Page 18: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding an XPages Request nhttp.exe

OSGi Framework

XPagesRuntime

XPagesExtensions

[OSGi Bundles]

JavaServer FacesFramework

nlnotes.exe

Backend, C/C++ Services (NSF, NIF, etc), Database Layers

NSF Applications[ Component Modules ]

State Management Layer

XLIB

*.nsf

X-RPL Process

Page 19: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding an XPages Request nhttp.exe

OSGi Framework

XPagesRuntime

XPagesExtensions

[OSGi Bundles]

JavaServer FacesFramework

nlnotes.exe

Backend, C/C++ Services (NSF, NIF, etc), Database Layers

NSF Applications[ Component Modules ]

XSP Component Trees

State Management Layer

XLIB

*.nsf

X-RPL Process

Page 20: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding an XPages Request nhttp.exe

OSGi Framework

XPagesRuntime

XPagesExtensions

[OSGi Bundles]

JavaServer FacesFramework

nlnotes.exe

Backend, C/C++ Services (NSF, NIF, etc), Database Layers

NSF Applications[ Component Modules ]

XSP Component Trees

State Management Layer

XLIB

*.nsf

X-RPL Process

Page 21: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding an XPages Request nhttp.exe

OSGi Framework

XPagesRuntime

XPagesExtensions

[OSGi Bundles]

JavaServer FacesFramework

nlnotes.exe

Backend, C/C++ Services (NSF, NIF, etc), Database Layers

NSF Applications[ Component Modules ]

XSP Component Trees

State Management Layer

XLIB

*.nsf

X-RPL Process

Page 22: XPages Performance auf Client und Server

© 2013 IBM Corporation

nhttp.exe

OSGi Framework

XPagesRuntime

XPagesExtensions

[OSGi Bundles]

JavaServer FacesFramework

nlnotes.exe

Backend, C/C++ Services (NSF, NIF, etc), Database Layers

NSF Applications[ Component Modules ]

XSP Component Trees

State Management Layer

XLIB

*.nsf

X-RPL Process

XPages Request Processing Lifecycle

Understanding an XPages Request

Page 23: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding an XPages Request

Page 24: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding an XPages Request

Most typically executed forHTTP GET & POST

Requests

Page 25: XPages Performance auf Client und Server

© 2013 IBM Corporation

Most typically executed forHTTP GET & POST

Requests

GET = 1,6

Understanding an XPages Request

Page 26: XPages Performance auf Client und Server

© 2013 IBM Corporation

Most typically executed forHTTP GET & POST

Requests

GET = 1,6

Understanding an XPages Request

POST = 1,2,3,4,5,6

Page 27: XPages Performance auf Client und Server

© 2013 IBM Corporation

Most typically executed forHTTP GET & POST

Requests

GET = 1,6 POST = 1,2,3,4,5,6

Understanding an XPages Request

2 x System Level Phases [ 1,6 ]

Executed for most HTTP GET & POST

Requests

Page 28: XPages Performance auf Client und Server

© 2013 IBM Corporation

2 x System Level Phases [ 1,6 ]

Executed for most HTTP GET & POST

Requests

Most typically executed forHTTP GET & POST

Requests

GET = 1,6 POST = 1,2,3,4,5,6

Understanding an XPages Request

4 x Application Level Phases [ 2,3,4,5 ]

Executed for HTTP POST Requests

Page 29: XPages Performance auf Client und Server

© 2013 IBM Corporation

2 x System Level Phases [ 1,6 ]

Executed for most HTTP GET & POST

Requests

4 x Application Level Phases [ 2,3,4,5 ]

Executed for HTTP POST Requests

Most typically executed forHTTP GET & POST

Requests

GET = 1,6 POST = 1,2,3,4,5,6

Understanding an XPages Request

4 x Event Pseudo-Phases [ 2,3,4,5 ]

Executed for HTTP POST Requests

Page 30: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding an XPages Request The XPages Request Processing Lifecycle

Page 31: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding the XPages Request Processing Lifecycle Phases

─ Phases 1 and 6 are System Level Phases

– Typically these phase are nearly always invoked – differences for GET vs POST / AJAX

─ Phases 2, 3, 4, and 5 are Application Level Phases

– These phases can be leveraged by developers for different use cases– By understanding how to properly leverage the phases, an application can be more

efficient when processing a request executed through the XPages lifecycle

─ An XPages request can skip some of the six phases under certain use cases

– This reduces CPU processing and Memory utilization on a server– Therefore increasing Performance and Scalability factors

Understanding an XPages Request

Page 32: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding the XPages Request Processing Lifecycle Phases

─ Phases 1 and 6 are System Level Phases

– Typically these phase are nearly always invoked – differences for GET vs POST / AJAX

─ Phases 2, 3, 4, and 5 are Application Level Phases

– These phases can be leveraged by developers for different use cases– By understanding how to properly leverage the phases, an application can be more

efficient when processing a request executed through the XPages lifecycle

─ An XPages request can skip some of the six phases under certain use cases

– This reduces CPU processing and Memory utilization on a server– Therefore increasing Performance and Scalability factors

Understanding an XPages Request

Page 33: XPages Performance auf Client und Server

© 2013 IBM Corporation

Understanding the XPages Request Processing Lifecycle Phases

─ Phases 1 and 6 are System Level Phases

– Typically these phase are nearly always invoked – differences for GET vs POST / AJAX

─ Phases 2, 3, 4, and 5 are Application Level Phases

– These phases can be leveraged by developers for different use cases– By understanding how to properly leverage the phases, an application can be more

efficient when processing a request executed through the XPages lifecycle

─ An XPages request can skip some of the six phases under certain use cases

– This reduces CPU processing and Memory utilization on a server– Therefore increasing Performance and Scalability factors

Understanding an XPages Request

Page 34: XPages Performance auf Client und Server

© 2013 IBM Corporation

Introduction to the lifecycle.nsf ApplicationUsing the XPages Toolbox

http://www.openntf.org/internal/home.nsf/project.xsp?action=openDocument&name=XPages%20Masterclass

Page 35: XPages Performance auf Client und Server

© 2013 IBM Corporation

Introduction to the lifecycle.nsf Application

35

Testing harness demonstrating a variety of XPages Request Processing Lifecycle use cases in a self-contained XPages application

─ Introduces Lifecycle phases and advanced use cases governed by the X-RPL

─ Uses a PhaseListener class to capture key phase entry / exit points– Allowing dynamic introspection of a request

• See: DebugBeanPhaseListener.java / faces-config.xml / index.xsp

─ Requires 8.5.3 UP1, OpenNTF XPages Extension Library, or greater

Page 36: XPages Performance auf Client und Server

© 2013 IBM Corporation

Introduction to the lifecycle.nsf Application

36

Testing harness demonstrating a variety of XPages Request Processing Lifecycle use cases in a self-contained XPages application

─ Introduces Lifecycle phases and advanced use cases governed by the X-RPL

─ Uses a PhaseListener class to capture key phase entry / exit points– Allowing dynamic introspection of a request

• See: DebugBeanPhaseListener.java / faces-config.xml / index.xsp

─ Requires 8.5.3 UP1, OpenNTF XPages Extension Library, or greater

Page 37: XPages Performance auf Client und Server

© 2013 IBM Corporation

Introduction to the lifecycle.nsf Application

37

Testing harness demonstrating a variety of XPages Request Processing Lifecycle use cases in a self-contained XPages application

─ Introduces Lifecycle phases and advanced use cases governed by the X-RPL

─ Uses a PhaseListener class to capture key phase entry / exit points– Allowing dynamic introspection of a request

• See: DebugBeanPhaseListener.java / faces-config.xml / index.xsp

─ Requires 8.5.3 UP1, OpenNTF XPages Extension Library, or greater

Page 38: XPages Performance auf Client und Server

© 2013 IBM Corporation

Introduction to the lifecycle.nsf Application

38

Testing harness demonstrating a variety of XPages Request Processing Lifecycle use cases in a self-contained XPages application

Domino server console or Notes client OSGi console must be available to analyze details

C:\n1\notes.exe "=C:\n1\notes.ini" -RPARAMS -console

Page 39: XPages Performance auf Client und Server

© 2013 IBM Corporation

Introduction to the lifecycle.nsf Application

39

Testing harness demonstrating a variety of XPages Request Processing Lifecycle use cases in a self-contained XPages application

Domino server console or Notes client OSGi console must be available to analyze details

C:\n1\notes.exe "=C:\n1\notes.ini" -RPARAMS -console

Page 40: XPages Performance auf Client und Server

© 2013 IBM Corporation

XPages based Application─ Runs on the Domino server or the Notes client─ An NSF needs to be installed on the Domino server / Notes client─ A profiler jar file needs to be added to the JVM launch options & JVM java.policy updated

Should be used during development / testing cycles to:─ Profile CPU performance & Memory usage (per request or periodically) / Backend usage─ Control logging of XPages Runtime loggers─ View current Threads in the nhttp process─ 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 .pdf instructions within the project download files

Using the XPages Toolbox

Page 41: XPages Performance auf Client und Server

© 2013 IBM Corporation

XPages based Application─ Runs on the Domino server or the Notes client─ An NSF needs to be installed on the Domino server / Notes client─ A profiler jar file needs to be added to the JVM launch options & JVM java.policy updated

Should be used during development / testing cycles to:─ Profile CPU performance & Memory usage (per request or periodically) / Backend usage─ Control logging of XPages Runtime loggers─ View current Threads in the nhttp process─ 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 .pdf instructions within the project download files

Using the XPages Toolbox

Page 42: XPages Performance auf Client und Server

© 2013 IBM Corporation

XPages based Application─ Runs on the Domino server or the Notes client─ An NSF needs to be installed on the Domino server / Notes client─ A profiler jar file needs to be added to the JVM launch options & JVM java.policy updated

Should be used during development / testing cycles to:─ Profile CPU performance & Memory usage (per request or periodically) / Backend usage─ Control logging of XPages Runtime loggers─ View current Threads in the nhttp process─ 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 .pdf instructions within the project download files

Using the XPages Toolbox

Page 43: XPages Performance auf Client und Server

© 2013 IBM Corporation

XPages based Application─ Runs on the Domino server or the Notes client─ An NSF needs to be installed on the Domino server / Notes client─ A profiler jar file needs to be added to the JVM launch options & JVM java.policy updated

Should be used during development / testing cycles to:─ Profile CPU performance & Memory usage (per request or periodically) / Backend usage─ Control logging of XPages Runtime loggers─ View current Threads in the nhttp process─ 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 .pdf instructions within the project download files

Using the XPages Toolbox

Page 44: XPages Performance auf Client und Server

© 2013 IBM Corporation

Session Agenda

● Understanding an XPages Request and Tooling● Best practices for Server configuration● Best practices XPiNC● Real World example

Page 45: XPages Performance auf Client und Server

© 2012 IBM Corporation

General Properties / Options for performance

notes.ini● HTTPJVMMaxHeapSizeSet=1● HTTPJVMMaxHeapSize=256M

● The Java memory allocation for the HTTP task● For servers using XPages use 256MB on 32bit machines, 1024MB on 64bit machines.

● XPagesPreload=1● XPagesPreloadDB=teamdisc.nsf/ByAuthor.xsp

● Will be covered in the XPiNC section, though also applies to the server● JavaEnableDebug=1● JavaDebugOptions=transport=dt_socket,server=y,suspend=n,address=8000● JavascriptEnableDebug=1 (in Notes/Domino 9)

● Debug has a performance degradation

Domino Administrator● HTTP server "Enable logging to" disabled● HTTP server thread count – defaults to 40.

45

Page 46: XPages Performance auf Client und Server

© 2012 IBM Corporation

Heap Size option

An XPage with a java.lang.OutOfMemoryError● Gives a heap dump

Eclipse Memory Analyzer tool and extension for IBM JVMs● IBM Diagnostic Tool Framework for Java Version 1.10 extension● Reads a heap dump

Task Manager / Process Explorer● Shows CPU usage● Shows process memory usage – not heap memory usage

Increase the heap size

Show multiple large pages give reduced performance – longer time to display

Page 47: XPages Performance auf Client und Server

© 2012 IBM Corporation

xsp.properties options

xsp.persistence.mode● Server-side control tree caching. Also the related options:● xsp.persistence.file.maxviews, xsp.persistence.file.gzip, xsp.persistence.file.threshold,

xsp.persistence.dir.xspstate xsp.application.timeout=30minxsp.session.timeout=30min

● Server timeoutsibm.jscript.cachesize

● Server-side JavaScript expression cachexsp.compress.mode=gzip

● Network files are smaller (enabled by default)xsp.resources.aggregate

● Fewer requests for CSS and JS files, aggregated files are cachedxsp.expires.global=10days

● Browser expiration for CSS & JS global files [global == not in application]

47

Page 48: XPages Performance auf Client und Server

© 2012 IBM Corporation

Persistence mode file

File system folder with persisted files● C:\Documents and Settings\username\Local Settings\Temp\notes5CC0E6

\xspstate\2\CXXTXFVP7C\*.ser

GET requests make new files, POST requests modify existing filesBehavior when cache full

● View state lost, possible data lossCreate and edit xsp.propertiesDemo session timeout of 1minute

● similar to persistence cache overflow

Page 49: XPages Performance auf Client und Server

© 2012 IBM Corporation

Limiting factors on performance● Browser / HTTP server

● Network latency – distance/time to server. Bandwidth – size of files.● Browser limits on concurrent downloads; <= IE7 allows 2 downloads, IE8 allows 6

● HTTP Server / App Server● HTTP Server JVM memory allocation (heap size) & garbage collector● CPU time, competition between threads, gives slower response times● Threads, limited to 40 by default, configurable in Domino Administrator

● App Server / Domino context● Read design elements from the NSF (XPage .class files, form structure, etc)● Backend API calls may be expensive, especially for large data sets.● Design elements may be network requests.

● Servlet / Lifecycle● Restore control tree – file system read. Control tree locking – no concurrent access.● Rendered re-evaluated for every control for most phases

● Browser/Client JavaScript/Dojo● Inline JavaScript blocks insertion of later HTML elements into the DOM tree● Dojo does AJAX requests for .js files for dojo modules that are not loaded

Page 50: XPages Performance auf Client und Server

© 2013 IBM Corporation

Session Agenda

● Understanding an XPages Request and Tooling● Best practices for Server configuration● Best practices XPiNC● Real World example

Page 51: XPages Performance auf Client und Server

© 2012 IBM Corporation

XPiNC Applications

How XPiNC works● A quick look at how XPages runs within the Notes client

51

XPiNC Challenges ...● Initial application load time● Performance issues with remote applications● Programmatic access to the desktop

… XPiNC Remedies● Application preloading● The Single Copy Design with Preload Pattern● XPiNC RunOnServer facility● The XPiNC Extensible JavaScript/Java Bridge

Page 52: XPages Performance auf Client und Server

© 2012 IBM Corporation

How XPiNC worksJust like XPages on the Domino server !

● Uses XULRunner embedded browser● Runs in local XPD Web Container● Optimized for Notes via some custom extensions

52

Page 53: XPages Performance auf Client und Server

© 2012 IBM Corporation

XPiNC Challenges & RemediesApplication Initial Load Times

● What happens when you load your 1st XPages application in a Notes session ?● XPages runtime must bootstrap

● A lot of Java class loading... ● The application launch page plus any other dependent custom controls, libraries must run

● Potentially a lot of Java class loading...● 1st application can be slow to open (cold start)● 2nd and subsequent applications are considerably faster (warm start) - why?

● XPages has been bootstrapped● Web container has been started● XULRunner has been loaded

53

Application Preloading● Simulate warm start performance through early application loading

● Preload required app(s) as soon as Notes has starts up● Bootstrapping is complete by the time user launches app for 1st time

Page 54: XPages Performance auf Client und Server

© 2012 IBM Corporation

XPiNC Challenges & RemediesPreloading Local Applications

● Enabled via NOTES.INI settings● XPagesPreload=1

● Bootstraps just the core XPages runtime● XPagesPreloadDB=db.nsf/myPage.xsp, other.nsf/myPage.xsp

● Loads specific application(s)● XPages Preload introduced in 8.5.3● Applies to both Notes client and Domino server

54

Experiment● Launch Notes client● Create new local instance of Discussion application● Set Notes launch option to allDocuments.xsp● Open application – note cold launch time● Open application – note warm launch time● Shutdown Notes● Add both preload options to NOTES.INI● Restart Notes and open application● Compare all launch times

Page 55: XPages Performance auf Client und Server

© 2012 IBM Corporation

How XPiNC runs with Remote Server

Although NSF resides on a remote server, the app alway runs in the Notes client● Incurs network overhead as everything must execute in the local XPD Web Container

55

Remote server

Page 56: XPages Performance auf Client und Server

© 2012 IBM Corporation

XPiNC Challenges & RemediesRemote Application Preloading

● Use “!!” syntax to point to apps on remote Domino server● XPagesPreloadDB=remoteServer!!db.nsf/myPage.xsp

● Design elements are preloaded by the time remote app is opened in Notes● Network traffic can be grossly inflated by sub-optimal app design practices, e.g.

● A computeWithForm prop on a Domino doc data source will pull the Form across the net● A Form element is arbitrarily large, e.g. includes all subforms and any other contained elements

● Inefficient data access operations, e.g.● Opening documents on-the-fly within a data iterator ● Performing dynamic remote NSF lookups when computing “rendered” property values

● Performance degrades even further on high latency networks

56

Experiment● Launch Notes client and open XPages application on a remote server● Add remote application to XPagesPreloadDB INI list, relaunch and re-open● Compare times with and without preloading

Page 57: XPages Performance auf Client und Server

© 2012 IBM Corporation

XPiNC Challenges & RemediesApplication Preloading + Single Copy XPages Design

● What happens when I have many instances of the same application?● XPagesPreloadDB=AppA.nsf/home.xsp, AppB.nsf/home.xsp, … AppN.nsf/home.xsp

● Not practical to constantly add and maintain NOTES.INI with new app names● All app instances share a common design …

● and it is the Design elements that we need to preload !● Can the Single Copy XPages Design feature help?

● Yes, from 8.5.3 FP3 onwards

57

Experiment● For any XPages application on a remote server, make a new local copy● File > Application > New Copy > Design Only ● Use Domino Designer to make this the Single Copy XPage Design for the remote app● Add the local SCXD copy to the XPagesPreloadDB list in NOTES.INI● Relaunch Notes and open the remote app● Observe that not only are XPages design elements preloaded …● … the resources are fetched from the local design copy – JavaScript, CSS, images etc

Page 58: XPages Performance auf Client und Server

© 2012 IBM Corporation

XPiNC Challenges & RemediesApplication Preloading + Single Copy XPages Design

● What happens when computeWithForm runs in a remote XPiNC application?● Maybe nothing bad … if the Form is reasonably lightweight (copies across net quickly)● Maybe very bad … if the aggregated Form is very large and/or your network is slow

● In Notes 9 computeWithForm operations have been optimized for XPiNC● When Single Copy XPages Design is in force, computeWithForm will load the Form locally● This is analogous to what the native Notes client does with Cache.NDK

58

Experiment● Profile a Notes app containing a large aggregate Form running on a remote server *● Create a new doc via XPages app where document data source uses computeWithForm

● “onload”, “onSave” or “both”● Create a new document ● Save the document● Analyze results – observe time spent transferring Form element from server to client● Apply Single Copy XPages Design and repeat – compare times taken for operation.

* sample demonstrated as part of Master Class course

Page 59: XPages Performance auf Client und Server

© 2012 IBM Corporation

XPiNC Challenges & Remedies

59

Experiment ● Run Java agent in local db, then swap first line to run against a remote replica

Database app = session.getCurrentDatabase(); // session.getDatabase("myServer", “remoteReplica");

Document doc = app.createDocument(); doc.replaceItemValue("Form", "frmTask"); doc.replaceItemValue("Subject", "computeWithForm operation)"); doc.replaceItemValue("Body", "Text ... ..."); long startTs = System.currentTimeMillis(); // log time before computeWithForm operation

if (doc.computeWithForm(false, false)) { long endTs = System.currentTimeMillis(); // log time after computeWithForm operation

System.out.println(Long.toString(endTs-startTs) + " millisecs (local)"); doc.save(true, true); System.out.println("document saved"); }

Application Performance – A Closer Look At computeWithForm● Examine at computeWithForm outside XPages by using a simple Java agent

Sample Results

Page 60: XPages Performance auf Client und Server

© 2012 IBM Corporation

XPiNC Challenges & Remedies

Can XPiNC applications just run on the remote XPages server and display in Notes?Yes … new feature in Notes 9

● Helps address performance issues where● XPages web application is not optimized for Notes client● Offline access is not a requirement

● Maintains XPages client look and feel ● Supports XPiNC custom behaviours

● Notes bookmarking ● Notes client context menus, e.g. Open In Designer● EnableModifiedFlag/DisableModifiedFlag

● XPiNC apps can be coded conditionally according to execution mode● Works with Notes account framework so re-authentication can be avoided

● Avoids dialogs requesting web credentials within Notes● Enables fallback to conventional XPiNC execution

60

Page 61: XPages Performance auf Client und Server

© 2012 IBM Corporation

XPiNC Challenges & Remedies

XPages RunOnServer Experiment

● Create a Notes account to enable automatic access to the server app● Account must contain server name and user credentials● Credentials can be web user name and password or leverage Domino SSO

● Select “RunOnServer” launch option in Domino Designer or Notes client● Launch application inside Notes

61

Questions● When application launches, how do you know where it's running ?● Can you write application logic that targets the Notes client only ?● Are the Notes UI customization still in place?

● Try application bookmarking, CCJS e.g. (XSP.alert()), Dirty Save...● Were you prompted for a user name and password ?● What happens when server is unavailable or account details are incorrect ?● Shut down the server http task and relaunch the application – what happens ?

Page 62: XPages Performance auf Client und Server

© 2012 IBM Corporation

XPiNC Challenges & RemediesXPiNC Client Side Scripting Model

● Need some XPiNC programmatic facility analogous to the LotusScript UI classes ?● Do your XPiNC apps need to leverage platform services on the client side?

● e.g. manipulate Notes Workspace and/or Eclipse framework● Run custom Java programs

● Very limited model available up to 8.5.3 ● Small fixed set of XSP JavaScript commands

● XSP.alert(), XSP.prompt(), XSP.publishEvent() etc● Can the existing model be securely extended to meet these needs ?

62

Experiment with Client Side JavaScript Try to...

● Update the Notes status bar with a user message ● Add a database to the Notes workspace● Enable the user to pick an NSF via the ● Close the XPiNC application window programmatically

Page 63: XPages Performance auf Client und Server

© 2013 IBM Corporation

Session Agenda

● Understanding an XPages Request and Tooling● Best practices for Server configuration● Best practices XPiNC● Real World example

Page 64: XPages Performance auf Client und Server

§ Over 65,000+ Users§ 105 Countries§ 14 different resources from PSC§ 14,000 consulting hours§ http://www.slideshare.net/MarkRoden/lessons-learned-from-the-

worlds-largest-x-page-project

The Worlds Largest? Really?

Page 65: XPages Performance auf Client und Server

§ Single page web application– Dojo– jQuery– EXTJS– Extension Library

§ Modalities – The promise of XPages• IE, IE9, Firefox• Notes – Connected & Disconnected• Mobile

• Feature Rich iPad • Handset approvals

Technical highlights

Page 66: XPages Performance auf Client und Server

§ If the application does not perform nothing else you do to it matters• Single Copy XPage design• Major XPINC performance improvement in Notes 9• Preloading of design elements for Notes client

Lesson learned: Performance

Page 67: XPages Performance auf Client und Server

§Single Copy XPages Design (SCXD) works when you have many instances of a single design

§The following example with be shown using the team room template

Performance - Single Copy XPages Design

Page 68: XPages Performance auf Client und Server

§Opening the Team Room in the notes client

Performance - SCXD

Page 69: XPages Performance auf Client und Server

§View source for a database WITHOUT SCXD

Performance - SCXD

Page 70: XPages Performance auf Client und Server

§Open the database in designer to enable Single Copy XPages design

Performance - SCXD

Page 71: XPages Performance auf Client und Server

§Open the database in designer to enable single copy XPage design

Performance - SCXD

Page 72: XPages Performance auf Client und Server

§Shut Notes and reopen the database – path to the SCXD NOT the database

Performance - SCXD

Page 73: XPages Performance auf Client und Server

§Benefits for both Notes client users and browser users§Performance increases for a user switching between many team

rooms because the resources are already cached locally§ Increased server efficiency and performance because the server

can cache those resources once and serve them to many different users regardless of the team room they are opening

§But wait….. It gets better if you are using Notes clients and IBM Notes Domino® 9 Social Edition

Performance - SCXD

Page 74: XPages Performance auf Client und Server

§Create a local replica of the SCXD

Performance - SCXD

Page 75: XPages Performance auf Client und Server

§Open the SERVER copy of the database

Performance - SCXD

Page 76: XPages Performance auf Client und Server

§The server database is now using the LOCAL resources

Performance - SCXD

Page 77: XPages Performance auf Client und Server

§ If the user accesses the database via a browser the server looks for the SCXD on the server at the path specified

§ If they use a Notes client without a local copy or replica of the SCXD then it uses the server based copy

§ If they have a local copy or replica of the SCXD they get the added benefit of large performance increases

§ If no SCXD exist it will fail gracefully§But wait again… there is yet more!

Performance - SCXD

Page 78: XPages Performance auf Client und Server

§ XPagesPreload=1§ XPagesPreloadDB=…§ Specify the local SCXD

database§ Include the page or pages to

preload when the Notes client starts

§ Those elements and any dependencies will be preloaded to greatly speed up initial open

Performance - PreLoad

Page 79: XPages Performance auf Client und Server

§How do I know if preloading is working?

§Add –RPARAMS –console to your application shortcut

§This will load the OSGI console on load of the Notes client

Performance - PreLoad

Page 80: XPages Performance auf Client und Server

Performance - PreLoad

Page 81: XPages Performance auf Client und Server

§OSGI console will show the preloading information after client load

Performance - PreLoad

Page 82: XPages Performance auf Client und Server

§ The results you get will vary greatly depending on the speed of your WAN/LAN connection

§ Our experience in the Notes client – your results may vary– 2-3 times as fast for normal operations such as opening a view or opening

a document– Up to 10 times as fast for initial database open when using preloading

Performance –Conclusions

Page 83: XPages Performance auf Client und Server

83 © 2013 IBM Corporation

Q & A

Contact Information:[email protected]

Page 84: XPages Performance auf Client und Server

© 2013 IBM Corporation

Session Agenda

● Understanding an XPages Request and Tooling● Best practices for Server configuration● Best practices XPiNC● Real World example

Page 85: XPages Performance auf Client und Server

85 © 2013 IBM Corporation

Thank You

MerciGrazie

GraciasObrigado

Danke

Japanese

French

Russian

GermanItalian

Spanish

Brazilian Portuguese

Arabic

Traditional Chinese

Simplified Chinese

Hindi

Tamil

Thai

Korean

BuíochasIrish

Page 86: XPages Performance auf Client und Server

© 2013 IBM Corporation

<xp:endOfSession/>