将动态高速缓存 (DynaCache) 配置为使用 WebSphere eXtreme Scale 动态高速缓存提供程序

动态高速缓存引擎是动态高速缓存 API 和框架的缺省高速缓存提供程序。但是,动态高速缓存允许 WebSphere eXtreme Scale 充当其核心高速缓存引擎。您可以将动态高速缓存配置为使用 WebSphere eXtreme Scale 作为高速缓存提供程序,以代替缺省的动态高速缓存引擎。通过将动态高速缓存配置为使用 WebSphere eXtreme Scale,您就可以利用事务化支持、更高的可伸缩性、高可用性以及其他 WebSphere eXtreme Scale 功能,而不必更改现有的动态高速缓存代码。

开始之前

  • 请参阅“简介:动态高速缓存”主题以获取 WebSphere eXtreme Scale 功能概述。
  • 确定使用 WebSphere eXtreme Scale 是否使应用程序服务器中运行的应用程序受益。

    WebSphere eXtreme Scale 功能显著提高了动态高速缓存功能的分布式能力,超出缺省动态高速缓存引擎和数据复制服务所提供的能力水平。借助 WebSphere eXtreme Scale,您可以创建真正分布于多个服务器之间的高速缓存,而不是仅仅在服务器之间对高速缓存进行复制和同步。WebSphere eXtreme Scale 高速缓存是事务化的高度可用高速缓存,能够确保每个服务器都看到相同的动态高速缓存内容。WebSphere eXtreme Scale 还提供了比数据复制服务 (DRS) 更高的高速缓存复制服务质量。

    但是,这些优势并不意味着 eXtreme Scale 动态高速缓存提供程序是每个应用程序的正确选择。请使用 WebSphere eXtreme Scale V7.0 信息中心中的为 WebSphere eXtreme Scale 配置动态高速缓存提供程序主题中提供的决策树和功能比较矩阵来获取此高速缓存提供程序的概述。

如果您确定对应用程序有益,请参阅 WebSphere eXtreme Scale Version 7.0 Product Overview 中的“Configuring the dynamic cache provider for WebSphere eXtreme Scale”一节中提供的信息,以确定适合于您的高速缓存部署的 WebSphere eXtreme Scale 拓扑。

