Service Grid Configuration Overrides

  GigaSpaces 5.X

Documentation Home
Quick Start Guide
Release Notes

Previous release

  Search Here
Searching GigaSpaces Platform 5.X Documentation

                                               

Summary: Common uses for configuration overrides and SDD overrides; using custom overrides; overrides supplied with the Service Grid.

Overview

Overrides allow you to do two things:

  • Override configuration parameters – override/extend the shipped configuration that comes with the product, without modifying the <Service Grid Root>/config/services/services.config file.
  • Override deployment descriptor parameters – override parameters in a deployment descriptor, without changing the original descriptor.

Overrides simplify the configuration process. You can use a common deployment configuration for all your services, and use configuration overrides to override only the differences in configuration between the common service and the specific services.

For example, the configuration override file provided in the Prime Computation Example, override.xml, is used to load the predefined job definition of the example. It does this by overriding the job submission resources in the Compute Grid deployment descriptor with the Prime task JAR. The Job Submission service then scans all the classes in the JAR that implement the task interface, and adds them to the list upon deployment.

Common uses of custom overrides are detailed in the following sections:

Override Syntax

<overrides>
    <!-- Configuration override -->
    <Component Name="exact component name">
		<Parameter Name="first configuration argument to override" Value="new value">
		</Parameter>
		<Parameter Name="second configuration argument to override">
			<![CDATA[
			new data...
			]]>
		</Parameter>
		...
    </Component>
    <!-- Configuration override -->
    <Component Name="exact component name">
	    ...
    </Component>
    <!-- Service Deployment Descriptor override -->
    <ServiceBean Name="exact name of service in common deployment descriptor">
		<descriptor element to override>
			<subelement to override>
				New values...
			</subelement to override>
		</descriptor element to override>
		...
    <!-- Service Deployment Descriptor override -->
    <ServiceBean Name="exact name of service in common deployment descriptor">
	    ...
    </ServiceBean>
</overrides>

Override Example

There are three overrides in the example below:

  • com.gigaspaces.start.httpPort – indicates to SystemConfig to use 9010 as the port number to start the Webster instance.
  • com.gigaspaces.start.systemProperty – adds com.gs.protocol=RMI as a system property.
  • com.gigaspaces.grid.groups – overrides the the default gs-grid group name with the name use-custom-group.
<override> 
    <component Name="com.gigaspaces.start"> 
        <parameter Name="httpPort" Value="9010"/> 
        <parameter Name="systemProperties"> 
            <![CDATA[ 
            new String[] { "com.gs.protocol", "RMI" } 
            ]]> 
        </parameter> 
    </component> 
    <component Name="com.gigaspaces.grid"> 
        <parameter Name="groups"> 
            <![CDATA[ 
            new String[] { "use-custom-group" } 
            ]]> 
        </parameter> 
    </component> 
</override>

Overrides Supplied with Service Grid

The following override files are supplied with the Service Grid, in the <Service Grid Root>/config/overrides directory:

Override File Description
sg-platform.xml Contains overrides which do the following:
  • Declare the platformJARs using only the Service Grid JARs, Jini and Ant.
  • Define the com.gs.jini_lus.groups property.
  • Declare the ServiceBeanContextFactory.
  • Add gs-space-framework.jar and JSpaces.jar to the classpath for the GSM.
windows.xml Defines measurable capabilities which do not use WinMon.dll:
  • Generic CPU measurer.
  • Flatline monitor for disk space.
spring-platform.xml Adds Spring into the SG platform, so that Spring and related JARs are not required in deployment descriptors for applications that use Spring. The override file enables classes, configs, properties and other resources necessary to use Spring, by doing the following:
  • Adding platform capabilities required to support Spring.
  • Loading all Spring JARs and dependent JARs into the common classloader.
