Attribute store over IBM WebSphere eXtreme Scale

To support session-independent mode, you can cache authentication context by using eXtreme Scale.

About this task

Instructions are provided here for configuring an IBM MobileFirst™ Platform Server cluster to work with eXtreme Scale (Figure 1). It also provides instructions for persisting the cached data to relational and non-relational stores by using the Loader plug-ins that are provided with the product (see Figure 2 and Figure 3).

For more information about session-independent mode, see Session-independent mode.

Figure 1. Attribute store over eXtreme Scale
Shows attribute store over eXtreme Scale.

eXtreme Scale Grid Definition

About this task

In the eXtreme Scale server, define a dedicated object grid and a backing map for usage of the attribute store table in IBM MobileFirst Platform Server. The recommended eXtreme Scale configurations are described in detail in the WebSphere® eXtreme Scale V8.6 Knowledge Center.

Procedure

In the objectgrid.xml file, define a dedicated object grid and backing map. Here is an example:
<?xml version="1.0" encoding="UTF-8"?>
<objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd"
 xmlns="http://ibm.com/ws/objectgrid/config">

  <objectGrids>
    <objectGrid name="MFPGrid" txTimeout="30">
    <backingMap name="AttrStoreMap" copyMode="COPY_TO_BYTES"
        lockStrategy="PESSIMISTIC"
        nullValuesSupported="true" ttlEvictorType="LAST_ACCESS_TIME" timeToLive="10" nearCacheEnabled="false" />
    </objectGrid>
  </objectGrids>
</objectGridConfig>

Optionally, the map can be configured to use a Loader plug-in that persists the data. For more information, see Persisting the eXtreme Scale cache to the IBM MobileFirst Platform Server relational database.

IBM MobileFirst Platform Server configuration

About this task

In configuring IBM MobileFirst Platform Server, you must define several configuration properties that contain the eXtreme Scale connection parameters and add the eXtreme Scale client library JAR file to the class path.

Procedure

  1. Define the following properties in the worklight.properties file or by using JNDI:
    //Enable session independent mode
    mfp.session.independent=true
    
    //Indicates attribute store must be cached in eXtreme Scale
    mfp.attrStore.type=eXtremeScale
    
    //A comma-separated list of host-port pairs of the WebSphere eXtreme Scale catalog servers, in the form: "host:port".
    mfp.attrStore.xs.endpoint=9.111.27.160:2809
     
    //The user name and password for connecting to the eXtreme Scale server.  Leave empty if authentication is not required.
    mfp.attrStore.xs.username=   
    mfp.attrStore.xs.password=
    
    //The names of the grid and backing map for the attribute store, as defined in objectgrid.xml 
    mfp.attrStore.xs.gridname=MFPGrid  
    mfp.attrStore.xs.mapname=AttrStoreMap
  2. Add the eXtreme Scale client library JAR file to the class path of your MobileFirst project runtime application. For Liberty Profile, use ogclient.jar and for WebSphere Application Server, use wsogclient.jar. Both JAR files are in the eXtreme Scale installation folder, which is at <eXtreme Scale_install_folder>\ObjectGrid\lib by default.
    • In Liberty
      1. Create a folder WXS under the Liberty shared resources folder and copy the JAR file to that folder.
      2. Add the location of the JAR file to the class loader configuration of your MobileFirst project.
        <!-- Declare the IBM Worklight project runtime application. -->
        <application id="worklight" name="worklight" location="worklight.war" type="war">
            <classloader delegation="parentLast">
                <privateLibrary id="worklightlib_worklight">
                    <fileset dir="${shared.resource.dir}/worklight/lib" includes="worklight-jee-library.jar"/>
                    <fileset dir="${wlp.install.dir}/lib" includes="com.ibm.ws.crypto.passwordutil_*.jar"/>
                    <fileset dir="${shared.resource.dir}/WXS" includes="ogclient.jar"/>
                </privateLibrary>
            </classloader>
        </application>
      Note: When you use eXtreme Scale client with the IBM MobileFirst Platform Server, a known JMX connection issue prevents the use of Oracle JDK. Use IBM® JDK, as follows:
      1. In the IBM MobileFirst Platform Server folder, for example: /opt/IBM/WebSphere/Liberty/usr/servers/<my_username>, edit the jvm.options file so that it contains the following lines. Replace the yourServerName folder with the one in your setup:
        -Dcom.ibm.ws.jmx.connector.client.rest.readTimeout=180000
        -Djavax.net.ssl.trustStore=/opt/IBM/WebSphere/Liberty/usr/servers/<yourServerName>/resources/security/key.jks
        -Djavax.net.ssl.trustStorePassword=worklight
        -Djavax.net.ssl.trustStoreType=jks
        -Djava.security.properties=./java.security.props
      2. In the same folder as the server.xml file, create a new file, java.security.props that contains the following two lines. Note that each SSL key has an empty value.
        ssl.SocketFactory.provider=
        ssl.ServerSocketFactory.provider=
    • In WebSphere Application Server full profile:

      Copy the eXtreme Scale JAR file, wsogclient.jar to a local folder and add the path of this JAR file to the class path that is defined in the WL_PLATFORM_LIB shared library.

Persisting the eXtreme Scale cache to the IBM MobileFirst Platform Server relational database

About this task

eXtreme Scale can back up its data to a relational database with a Loader plug-in. For more information about eXtreme Scale and loaders, see Plug-ins for communicating with databases.

In the configuration that is described in this section, the built-in MobileFirst relational database Loader is used to back up eXtreme Scale data to the IBM MobileFirst Platform Server SQL database.

Figure 2. Attribute store over eXtreme Scale with SQL Loader plug-in
Shows attribute store over eXtreme Scale with SQL plug-in
Note: IBM MobileFirst Platform Server also provides a default write-behind Loader plug-in for backing up eXtreme Scale data with Cloudant®. For more information about configuring Cloudant as your database, see Persisting the eXtreme Scale cache to Cloudant.

Procedure

  1. Find the Loader JAR file, mfp-xs-loader.jar in your MobileFirst Server installation folder. By default, it is in <mfp_install_dir>/WorklightServer/external-server-libraries.
  2. Extract the meta-inf/persistence.xml file from the JAR file and replace the <properties> tag in the file according to the following example. This example applies to a DB2® database. For other types of database like MySQL or Oracle, you must change the driver class name to the class name for your database type.
    <properties>
       <property name="openjpa.ConnectionProperties" value="DriverClassName=com.ibm.db2.jcc.DB2Driver,
          Url=jdbc:db2://database_host_name:database_port/database_name, MaxActive=100, MaxWait=10000, TestOnBorrow=true,
          Username=database_user_ID, Password=databse_user_password"/>
       <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
    </properties>
    Replace database_host_name, database_port, database_name, database_user_ID, and databse_user_password with values for your database.
  3. Repackage the JAR file.
    Note: As an alternative to providing these parameters in persistence.xml, you can override the parameters when you start the eXtreme Scale Server by using JVM arguments.
  4. Add the mfp-xs-loader.jar to the classpath of your eXtreme Scale deployment.
  5. Add the database driver JAR file to the classpath of your eXtreme Scale deployment.
  6. In objectgrid.xml, add an entry with className="com.worklight.core.persistence.xs.AttributeStoreDBLoader" for backingMapPluginCollection
    <?xml version="1.0" encoding="UTF-8"?>
    <objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd"
     xmlns="http://ibm.com/ws/objectgrid/config">
    
      <objectGrids>
        <objectGrid name="MFPGrid" txTimeout="30">
        <backingMap name="AttrStoreMap" copyMode="COPY_TO_BYTES" pluginCollectionRef="as"
            lockStrategy="PESSIMISTIC" writeBehind="T30;C20"
            nullValuesSupported="true" ttlEvictorType="LAST_ACCESS_TIME" timeToLive="10" nearCacheEnabled="false" />
        </objectGrid>
      </objectGrids>
      <backingMapPluginCollections>
        <backingMapPluginCollection id="as">
            <bean id="Loader" className="com.worklight.core.persistence.xs.AttributeStoreDBLoader"/>
        </backingMapPluginCollection>
    </backingMapPluginCollections>
    </objectGridConfig>

    The writeBehind XML attribute is optional.

  7. In deployment.xml, increase the numberOfPartitions attribute to 50. When you increase the number of partitions, you increase the number of loader threads connecting to the database. An increase in the number of loader threads improves the performance of persisting to the database.

Persisting the eXtreme Scale cache to Cloudant

About this task

In the configuration that is described in this section, the built-in MobileFirst Cloudant database Loader is used to persist eXtreme Scale data to a Cloudant database. This configuration can use either Cloudant Local, or Cloudant DBaaS.

Note: As an alternative, you can use the MobileFirst relational Loader to connect eXtreme Scale with the MobileFirst SQL database. For more information, see Persisting the eXtreme Scale cache to the MobileFirst Server relational database.
Figure 3. Attribute store over eXtreme Scale with Cloudant Loader plug-in
Shows attribute store over eXtreme Scale with Cloudant plug-in

Procedure

  1. Create a Cloudant account. Note the URL for the next steps.
  2. Add mfp-xs-loader.jar to the classpath of your eXtreme Scale deployment.
  3. In the objectgrid.xml file, add an entry with className="com.worklight.core.persistence.xs.AttributeStoreCloudantLoader" for backingMapPluginCollection
    <?xml version="1.0" encoding="UTF-8"?>
    <objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd"
     xmlns="http://ibm.com/ws/objectgrid/config">
    
      <objectGrids>
        <objectGrid name="MFPGrid" txTimeout="30">
        <backingMap name="AttrStoreMap" copyMode="COPY_TO_BYTES" pluginCollectionRef="as"
            lockStrategy="PESSIMISTIC" writeBehind="T60;C100"
            nullValuesSupported="true" ttlEvictorType="LAST_ACCESS_TIME" timeToLive="10" nearCacheEnabled="false" />
        </objectGrid>
      </objectGrids>
      <backingMapPluginCollections>
        <backingMapPluginCollection id="as">     
            <bean id="Loader" className="com.worklight.core.persistence.xs.AttributeStoreCloudantLoader" />
        </backingMapPluginCollection>
    </backingMapPluginCollections>
    </objectGridConfig>
  4. Add your Cloudant database URL to the eXtreme Scale container start script by using a JVM property, as follows:
    -Dcloudant_url= http://user:password@cloudant.com/attrstore 
    where attrstore is a Cloudant table name. If the table does not exist, it is created automatically.
  5. If Cloudant is behind a proxy, add a line for:
    -Dcloudant_proxy_host=proxy.com
    and a line for:
    -Dcloudant_proxy_port=8989 
    In both lines, correct the host and port values to your proxy settings.