如果您使用 WebSphere eXtreme Scale 来代替缺省的动态高速缓存引擎,那么动态高速缓存具有下列限制:
  • 不支持磁盘高速缓存。下列定制属性无效:
    • com.ibm.ws.cache.CacheConfig.enableDiskOffload
    • com.ibm.ws.cache.CacheConfig.diskOffloadLocation
    • com.ibm.ws.cache.CacheConfig.flushToDiskOnStop
    • com.ibm.ws.cache.CacheConfig.htodCleanupFrequency
    • com.ibm.ws.cache.CacheConfig.htodDelayOffload
    • com.ibm.ws.cache.CacheConfig.htodDelayOffloadEntriesLimit
    • com.ibm.ws.cache.CacheConfig.htodDelayOffloadDepIdBuckets
    • com.ibm.ws.cache.CacheConfig.htodDelayOffloadTemplateBuckets
    • com.ibm.ws.cache.CacheConfig.diskCachePerformanceLevel
    • com.ibm.ws.cache.CacheConfig.diskCacheEvictionPolicy
    • com.ibm.ws.cache.CacheConfig.diskCacheHighThreshold
    • com.ibm.ws.cache.CacheConfig.diskCacheLowThreshold
    • com.ibm.ws.cache.CacheConfig.diskCacheSize
    • com.ibm.ws.cache.CacheConfig.diskCacheSizeInGB
    • com.ibm.ws.cache.CacheConfig.diskCacheEntrySizeInMB
    • com.ibm.ws.cache.CacheConfig.explicitBufferLimitOnStop
    • com.ibm.ws.cache.CacheConfig.lruToDiskTriggerTime
    • com.ibm.ws.cache.CacheConfig.lruToDiskTriggerPercent
    避免故障 避免故障: 应该在配置 extremeScale 前禁用磁盘卸载功能。要禁用磁盘卸载功能,请执行以下操作:
    1. 在管理控制台中,单击服务器 > 服务器类型 > WebSphere 应用程序服务器 > server_name > 容器服务 > 动态高速缓存服务
    2. 找到启用磁盘卸载属性,如果已选中此属性,请将其取消选中。
    如果忘记在将 extremeScale 配置为高速缓存提供程序前禁用磁盘卸载,请使用以下 wsadmin 命令来禁用磁盘卸载功能:
    1. 发出以下命令以查找服务器的 config 对象。
      wsadmin>$AdminConfig list DynamicCache
      (cells/optimusprimeCell01/nodes/optimusprimeNode01/servers/server1|serve
      r.xml#dynamic_cache_name)
    2. 发出以下 AdminConfig modify 命令以将 diskoffload 设置为 false:
      wsadmin>$AdminConfig modify
      (cells/optimusprimeCell01/nodes/optimusprimeNode01/servers/server1|serve
      r.xml#dynamic_cache_name) {{enableDiskOffload false}} 
    3. 发出以下命令以保存此配置更改:
      wsadmin>$AdminConfig save
    gotcha
  • 无 DRS 复制(推或推拉支持)。下列定制属性无效:
    • com.ibm.ws.cache.CacheConfig.enableReplicationAcks
    • com.ibm.ws.cache.CacheConfig.enableCacheReplication
    • com.ibm.ws.cache.CacheConfig.replicationDomain
    • com.ibm.ws.cache.CacheConfig.cacheEntryWindow
    • com.ibm.ws.cache.CacheConfig.cachePercentageWindow
    • com.ibm.ws.cache.CacheConfig.cacheInvalidateEntryWindow
    • com.ibm.ws.cache.CacheConfig.cacheInvalidatePercentWindow
    • com.ibm.ws.cache.CacheConfig.filterTimeOutInvalidation
    • com.ibm.ws.cache.CacheConfig.filterLRUInvalidation
  • 对象高速缓存不支持别名 API 功能部件。
  • 支持事件侦听器。触发任何事件时,WebSphere® eXtreme Scale 始终将 sourceOfInvalidation 设置为 REMOTE
  • 不支持禁用依赖关系标识 com.ibm.ws.cache.CacheConfig.disableDependencyId 和模板 com.ibm.ws.cache.CacheConfig.disableTemplatesSupport。
  • 不支持 PMI。
  • 支持以下 CacheStatistic 计数器:
    • CacheHits
    • CacheLruRemoves
    • CacheMisses
    • CacheRemoves
    • ExplictInvalidationsFromMemory
    • MemoryCacheEntries
    • TimeoutInvalidationsFromMemory
  • NioMap - 由于不支持磁盘高速缓存,所以 skipMemoryAndWriteToDisk 无效。另外,不会调用 DistributedNioMapObject.release() 以便释放 byteBuffer 以进行 NIO 缓冲区管理。

要启用 WebSphere eXtreme Scale 动态高速缓存提供程序,请完成下列操作。

过程

  1. 在应用程序服务器中,分别为远程服务器和其他拓扑安装 WebSphere eXtreme Scale 客户机或者 WebSphere eXtreme Scale 客户机和服务器软件包。
    避免故障 避免故障: 只支持 WebSphere eXtreme Scale 客户机安装和远程拓扑。gotcha
  2. 指定 WebSphere eXtreme Scale 动态高速缓存提供程序作为高速缓存提供程序。

    您可以逐个地将每个高速缓存实例配置为使用 WebSphere eXtreme Scale。动态高速缓存引擎是高速缓存实例的缺省高速缓存提供程序。配置了 WebSphere eXtreme Scale 的高速缓存实例可以与配置了 DRS 的高速缓存实例共存。

    请完成下列其中一项操作,以便指定 WebSphere eXtreme Scale 动态高速缓存提供程序作为高速缓存提供程序:

    1. 使用管理控制台来指定 WebSphere eXtreme Scale 动态高速缓存提供程序作为高速缓存提供程序。
      1. 在管理控制台中,请单击服务器 > 服务器类型 > WebSphere 应用程序服务器 > server_name
      2. 在“容器服务”下面,单击动态高速缓存服务server_name,然后在高速缓存提供程序字段中选择 WebSphere eXtreme Scale 动态高速缓存提供程序
      3. 单击确定
    2. 在捆绑在企业应用程序中的 cacheinstances.properties 文件中添加 cacheProviderName 属性,并将此属性设置为 com.ibm.ws.objectgrid.dynacache.CacheProviderImpl

      例如,对于 cache.instance.26,请在 cacheinstances.properties 文件中添加下面这一行:

      cache.instance.26.cacheProviderName = com.ibm.ws.objectgrid.dynacache.CacheProviderImpl
    3. 在企业应用程序的代码中添加下列工厂 API:
      Properties p = new Properties();
                      ==>p.put(CacheConfig.CACHE_PROVIDER_NAME, CacheConfig.CACHE_PROVIDER_OBJECT_GRID);
                      DistributedMap map1 = DistributedMapFactory.getMap("myMap", p);
                      DistributedMap map2 = DistributedObjectCacheFactory.getMap("myMap2", p);
  3. 配置高速缓存实例的复制设置。

    借助 WebSphere eXtreme Scale 动态高速缓存提供程序,您可以使用本地高速缓存实例以及复制的高速缓存实例。

    如果您将只使用本地高速缓存实例,请转到最后一步并保存配置更改。在本地高速缓存中,WebSphere eXtreme Scale 容器与 JVM 共存;即,WebSphere eXtreme Scale 容器与 WebSphere Application Server 共享同一个 JVM 堆。

    如果您将使用复制的高速缓存,请根据您创建此高速缓存实例的方式不同完成下列其中一项操作:

    1. 在管理控制台中的 Java 虚拟机 > 定制属性页面中,再次单击新建名称字段中输入 com.ibm.ws.cache.CacheConfig.enableCacheReplication,并在字段中输入 true,然后单击确定
    2. 在捆绑在企业应用程序中的 cacheinstances.properties 文件中添加 enableCacheReplication 属性,并将此属性设置为 true
      例如,对于 cache.instance.26,请在 cacheinstances.properties 文件中添加下面这一行:
      cache.instance.26.enableCacheReplication = true
    3. 在企业应用程序的代码中添加下列工厂 API:
      Properties p = new Properties();
                      p.put(CacheConfig.CACHE_PROVIDER_NAME, CacheConfig.CACHE_PROVIDER_OBJECT_GRID);
                      ==>p.put(CacheConfig.ENABLE_CACHE_REPLICATION, "true");
                      DistributedMap map1 = DistributedMapFactory.getMap("myMap", p);
                      DistributedMap map2 = DistributedObjectCacheFactory.getMap("myMap2", p);
  4. 配置 WebSphere eXtreme Scale 复制拓扑。

    WebSphere eXtreme Scale 动态高速缓存提供程序所必需的唯一配置参数是高速缓存拓扑参数。

    1. 在管理控制台中的 Java 虚拟机 > 定制属性页面中,再次单击新建名称字段中输入 com.ibm.websphere.xs.dynacache.topology,并在字段中输入下列其中一个值:
      • embedded
      • embedded_partitioned
      • remote
      避免故障 避免故障: 如果指定 embedded_partitioned,那么还必须将 com.ibm.websphere.xs.dynacache.num_initial_containers 定制属性添加到 JVM 设置,并且必须将此属性设置为等于或略小于要访问此分布式高速缓存实例的服务器实例数的整数。gotcha
    2. 在捆绑在企业应用程序中的 cacheinstances.properties 文件中添加 com.ibm.websphere.xs.dynacache.topology 属性,并将此属性设置为 embeddedembedded_partitionedremote
      例如,对于 cache.instance.26,请在 cacheinstances.properties 文件中添加下面这一行:
      cache.instance.26.com.ibm.websphere.xs.dynacache.topology = embedded
      避免故障 避免故障: 如果指定 embedded_partitioned,那么还必须在 cacheinstances.properties 文件中添加 com.ibm.websphere.xs.dynacache.num_initial_containers 属性,并且必须将此属性设置为等于或略小于要访问此分布式高速缓存实例的服务器实例数的整数。gotcha

      例如,如果在网格成员之间共享动态高速缓存服务,那么应该将此变量设置为网格成员数。

    3. 在企业应用程序的代码中添加下列工厂 API:
      Properties p = new Properties();
                      p.put(CacheConfig.CACHE_PROVIDER_NAME, CacheConfig.CACHE_PROVIDER_OBJECT_GRID);
                      p.put(CacheConfig.ENABLE_CACHE_REPLICATION, "true");
                      ==>p.put("com.ibm.websphere.xs.dynacache.topology", "embedded");
                      ==>p.put("com.ibm.websphere.xs.dynacache.num_initial_containers", "3");
                      DistributedMap map1 = DistributedMapFactory.getMap("myMap", p);
                      DistributedMap map2 = DistributedObjectCacheFactory.getMap("myMap2", p);

    有关 embeddedembedded_partitionedremote 设置的更多信息,请参阅 WebSphere eXtreme Scale V7 信息中心中的为 WebSphere eXtreme Scale 配置动态高速缓存提供程序主题。

  5. 配置 eXtreme Scale 目录服务网格。

    如果运行目录服务网格,那么必须为目录服务端点设置 catalog.services.cluster 定制属性。

    请参阅 WebSphere eXtreme Scale V7 信息中心中的WebSphere Application Server 环境中启动目录服务进程主题,以获取有关如何在 WebSphere Application Server 环境中启动目录服务进程的描述。

    1. 在管理控制台中,单击系统管理 > 单元 > 定制属性 > 新建
    2. 名称字段中输入 catalog.services.cluster,并在字段中输入适当的 server_name:host_name:client_port:peer_port:listener_port 值。
      • server_name 是 WebSphere 进程的标准名称,例如,主管目录服务的服务器的单元名、节点名或服务器名。示例:cellA\node1\nodeagent
      • host_name 是主管服务器的名称。
      • client_port 是用于对等目录网格通信的端口。
      • peer_port 是用于对等目录网格通信的端口。
      • listener_port 是侦听器端口。此端口必须与服务器配置中定义的 BOOTSTRAP_ADDRESS 值匹配。
      下面是有效值的一个示例:
      cellA\node1\nodeagent:host.local.domain:6600:6601:2809,cellA\node2\
      nodeagent:host.foreign.domain:6600:6601:2809
    3. 单击确定
  6. 单击保存以保存所有配置更改。
  7. 重新启动所有已配置为使用 WebSphere eXtreme Scale 的应用程序服务器。
  8. 配置定制键对象。

    如果使用定制对象作为键,那么这些对象必须实现 Serializable 或 Externalizable 接口。如果将定制对象与嵌入式拓扑或嵌入式分区拓扑配合使用,那么必须将这些对象放在共享库路径中,就像使用缺省的动态高速缓存提供程序一样。有关更多信息,请参阅“将 DistributedMap 和 DistributedObjectCache 接口用于动态高速缓存”主题。

    如果您正在使用远程拓扑,那么必须将定制键对象放在独立 WebSphere eXtreme Scale 容器的 CLASSPATH 中。有关更多信息,请参阅 WebSphere eXtreme Scale Version 7.0 Administration Guide 中有关启动容器进程的步骤。您可以从 WebSphere eXtreme Scale 资料库页面获得此出版物。

  9. 配置 eXtreme Scale 容器服务器。

    高速缓存的数据存储在 WebSphere eXtreme Scale 容器中。这些容器可以在 WebSphere Application Server 进程的内部或外部运行。当您将嵌入式拓扑或嵌入式分区拓扑用于高速缓存实例时,eXtreme Scale 提供程序将自动地在 WebSphere Application Server 进程中创建容器。您不需要为这些拓扑执行进一步的配置工作。

    使用远程拓扑时,必须先启动独立的 eXtreme Scale 容器,然后才能启动访问高速缓存实例的 WebSphere Application Server 实例。WebSphere eXtreme Scale Version 7.0 Administration Guide 阐述了启动独立容器时需要完成的步骤。

    避免故障 避免故障: 请确保特定动态高速缓存的所有容器都指向同一个目录服务端点。gotcha

    如果 WebSphere eXtreme Scale 安装在 WebSphere Application Server 的基础上,那么独立 eXtreme Scale 动态高速缓存提供程序容器的 dynacache-remoteobjectgrid.xml 和 dynacache-remote-definition.xml 配置文件位于 install_root/customLibraries/ObjectGrid/dynacache/etc 目录中;如果使用独立版本的 WebSphere eXtreme Scale,那么这些配置文件位于 install_root/ObjectGrid/dynacache/etc 目录中。请创建这些文件的副本,以便进行编辑以及在启动 eXtreme Scale 动态高速缓存提供程序的独立容器时使用。在 dynacache-remote-deployment.xml 文件中,对 numIntitialContainers 参数指定的值应该基于所运行的容器进程数。

    以下示例演示基于 UNIX 的命令行输入,此输入用于为 WebSphere eXtreme Scale 动态高速缓存提供程序启动独立容器:
    startOgServer.sh container1 -objectGridFile ../dynacache/etc/dynacache-remoteobjectgrid.
    xml -deploymentPolicyFile ../dynacache/etc/dynacache-remotedeployment.
    xml -catalogServiceEndpoints MyServer1.company.com:2809
    避免故障 避免故障: 容器进程的集合需要有足够的可用内存,以便为所有已配置为使用远程拓扑的动态高速缓存实例提供服务。共享 catalog.services.cluster 的相同值或等价值的任何 WebSphere Application Server 进程都必须使用同一组独立容器。您需要适当地调整容器数以及他们所在机器的数目。有关其他详细信息,请参阅 WebSphere eXtreme Scale Version 7.0 Product Overview 中的“Capacity planning and high availability”主题。您可以从 WebSphere eXtreme Scale 资料库页面获得此出版物。gotcha
  10. 验证是否已正确地配置 WebSphere eXtreme Scale 动态高速缓存提供程序。
    如果已正确地配置 WebSphere eXtreme Scale 动态高速缓存提供程序,那么系统日志将包含多条类似与以下的消息:
    DYNA1001I: WebSphere Dynamic cache instance named "{0}" initialized successfully using cache provider "{1}".
    DYNA1071I: The cache provider \"{0}\" is being used.
    如果使用 WebSphere eXtreme Scale 来配置和初始化高速缓存实例失败,那么动态高速缓存运行时将恢复为使用缺省的动态高速缓存提供程序,您在系统日志中应该会看到类似于以下的消息。
    DYNA1066E: Unable to initialize the cache provider \"{0}\". 
    The Dynamic cache will be used to create the cache instance \"{1}\" 
    instead of the configured cache provider. 

指示主题类型的图标 任务主题



时间戳记图标 最近一次更新时间: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tdyn_extremescale
文件名:tdyn_extremescale.html