group-override.xml Used to change the Jini discovery groups the Service Grid uses. The overrides set their respective properties to be the value of the user's account name: ${user.name}. If an alternate value is desired, change ${user.name} or add to it as needed. The following overrides are defined:
  • com.gigaspaces.start.systemProperties – defines the com.gs.jini_lus.groups property. This override is used by all Service Grid components that interact with the GigaSpaces space for discovery, creation and administration.
  • com.gigaspaces.grid.groups – configures the discovery groups which the Service Grid uses to federate itself. This group should not be confused with application-focused groups; it is used by GSCs to discover GSMs. This property is also read by the LookupHandler utility.
  • com.gigaspaces.admin.groups – sets the groups that the administrative utilities will use for discovery. This override works as follows:
    • Starting the GSC: $gsc ../config/overrides/own-group.xml
    • Starting the GSM: $gsm ../config/overrides/own-group.xml
    • Starting the Administrative UI: $gs-ui ../config/overrides/own-group.xml
    • Starting the Administrative CLI: $gs ../config/overrides/own-group.xml

Applying Overrides in Deployment

To deploy an application with an override using the Service Grid CLI:

  1. Open a console Window, cd to <Service Grid Root>/bin and type gs.
  2. Use the deploy command to deploy the application. The override file should be supplied immediately after the deployment descriptor, as follows:
    gs> deploy myDeployment-descriptor.xml myOverride.xml
    
Your custom override file need not necessarily be named override.xml. But it must be an XML file.

To deploy an application with an override using the Service Grid Admin UI:

  1. Start the Service Grid Admin UI, by executing <Service Grid Root>/bin/gs-ui.cmd
  2. Click the Deploy button (the left-most button under Service Grid Network).
  3. Select An application, as defined by a deployment descriptor and click Next.
    The following dialog is displayed:

  4. After selecting the deployment descriptor, click the Browse button next to Select Configuration Override, and browse to your custom override file.
  5. Click Next and complete the deployment wizard.
For more details on deploying an application using the Service Grid, see Developing and Deploying POJOs into Service Grid.

Common Configuration Overrides

Overriding System Properties

You can use an override to inject a custom value into a system property.

<overrides> 
    <component Name="com.gigaspaces.start"> 
        <parameter Name="systemProperties"> 
            <![CDATA[ 
            new String[] { "com.gs.jini_lus.groups", "${user.name}" } 
            ]]> 
        </parameter> 
    </component> 
</overrides>
New in GigaSpaces 5.1
The override shown above works in version 5.1 and onwards. In GigaSpaces 5.0, the component name is com.gigaspaces.admin.ui (for Admin UI) or com.gigaspaces.admin.cli (for CLI).

To add more than one system property, use the following syntax:

<parameter Name="systemProperties"> 
	<![CDATA[ 
		new String[] { "property-name-1", "value-1", 
		"property-name-2", "value-2", 
		"property-name-3", "value-3" } 
	]]> 
</parameter>

Overriding Lookup Groups for Deployed Services

You can use an override to change the default lookup group assigned to a newly deployed application.

<overrides> 
    <component Name="com.gigaspaces.admin"> 
        <parameter Name="groups"> 
            <![CDATA[ 
            new String[] { "${user.name}" } 
            ]]> 
        </parameter> 
    </component> 
</overrides>
New in GigaSpaces 5.1
The override shown above works in version 5.1 and onwards. In GigaSpaces 5.0, the component name is com.gigaspaces.admin.ui (for Admin UI) or com.gigaspaces.admin.cli (for CLI).

Making Classes in a JAR Accessible Over the Network

The following configuration override directs the Service Grid to add an additional directory to the HTTP server, allowing the classes in a certain JAR, prime-job.jar in the example below, to be accessible over the network.

This argument overrides the bootstrapping service, and therefore becomes effective only during bootstrapping of the application.
<overrides>
    <Component Name="com.gigaspaces.start">
        <Parameter Name="addHttpRoots">
            <![CDATA[
               "${com.gigaspaces.grid.home}examples${/}prime${/}lib"
             ]]>
        </Parameter>
    </Component>
</overrides>

Starting GSM, GSC and Service Grid Admin UI using specific group

You might want to have different deployment environments as part of your organization network, for example, development, QA, staging, and production environments. Each should have isolated GSMs and GSCs. Use the group attribute to segregate these.

To start the GSM, GSC, and Service Grid Admin UI using a specific group:

  1. Generate an override with your desired group with the group-override.xml file:
    <overrides>
        <component Name="com.gigaspaces.start">
            <parameter Name="systemProperties">
                <![CDATA[
    	    new String[] { "com.gs.jini_lus.groups", "myGroup" }
                ]]>
            </parameter>
        </component>
    
        <component Name="com.gigaspaces.grid">
            <parameter Name="groups">
                <![CDATA[
    	    new String[] { "myGroup" }
                ]]>
            </parameter>
        </component>
    
        <component Name="com.gigaspaces.admin">
            <parameter Name="groups">
                <![CDATA[
    	    new String[] { "myGroup" }
                ]]>
            </parameter>
        </component>
    
    </overrides>
  2. Start a GSM with the group-override.xml file:
    gsm group-override.xml
  3. Start a GSC with the group-override.xml file:
    gsc group-override.xml
  4. Start the Service Grid Admin UI with the group-override.xml file:
    gs-ui group-override.xml

Overriding Startup Port for GSC & GSM

The following override allows you to set a custom port for the GSC and GSM, so that this port is used each time you start the Service Grid.

If you set a custom codebase port in a Deployment Descriptor, using the override below means you don't have to verify the codebase URL each time you deploy your application.
<overrides>
    <Component Name="com.gigaspaces.start">
        <Parameter Name="httpPort" Value="9010" />
    </Component>
</overrides>

Common Deployment Descriptor Overrides

Overriding Scaling Policy

The following example overrides the default setting for the scaling policy, and sets it to a maximum of 4 instances, instead of the default – 3.

<overrides>
     <ServiceBean Name="Job Submission" >
         <MaxPerMachine>4</MaxPerMachine>
         <ServiceLevelAgreements>
         <SLA ID="CPU">
             <Configuration>
                 <Component
Name="org.jini.rio.qos.ScalingPolicyHandler">
                     <Parameter Name="MaxServices" Value="3" />
                 </Component>
             </Configuration>
         </SLA>
     </ServiceLevelAgreements>
     </ServiceBean>
</overrides>

Overriding Service Name & Scaling Policy

<ServiceBean Name="GigaSpace" NewName="NewService">
	<ServiceLevelAgreements>
		<SLA ID="CPU">
			<Configuration>
				<Component Name="org.jini.rio.qos.ScalingPolicyHandler">
					<Parameter Name="MaxServices" Value="50"/>
				</Component>
		</Configuration>
		</SLA>
	</ServiceLevelAgreements>
</ServiceBean>

Using Overrides to Append JARs to Existing Services

This example is part of the prime number computation example, which comes with the Compute Grid. The first configuration element augments the Job Submission services classpath and codebase to add the classes that are part of the Prime demo.

<overrides>
    <!--
    Augment the Job Submission services classpath and codebase with prime-job.jar
    -->
    <ServiceBean Name="Job Submission">
        <Interfaces>
            <Interface>com.gigaspaces.grid.master.JobSubmission</Interface>
                <Resources>
                    <JAR>prime-job.jar</JAR>
                </Resources>
        </Interfaces>
       <ImplementationClass>com.gigaspaces.grid.master.JobSubmissionImpl
            <Resources>
                <JAR>prime-job.jar</JAR>
            </Resources>
       </ImplementationClass>
    </ServiceBean>
    <!--
    Make prime-job.jar accessible to the HTTP server, and have the HTTP server start
    using port 9010
    -->
    <Component Name="com.gigaspaces.start">
        <Parameter Name="addHttpRoots">
            <![CDATA[
               "${com.gigaspaces.grid.home}examples${/}prime${/}lib"
             ]]>
        </Parameter>
        <Parameter Name="httpPort" Value="9010" />
    </Component>
</overrides>

Wiki Content Tree


Your Feedback Needed!

We need your help to improve this wiki site. If you have any suggestions or corrections, write to us at techw@gigaspaces.com. Please provide a link to the wiki page you are referring to.

Labels