GridGain + .NET Client Connection Warnings / Dropouts

﹥>﹥吖頭↗ 提交于 2019-12-13 04:23:19

问题


I am connecting to GridGain Cluster and I keep seeing the following error in the logs, I am also noticing the client connections dropping/reconnecting quite frequently (although been new to the platform I am not sure if this is normal behavior).

[12:41:35,548][WARN ][grid-nio-worker-0-#53%null%][GridTcpRestProtocol] No marshaller defined for NIO session, using PROTOBUF as default [ses=GridSelectorNioSessionImpl [selectorIdx=0, queueSize=0, writeBuf=null, readBuf=null, super=GridNioSessionImpl [locAddr=/10.25.220.83:11211, rmtAddr=/1.144.94.10:49000, createTime=1398948095537, closeTime=0, bytesSent=0, bytesRcvd=1455, sndSchedTime=1398948095537, lastSndTime=1398948095537, lastRcvTime=1398948095548, readsPaused=false, filterChain=FilterChain[filters=[GridNioCodecFilter [parser=GridTcpRestParser [jdkMarshaller=GridJdkMarshaller [], protobufMarshaller=org.gridgain.client.marshaller.protobuf.GridClientProtobufMarshaller@68ebf23e], directMode=false], accepted=true]]]

Is this a configuration issue? How can I define a marshaller? Below is my 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:util="http://www.springframework.org/schema/util" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd">
<description>Main Spring file for grid configuration.</description>
<bean id="grid.cfg" class="org.gridgain.grid.GridConfiguration" scope="singleton">
<property name="peerClassLoadingEnabled" value="false"/>
<property name="localHost" value="10.25.220.83"/>
<!-- Cache configurations (all properties are optional). -->
<property name="cacheConfiguration">
    <list>
        <!-- Partitioned cache example configuration (Atomic mode). -->
        <bean parent="cache-template">
            <property name="name" value="partitioned"/>
            <property name="cacheMode" value="PARTITIONED"/>
            <property name="atomicityMode" value="ATOMIC"/>
            <property name="distributionMode" value="PARTITIONED_ONLY"/>
            <property name="backups" value="1"/>
        </bean>
        <!-- Partitioned cache example configuration (Transactional mode). -->
        <bean parent="cache-template">
            <property name="name" value="partitioned_tx"/>
            <property name="cacheMode" value="PARTITIONED"/>
            <property name="atomicityMode" value="TRANSACTIONAL"/>
            <property name="distributionMode" value="NEAR_PARTITIONED"/>
            <property name="backups" value="1"/>
        </bean>
        <!-- Replicated cache example configuration (Atomic mode). -->
        <bean parent="cache-template">
            <property name="name" value="replicated"/>
            <property name="cacheMode" value="REPLICATED"/>
            <property name="atomicityMode" value="ATOMIC"/> 
        </bean>
        <!-- Replicated cache example configuration (Transactional mode). -->
        <bean parent="cache-template">
            <property name="name" value="replicated_tx"/>
            <property name="cacheMode" value="REPLICATED"/>
            <property name="atomicityMode" value="TRANSACTIONAL"/> 
        </bean>
    </list>
</property>
<property name="discoverySpi">
<bean class="org.gridgain.grid.spi.discovery.tcp.GridTcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.gridgain.grid.spi.discovery.tcp.ipfinder.vm.GridTcpDiscoveryVmIpFinder">
<property name="addresses">
<list>
 <value>10.25.220.83:47500</value>
 <value>10.25.240.87:47500</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
</bean>
<!-- Template for all example cache configurations. -->
<bean id="cache-template" abstract="true" class="org.gridgain.grid.cache.GridCacheConfiguration">
 <property name="preloadMode" value="ASYNC"/>
    <property name="preloadBatchSize" value="#{2 * 1024 * 1024}"/>
    <property name="preloadThrottle" value="100"/> 
    <property name="startSize" value="3000000"/>  
    <property name="name" value="partitioned"/>
    <property name="cacheMode" value="PARTITIONED"/>
    <property name="atomicityMode" value="ATOMIC"/>
    <property name="writeSynchronizationMode" value="FULL_ASYNC"/>
    <property name="distributionMode" value="PARTITIONED_ONLY"/>  
    <property name="queryIndexEnabled" value="false"/>
    <property name="backups" value="1"/>
</bean>
</beans>

I am using the following client code from a C# 4.5 console application.

static void Main(string[] args)
{

    // Create a GridGain Client
    var ggClient = CreateClient();
    Console.WriteLine("GridGain Connected");

    ggCache = ggClient.Data("partitioned");
    ggCompute = ggClient.Compute();

    ggCache.Put<string, byte[]>("test", new byte[] { 0, 1, 2, 3, 4 });   

    GridClientFactory.StopAll(); 
}

private static IGridClientData ggCache;
private static IGridClientCompute ggCompute;  

/**
 * <summary>
 * This method will create a client with default configuration. Note that this method expects that
 * first node will bind rest binary protocol on default port. It also expects that partitioned cache is
 * configured in grid.</summary>
 *
 * <returns>Client instance.</returns>
 * <exception cref="GridClientException">If client could not be created.</exception>
 */
private static IGridClient CreateClient()
{
    var cacheCfg = new GridClientDataConfiguration();

    // Set remote cache name.
    cacheCfg.Name = "partitioned";

    // Set client partitioned affinity for this cache.
    cacheCfg.Affinity = new GridClientPartitionAffinity();

    var cfg = new GridClientConfiguration();
    cfg.IsTopologyCacheEnabled = true;
    cfg.DataConfigurations.Add(cacheCfg);

    // Point client to a local node. Note that this server is only used
    // for initial connection. After having established initial connection
    // client will make decisions which grid node to use based on collocation
    // with key affinity or load balancing.
    cfg.Servers.Add("127.0.0.1" + ':' + GridClientConfiguration.DefaultTcpPort);
    cfg.Routers.Add("127.1.0.1" + ':' + GridClientConfiguration.DefaultTcpPort);
    // cfg.Servers.Add("127.2.0.1" + ':' + GridClientConfiguration.DefaultTcpPort);

    var client = GridClientFactory.Start(cfg); 
    return client;

}


回答1:


Starting with GridGain release 6.2.0-rc2, GridGain added Portable Object feature which significantly enhances C++ and .NET functionality and fixes connectivity issues.

With Portable Objects you can:

  1. Store object in .NET and retrieve in Java or C++ (the reverse is also true)
  2. Dynamically change the class structure on the client side without restarting the server.
  3. Retrieve Portable Objects from cache without deserialization into class and get the required fields by name.

The example of Portable Objects is available with enterprise edition download.



来源:https://stackoverflow.com/questions/23408769/gridgain-net-client-connection-warnings-dropouts

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!