Comparing XPages to Java agents
Although you really cannot compare an XPage to a Java agent because of their different capabilities, understanding the underlying class loaders gives you a general feel for the performance. In a Java agent, there is a class loader per class each time the agent is called. This means that even if you request the same Java agent multiple times, there is no advantage gained the second time the agent is called. Also, if the agent references multiple libraries, those libraries must be loaded each time. Therefore, a Java agent with multiple libraries does not perform as well as a Java agent with all the code in a single class. But, even the Java agent with all the code in a single class is loaded every time that agent is called.
In XPages, there is a single class loader per instance of the application. It holds the classes in memory until the database times out (a period of time after the last user has referenced the application). This means that multiple users of the same application get a performance gain by sharing the class loader. If you are trying to decide between doing coding in a Java agent or an XPage, you should choose the XPage.
Starting in Domino 8.5.2, there is an external servlet engine used by the Domino server. This servlet engine performs very well. If you can take advantage of creating servlets to be used by Domino, this can help your performance because of how servlets are loaded and maintained in memory.
You can gain performance improvements by taking advantage of web services too. By using a web service, the amount of code you send to the client is reduced and the logic happens on the server.
Parent topic: 4.0 Coding techniques