1

Trying to get better performance out of my Xpages applications. Reading Mastering Xpages 2Ed, blogs, installed Xpages Toolbox.

One application in particular is very slow. The user sets some configuration documents that the program then loads into sessionScope variables. I use these heavily for setting up the navigation in the app.

Chapter 19 has many useful tips about performance and I am reviewing them. One guides you to rely too heavily on sessionScope variable, but use viewScope or managed beans.

Why are sessionScope variables a drag on performance and what could I use to increase performance?

Also, I am trying to use the Toolbox to profile my app and find out where the bottlenecks are, but I just don't quite get it. Should I use the CPU Profiler or the BackendP Profiler?

Any help would be greatly appreciated.

Bryan Schmiedeler
  • 2,977
  • 6
  • 35
  • 74
  • 1
    Have you seen these Master Class videos? http://www.openntf.org/main.nsf/project.xsp?r=project/xpages%20masterclass - They are all about performance and could be useful alongside the book and Toolbox – Brian Gleeson - IBM Aug 27 '15 at 14:31
  • That looks like a great resource, thank you. – Bryan Schmiedeler Aug 27 '15 at 14:32
  • If your config settings are for all users why not use application Scope? Typically any scoped variable will be fast since it is from memory. I use a managed bean with application scope for config settings (for all users) and view or session scope for a user only type variable. The XPages Toolbox is great, use the CPU profiler to start with and see where your slowness is. Then, the backend profiler can be used if your performance issues are with accessing Domino objects. – Howard Aug 27 '15 at 15:04
  • Howard, does applicationScope perform better than sessionScope? How do use a managed bean with appScope? – Bryan Schmiedeler Aug 27 '15 at 15:26
  • 1
    Performs the same but will use less memory since it is shared among all users. See http://www.tlcc.com/admin/tlccsite.nsf/pages/recorded-xpages-webinars?opendocument for our Feb, 2015 webinar on using Java with XPages/beans. We also have a class on this. – Howard Aug 27 '15 at 17:28

2 Answers2

2

I don't believe there's any real "performance" difference in the scopes - meaning the speed of pulling the data from the scope.

I used to use sessionScope all the time but now try to avoid it for other reasons. sessionScope is great for a shopping cart for instance but very bad for "application state or page state". I used to use sessionScope for different stuff and then someone would open the same app in a second tab and that would cause problems.

I've not really used the profiler much - but it's HIGH on my list. Personally I'm much more interested in the backend profiler because that should really tell me what's going on with my code - which is probably the easiest to change.

Howard just did a great performance session at the MWLug conference. You might want to find those slides. (Sorry don't have that handy) but I suspect you can find them through his company site: tlcc.com. Also, a while back there was a webinar on performance that you might find interesting. https://www.youtube.com/watch?v=OXXi6cvBxGw

David Leedy
  • 3,583
  • 18
  • 38
  • Oh, I didn't know sessionScope was particular to an individual tab. Annoying, but makes sense. – David Navarre Aug 28 '15 at 13:29
  • 1
    No. SessionScope it's particular to an indivual tab... it's for the user... But if you try to keep navigation values inside it a user doing multiple tabs can mess things up. The other thing to remember about sessionScope is it's browser session.. it's NOT user session. So you could logout, someone else can login and they might get some values from the last users browser session. You need to make sure to clear it manually. – David Leedy Aug 28 '15 at 23:28
1

You have to be careful about using sessionScope beans - they will hang around until sessions time out. I have written a little article about this based on my experience. Have a look and see if it explains well enough why - and what the alternatives are (short session timeout and keepalive functionality).

HTH

/John

John Dalsgaard
  • 2,797
  • 1
  • 14
  • 26