@ the eXtreme

RSS

Creating dynamic global indexes

If you need to efficiently access an object or set of objects in eXtreme Scale 8.6 or XC10 2.5, a global index is one of the best ways to accomplish the task. Creating and using a global index is relatively straightforward:

               HashIndex globalIndex = new HashIndex();
               globalIndex.setName("productCodeGI");
               globalIndex.setAttributeName("productCode");
               globalIndex.setRangeIndex(false);
               globalIndex.setGlobalIndexEnabled(true);
               getObjectGrid().getMap("test").createDynamicIndex(
                          globalIndex,null);

The above code creates a global index named productCodeGI which is index the field name productCode on inserted objects in the map named test. To use the index to find all keys with productCode==2

        MapGlobalIndex codeGlobalIndex = 
                    (MapGlobalIndex) map.getIndex("productCodeGI");
        Set s = codeGlobalIndex.findKeys(new Integer(2));

More information on the operations available on the global index are in the javadoc here

The use of the global index can significantly speed up access for secondary attributes since the global index can be consulted to find out which partitions contain key-value pairs that match the search condition. This could reduce your RPCs from 100s to 2 (in the case only 1 partition has an object matching the condition).

May 8

Virtual XC10 Appliance now available for developers

The WebSphere DataPower XC10 Virtual Appliance is now available for download for free use by developers. This is an extremely easy way to get an eXtreme Scale Data Grid running. Virtual XC10

WebSphere eXtreme Scale 8.6 is GA

A little bit late, but WXS 8.6 became generally available at the end of November. (http://www-01.ibm.com/support/docview.wss?uid=swg21618394)

Integrating eXtreme Scale and WebSphere Commerce

A nice article written by our eXtreme Scale and WebSphere Commerce experts. (http://www.ibm.com/developerworks/library/co-wxs-dynamic-cache/index.html)

Sep 4

WebSphere eXtreme Scale 8.6 Beta

The WXS 8.6 Beta is now open. You can download the driver from here:

WXS 8.6 Beta

The following key features are included in this Beta program:

  • Enterprise data grid – With enterprise data grid capabilities, both .NET clients and Java clients can have the same high speed, native access to the data grid.

  • Near cache invalidation - Enhancements to the near cache allow you to invalidate stale data. When an update, deletion, or invalidation operation is run against the remote data grid, an asynchronous invalidation gets triggered in the near cache. You can also configure the near cache to propagate time-to-live (TTL) read operations to the remote data grid, which prevents cache entries from getting prematurely evicted from the remote data grid.

  • Continuous query – When you develop client applications that interact with the data grid, you might require queries that retrieve automatic, real-time results when new entries are inserted or updated. You can use continuous query to be notified in your client Java virtual machine (JVM) when data is inserted or updated in the data grid. This feature makes grid and data management easier for developers and administrators.

  • Message center - These enhancements allow users the ability to monitor eXtreme Scale critical events with a JMX powered message center.

  • Xscmd utility updates - New commands have been added for health checking, replication status, and placement.

  • Multi-partition transactions - With this feature, you can write to multiple partitions in a single local transaction.

Setting ORB LocalHost on development machines

If you are using WXS Agents or COPY_TO_BYTES mode, you have may hit the problem of having the grid fail to make a callback to your client machine due to changing IP addresses, VPNs, etc. To help solve this callback issue, you can embed the following code snippet into your client code before connecting to the grid and initializing the ORB. This will cause the ORB to use the IP address you specify as the callback address. Adjust the code to match against your companies corporate subnet.

public static void setORBLocalHost() {
    String targetNetwork="9."; // use your companies network
    try {
       Enumeration<NetworkInterface> eni = 
                     NetworkInterface.getNetworkInterfaces();
       while (eni.hasMoreElements()) {
          NetworkInterface ni = eni.nextElement();
          Enumeration<InetAddress> eia = ni.getInetAddresses();
          while (eia.hasMoreElements()) {
             InetAddress ia = eia.nextElement();
             if (ia.getHostAddress().startsWith(targetNetwork)) {
               System.out.println("setting ORB LocalHost = "+
                               ia.getHostAddress());
               System.setProperty("com.ibm.CORBA.LocalHost",
                               ia.getHostAddress());
               return;
             }
          } 
       }
    } catch (SocketException se) {
    }
    System.out.println("no matching address to set ORB LocalHost");
}

Data Grids and Caching - IBM vs Oracle

An article written by another IBMer comparing the cost of ownership of WXS vs Oracle Coherence. Find the article here

Enhancing WebSphere Portal with WXS

My colleague Ben Parees has written a nice article describing the benefits that can be obtained by combining WXS with WebSphere Portal to offload the WebSphere Content Manager DynaCache instance into WXS. Check it out here

WXS 8.5 Resource Adapter

WebSphere eXtreme Scale 8.5 shipped a new JCA resource adapter that nows enables WXS to enlist in WAS global transactions. The general interaction pattern with WXS is the same as before, except you need to obtain your WXS session from a connection pool so that the transaction will enlist with the WAS transaction manager. WXS’s resource adapter is a 1PC resource that can act as the last participant in a 2PC transaction. Here is a code snippet that illustrates the use of the resource adapter with a globally managed transaction:

        // at initialization time, lookup the connection factory
        // and store away for later use
        InitialContext ctx = new InitialContext();
        cf = (ConnectionFactory)ctx.lookup(CF_JNDI_NAME);

        //example of a container managed transaction
        Connection conn = cf.getConnection();
        Session session = ((XSConnection)conn).getSession();
        ObjectMap  map = session.getMap(MAP_NAME);
        map.insert(key, value); 
        conn.close();

A complete scenario is documented in the WXS 8.5 InfoCenter

May 7

A quick tutorial on using LDAP authentication with WXS

To enable your WXS servers and Catalog servers for LDAP authentication with a JAAS policy file used for authorization.   Follow the basic steps below:

1) Create a file wxs_ldap.config with the following contents:

LDAPLogin {      com.ibm.websphere.objectgrid.security.plugins.builtins.LDAPLoginModule required      providerURL=”ldap://yourldapserver.yourcompany.com:389/”      factoryClass=”com.sun.jndi.ldap.LdapCtxFactory”  }; 

2) Create a file wxs_ldap_auth.config with the following contents: (replace the principal with the user that will login to the grid and YourGridName with the name of your grid).  Repeat as necessary for more users/grids.


grant codebase “http://www.ibm.com/com/ibm/ws/objectgrid/security/PrivilegedAction”
    principal javax.security.auth.x500.X500Principal “CN=manager,O=acme,OU=sample” {
    permission com.ibm.websphere.objectgrid.security.MapPermission “YourGridName.*”, “all”;

    permission com.ibm.websphere.objectgrid.security.ObjectGridPermission “YourGridName”, “all”;
};

Alternatively, to grant permission to all grids:

grant codebase “http://www.ibm.com/com/ibm/ws/objectgrid/security/PrivilegedAction”
    principal javax.security.auth.x500.X500Principal “CN=manager,O=acme,OU=sample” {
    permission com.ibm.websphere.objectgrid.security.MapPermission “*”, “all”;

    permission com.ibm.websphere.objectgrid.security.ObjectGridPermission “*”, “all”;
};

3) Create a server side security.xml with the following contents:

