serverExecution Option
The serverExecution method option indicates that the method and all methods subsequently called by this method are to be executed on the server node unless they are clientExecution methods, in which case they are executed on the node of the client calling the method. This method option provides performance benefits when a method accesses a large number of objects in multiuser mode, as the methods are executed on the node in which the objects reside instead of the required objects having to be passed to the client node for execution.
The method in the following example iterates through 5,000 entries in the Number collection and executes using the serverExecution method option.
executeOnServer() updating, serverExecution; vars num : Number; begin // This method should take less time to execute than the same method // executing using the clientExecution option. When this method was // tested on a presentation client running in Jade thin client mode, // it took only 1.602 seconds to execute. beginTransaction; foreach num in numbers do num.key := 0; endforeach; commitTransaction; end;
See also "Server and Client Execution Restrictions", later in this chapter, and the example under "clientExecution Option", earlier in this chapter.
As the server node has its own private cache used by server execution methods, which is separate from the shared database cache, the edition of an object that is fetched from this private cache may not be the latest.