Service instances

A service instance is the runtime equivalent of a service instantiated on a SPARKL node. When a service protocol is invoked to implement an operation, an instance of that service comes up.

Figure: Selecting node for service instantiation

As shown in Figure 1;

  1. You can control service instantiation by specifying in the service markup:
    • On which node(s) the service can be instantiated
    • A specific key, for example, the name of a user or a session ID
    Note: By default, service instantiation happens on any node that happens to be running.
  2. A service instance only comes up if there is no matching instance already up at execution time.
  3. A service instance matches if all of the following match:
    • The name of the service given at configuration time
    • The node specification - which is optional
    • A user specified key - which is optional
  4. Only a single instance is brought up even if multiple nodes are matched.

A node's domains are specified in the node's sys.config file. A node can be matched either based on its name or its domain(s).

Tip: Since nodes can share the same domains, specifying domains instead of node names gives SPARKL more flexibility in choosing where to instantiate the service.