`<?xml version=”1.0” encoding=”UTF-8”?>
<securityConfig xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
    xsi:schemaLocation=”http://ibm.com/ws/objectgrid/config/security ../objectGridSecurity.xsd”
xmlns=”http://ibm.com/ws/objectgrid/config/security”>
<security securityEnabled=”true” loginSessionExpirationTime=”300” >     
        <authenticator className =”com.ibm.websphere.objectgrid.security.plugins.builtins.LDAPAuthenticator”>
        </authenticator>
    </security>
</securityConfig>`

4) Edit your objectGridServer.properties to have the following properties:

   securityEnabled=true

   credentialAuthentication=Required

   transportType=TCP/IP    

   singleSignOnEnabled=false

   secureTokenManagerType=none

5) Start your catalog servers

startOgServer.sh catalogServer -clusterSecurityFile /security/security.xml
-serverProps /security/objectGridServer.properties -jvmArgs
-Djava.security.auth.login.config=”/security/wxs_ldap.config”

-Djava.security.auth.policy=”/security/wxs_ldap_auth.config”

6) Start your containers

startOgServer.sh c0 -objectgridFile /xml/objectgrid.xml
-deploymentPolicyFile /xml/deployment.xml
-catalogServiceEndPoints cataloghostname:2809 
-serverProps /security/objectGridServer.properties
-jvmArgs -Djava.security.auth.login.config=”/security/wxs_ldap.config”

-Djava.security.auth.policy=”/security/wxs_ldap_auth.config”

7) Edit your client side objectGridClient.properties (in WebSphere: <was_profile_dir>/properties)

   securityEnabled=true

   credentialAuthentication=Supported

   transportType=TCP/IP    

   singleSignOnEnabled=false

8) Modify your client application to pass the required LDAP Login credentials.

String userid = “CN=manager,O=acme,OU=sample”;

String pw=”password”; 

// Creates a ClientSecurityConfiguration object using the specified file

ClientSecurityConfiguration clientSC = ClientSecurityConfigurationFactory

                .getClientSecurityConfiguration(args[0]);
       
        // Creates a CredentialGenerator using the passed-in user and password.
        CredentialGenerator credGen = new UserPasswordCredentialGenerator(userid,password);
        clientSC.setCredentialGenerator(credGen);
       
        // Create an ObjectGrid by connecting to the catalog server
        ClientClusterContext ccContext = ogManager.connect(“cataloghostname:2809”, clientSC, null);
        ObjectGrid og = ogManager.getObjectGrid(ccContext, “YourGridName”);’