In our last post we looked at how to get started with the all-new XAP 12 Open Source Edition using the “hello world” example. In this post, we’ll go one step further and discuss how to take that from example to production, as well as how XAP 12 commercial editions (Premium/Enterprise) can help.
XAP 12 Implementation/Production
The hello world example is developer-oriented, but if we showed it to a dev-op, chances are a few things would come to mind, such as:
- Ease of Deployment – While the space-instance scripts can host an entire cluster, in reality you’d want each space instance to be hosted in a separate process. That means starting each space instance independently, which is somewhat tedious.
- Intelligent Placement – Randomly provisioning the instances across machines can lead to unsafe deployments. For example, it doesn’t make sense to provision the primary and backup instances of the same partition on the same machine for obvious reasons. We need a tool and/or mechanism to enforce an SLA.
- Auto-Healing – If a machine restarts or a process crashes, the backup node automatically takes over and becomes primary to maintain high-availability. However, someone needs to take care of re-provisioning the failed instance ASAP.
- Monitoring – The administrator needs a tool to visualize and monitor the deployment (view logs from various nodes, monitor memory and CPU usage, view data in the system and so on).
While developers typically may not hold such concerns as deal-breakers, enterprise organizations are unlikely to adopt a platform which does not address those issues up front. As such, we’ve developed the commercial editions of XAP (Premium and Enterprise) to address those issues using an additional platform called a Service Grid.
XAP 12 Service Grid to the Rescue
The Service Grid is a framework for provisioning and monitoring XAP services called Processing Units. A Processing Unit can contain space (data grid) instance, user code or space + user code, but for this blog let’s focus on a processing unit as a data grid packaging unit.
A processing unit can be deployed to the Service Grid using one of GigaSpaces deployment tools (UI, CLI, API), which uploads it to the Grid Service Manager (GSM), the component which manages the deployment and life-cycle of the processing unit.
The GSM analyzes the deployment descriptor and determines how many instances of the processing unit should be created, and which containers should run them. It then ships the processing unit code to the running Grid Service Containers (GSC) and instructs them to instantiate the processing unit instances.
The GSC provides an isolated runtime for the processing unit instance, and exposes its state to the GSM for monitoring. This phase in the deployment process is called provisioning.
Once provisioned, the GSM continuously monitors the processing unit instances to determine if they’re functioning properly or not. When a certain instance fails, the GSM immediately identifies it and re-provisions the failed instance onto another GSC, thus enforcing the processing unit’s SLA.
In order to discover one another in the network, the GSCs and GSMs use a Lookup Service (LUS). Each GSM and GSC registers itself in the LUS, and monitors the LUS to discover other GSM and GSC instances.
Finally, the Grid Service Agent (GSA) component is used to start and manage the other components of the Service Grid (i.e. GSC, GSM, LUS). Typically, the GSA is started with the hosting machine’s startup. Using the agent, you can bootstrap the entire cluster very easily, and start and stop additional GSCs, GSMs, and lookup services at will.
XAP 12 Management Tools and API
XAP commercial editions (Premium and Enterprise) provide the following means to interact with the Service Grid:
- Web Management Console – This visualizes the infrastructure and deployments, and lets you deploy/undeploy processing units and monitor them, as well as additional common management facilities (e.g. viewing logs, restarting components, etc.).
- Command Line Interface – Allows you to gather information on infrastructure and deployments and deploy/undeploy processing units. This is suitable for people who feel more comfortable in a command line environment, as well as automating maintenance tasks via scripts.
- Admin API – With this API you can write custom code to perform application-specific administration tasks.
XAP 12 Demo
First, let’s start the web management console. Run the gs-webui script located at XAP_HOME/bin directory. This starts a web server and automatically launches a browser to the management console (localhost:8099). Click the “Login” button to enter (no need to enter username or password, as it’s unsecured by default).
Next, run the gs-agent script from the bin folder. This will start a Lookup Service (LUS) instance, a GSM, and two GSCs. Within a few seconds you’ll see the web management console has detected those components and will show them in the hosts tab.
Now let’s deploy a partitioned space. We can do that from the web management console (via Deploy->Space…), but for the sake of the demo, let’s do it via the command line. Start the gs script located at the bin folder, and type the following command:
gs>deploy-space -cluster total_members=2,1 demo
Then switch to the web management console. Expand the GSC nodes in the tree and you’ll see they host demo space instances…
… Then switch to the “Spaces” tab and you’ll see the demo space deployed with additional details.
Now run the “hello world” example we’ve shown in the previous blog post using the demo space, and watch the web management console—you’ll see the number of entries has been changed from 0 to 2.
If you double-click the demo space row now, it’ll drill down into a more detailed view which shows each instance of the data grid (you’ll see four rows: two primaries and two backups), and you’ll see each primary contains a single entry.
You can also go to the queries tab and run a query to see the actual data, and verify that one space contains “Hello” and the other contains “World!”
And that’s all there is to it.
In this post I’ve touched upon a few strategies to get you started with XAP 12 commercial editions. Hope it’s been helpful!
Now you can go ahead and download XAP 12 Premium Edition to enjoy its many benefits, if you haven’t already.