WAN Gateway Pass Through Replication
Download |
---|
WAN gateway pass-through example |
Overview
The WAN gateway allows for the implementation of a pass-through replication topology across clusters of Space Where GigaSpaces data is stored. It is the logical cache that holds data objects in memory and might also hold them in layered in tiering. Data is hosted from multiple SoRs, consolidated as a unified data model. instances. In this architecture, a site may act as an intermediary for delegating replication requests across two or more other sites. For instance, given three clusters in New York, London, and Hong Kong, there might be bandwidth or connectivity issues between Hong Kong and New York, thereby requiring London to be used as a pass-through site. Such replication behavior may be specified using the indirect delegation feature. The sample Processing Units This is the unit of packaging and deployment in the GigaSpaces Data Grid, and is essentially the main GigaSpaces service. The Processing Unit (PU) itself is typically deployed onto the Service Grid. When a Processing Unit is deployed, a Processing Unit instance is the actual runtime entity. and configuration described below are an example of implementing a pass-through topology across three sites: New York (US), London (GB), and Hong Kong (HK), where each site has an independent cluster and a gateway.
The demo is configured to start three Space instances across three clusters. While the three clusters run on your local machine, they are demarcated by zones and different lookup service ports as follows:
Gateway/Space | Zone | Lookup Service Port |
---|---|---|
wan-gateway-HK | HK | 4166 |
wan-space-HK | HK | 4166 |
wan-gateway-US | US | 4266 |
wan-space-US | US | 4266 |
wan-gateway-GB | GB | 4366 |
wan-space-GB | GB | 4366 |
The internal architecture of the setup includes a clustered Space and a Ggateway, where each Ggateway includes a Ddelegator and a sink (click the thumbnail to enlarge):
As a result of indirect delegation, the following scenario occurs after updates are written to the New York Space:
- All updates performed on the New York cluster are sent to the local delegator.
- The delegator directs Hong Kong traffic to London.
- The London sink in turn pushes the updates to the Hong Kong sink.
- The Hong Kong sink applies the updates on the local cluster.
Configuring Indirect Delegation
The pass-through topology configuration is implemented through delegators across Hong Kong and New York that are routed via London. This is achieved by setting the delegate-through property to London for delegation targets in Hong Kong and New York. The HK and US do not need gateway lookups against each other in their configuration:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:os-core="http://www.openspaces.org/schema/core" xmlns:os-events="http://www.openspaces.org/schema/events"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:os-remoting="http://www.openspaces.org/schema/remoting"
xmlns:os-gateway="http://www.openspaces.org/schema/core/gateway"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.openspaces.org/schema/core http://www.openspaces.org/schema/<MadCap:variable name="Versions.product-version-short" />/core/openspaces-core.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.openspaces.org/schema/events http://www.openspaces.org/schema/events/openspaces-events.xsd
http://www.openspaces.org/schema/core/gateway http://www.openspaces.org/schema/<MadCap:variable name="Versions.product-version-short" />/core/gateway/openspaces-gateway.xsd
http://www.openspaces.org/schema/remoting http://www.openspaces.org/schema/remoting/openspaces-remoting.xsd">
<context:annotation-config></context:annotation-config>
<tx:annotation-driven transaction-manager="transactionManager" />
<os-core:distributed-tx-manager id="transactionManager" />
<!-- Enable support for @Polling annotation -->
<os-events:annotation-support />
<os-core:embedded-space id="space" name="wanSpaceUS" gateway-targets="gatewayTargets" />
<os-core:giga-space id="gigaSpace" space="space" />
<os-core:giga-space-context />
<os-gateway:targets id="gatewayTargets" local-gateway-name="US">
<os-gateway:target name="GB" />
<os-gateway:target name="HK" />
</os-gateway:targets>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:os-gateway="http://www.openspaces.org/schema/core/gateway"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.openspaces.org/schema/core/gateway
http://www.openspaces.org/schema/<MadCap:variable name="Versions.product-version-short" />/core/gateway/openspaces-gateway.xsd">
<os-gateway:delegator id="delegator" local-gateway-name="US" gateway-lookups="gatewayLookups">
<!-- <os-gateway:delegation target="DE"/> -->
<os-gateway:delegation target="HK" delegate-through="GB" />
</os-gateway:delegator>
<os-gateway:sink id="sink" local-gateway-name="US" gateway-lookups="gatewayLookups"
local-space-url="jini://*/*/wanSpaceUS">
<os-gateway:sources>
<os-gateway:source name="HK"/>
<os-gateway:source name="GB"/>
</os-gateway:sources>
</os-gateway:sink>
<os-gateway:lookups id="gatewayLookups">
<os-gateway:lookup gateway-name="US" host="localhost" discovery-port="10768" communication-port="7000"/>
<os-gateway:lookup gateway-name="GB" host="localhost" discovery-port="10769" communication-port="8000"/>
</os-gateway:lookups>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:os-core="http://www.openspaces.org/schema/core" xmlns:os-events="http://www.openspaces.org/schema/events"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:os-remoting="http://www.openspaces.org/schema/remoting"
xmlns:os-gateway="http://www.openspaces.org/schema/core/gateway"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.openspaces.org/schema/core http://www.openspaces.org/schema/<MadCap:variable name="Versions.product-version-short" />/core/openspaces-core.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.openspaces.org/schema/events http://www.openspaces.org/schema/events/openspaces-events.xsd
http://www.openspaces.org/schema/core/gateway http://www.openspaces.org/schema/<MadCap:variable name="Versions.product-version-short" />/core/gateway/openspaces-gateway.xsd
http://www.openspaces.org/schema/remoting http://www.openspaces.org/schema/remoting/openspaces-remoting.xsd">
<context:annotation-config></context:annotation-config>
<tx:annotation-driven transaction-manager="transactionManager" />
<os-core:distributed-tx-manager id="transactionManager" />
<!-- Enable support for @Polling annotation -->
<os-events:annotation-support />
<os-core:embedded-space id="space" name="wanSpaceGB" gateway-targets="gatewayTargets" />
<os-core:giga-space id="gigaSpace" space="space" />
<os-core:giga-space-context />
<os-gateway:targets id="gatewayTargets" local-gateway-name="GB">
<os-gateway:target name="US"/>
<os-gateway:target name="HK"/>
</os-gateway:targets>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:os-gateway="http://www.openspaces.org/schema/core/gateway"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.openspaces.org/schema/core/gateway
http://www.openspaces.org/schema/<MadCap:variable name="Versions.product-version-short" />/core/gateway/openspaces-gateway.xsd">
<os-gateway:delegator id="delegator" local-gateway-name="GB" gateway-lookups="gatewayLookups">
<os-gateway:delegation target="US"/>
<os-gateway:delegation target="HK"/>
</os-gateway:delegator>
<os-gateway:sink id="sink" local-gateway-name="GB" gateway-lookups="gatewayLookups"
local-space-url="jini://*/*/wanSpaceGB">
<os-gateway:sources>
<os-gateway:source name="US"/>
<os-gateway:source name="HK"/>
</os-gateway:sources>
</os-gateway:sink>
<os-gateway:lookups id="gatewayLookups">
<os-gateway:lookup gateway-name="US" host="localhost" discovery-port="10768" communication-port="7000"/>
<os-gateway:lookup gateway-name="GB" host="localhost" discovery-port="10769" communication-port="8000"/>
<os-gateway:lookup gateway-name="HK" host="localhost" discovery-port="10770" communication-port="9000"/>
</os-gateway:lookups>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:os-core="http://www.openspaces.org/schema/core" xmlns:os-events="http://www.openspaces.org/schema/events"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:os-remoting="http://www.openspaces.org/schema/remoting"
xmlns:os-gateway="http://www.openspaces.org/schema/core/gateway"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.openspaces.org/schema/core http://www.openspaces.org/schema/<MadCap:variable name="Versions.product-version-short" />/core/openspaces-core.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.openspaces.org/schema/events http://www.openspaces.org/schema/events/openspaces-events.xsd
http://www.openspaces.org/schema/core/gateway http://www.openspaces.org/schema/<MadCap:variable name="Versions.product-version-short" />/core/gateway/openspaces-gateway.xsd
http://www.openspaces.org/schema/remoting http://www.openspaces.org/schema/remoting/openspaces-remoting.xsd">
<context:annotation-config></context:annotation-config>
<tx:annotation-driven transaction-manager="transactionManager" />
<os-core:distributed-tx-manager id="transactionManager" />
<!-- Enable support for @Polling annotation -->
<os-events:annotation-support />
<os-core:embedded-space id="space" name="wanSpaceHK" gateway-targets="gatewayTargets" />
<os-core:giga-space id="gigaSpace" space="space" />
<os-core:giga-space-context />
<os-remoting:annotation-support />
<os-gateway:targets id="gatewayTargets" local-gateway-name="HK">
<os-gateway:target name="US" />
<os-gateway:target name="GB" />
</os-gateway:targets>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:os-gateway="http://www.openspaces.org/schema/core/gateway"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.openspaces.org/schema/core/gateway
http://www.openspaces.org/schema/<MadCap:variable name="Versions.product-version-short" />/core/gateway/openspaces-gateway.xsd">
<os-gateway:delegator id="delegator" local-gateway-name="HK" gateway-lookups="gatewayLookups">
<os-gateway:delegation target="US" delegate-through="GB" />
</os-gateway:delegator>
<os-gateway:sink id="sink" local-gateway-name="HK" gateway-lookups="gatewayLookups"
local-space-url="jini://*/*/wanSpaceHK">
<os-gateway:sources>
<os-gateway:source name="US"/>
</os-gateway:sources>
</os-gateway:sink>
<os-gateway:lookups id="gatewayLookups">
<os-gateway:lookup gateway-name="GB" host="localhost" discovery-port="10769" communication-port="8000"/>
<os-gateway:lookup gateway-name="HK" host="localhost" discovery-port="10770" communication-port="9000"/>
</os-gateway:lookups>
</beans>
Installing and Running the Example
- Download the example. It includes two folders: deploy and scripts.
- Copy the contents of the deploy folder to the
\$GS_HOME\deploy
folder. - Extract the
scripts
folder to an arbitrary location and edit thesetExampleEnv.bat/sh
script to include the machine IP address forNIC_ADDR
and the GigaSpaces root folder location for$GS_HOME
.
The scripts
folder contains the necessary scripts to start the Grid Service Agent for each cluster, in addition to a deploy script deployAll.bat/sh
that is used to automate the deployment of all three gateways and Space instances. This allows you to run the entire setup on one machine to simplify testing. Here are the steps to run the example:
- Run
startAgent-GB.bat/sh
or to start GB site. - Run
startAgent-HK.bat/sh
to start HK site. - Run
startAgent-US.bat/sh
to start US site. - Run
deployAll.bat/sh
file to deploy all the Processing Units listed above.
Viewing the Clusters
- Start the GigaSpaces Management Center and configure the appropriate lookup groups in the Group Management" window.
-
After all clusters are up and running, you must enable the relative groups:
-
Check to enable all three advertised groups for each site:
As a result, you should see the service grid components for each site displayed under the "Hosts" tree as follows:
-
After the
deployAll.bat/sh
script finishes running, you should be able to see all three sites deployed as follows:
Testing the Pass-Through Replication
You can test the setup using the benchmark utility that comes with the GigaSpaces Management Center. Select one of the HK or US Benchmark icons and click Start to begin writing objects to the Space:
Click the Spaces icon in the Space Browser tTab to get a global view of Spaces. As objects are written, you should see replication occurring across both the HK and US sites until there are 5000 objects in each Space. The GB site is a pass-through, so the object count should remain zero:
You can also utilize the Take operation and click Start to remove objects from either the HK or US Space. As a result, you will see the object count reaching zero across both HK and US as the pass-through replication takes place: