Pavel Tupitsyn created IGNITE-2417:
--------------------------------------

             Summary: peerClassLoading causes high memory usage on simple cache 
operations
                 Key: IGNITE-2417
                 URL: https://issues.apache.org/jira/browse/IGNITE-2417
             Project: Ignite
          Issue Type: Bug
          Components: cache
    Affects Versions: 1.1.4
            Reporter: Pavel Tupitsyn
            Priority: Critical
             Fix For: 1.6


Issue surfaced in .NET, but this code can be easily ported to Java. Only one 
node is started.

Without peerClassLoading, Java heap usage is aroung 2GB with this code. With 
peerClassLoading, heap goes to the max and then there is OutOfMemoryException.

{code}
var cfg = new GridConfiguration
{
    SpringConfigUrl = @"example-cache.xml",
    JvmOptions = new List<string> { "-Xms1024m", "-Xmx8192m" },
};

using (var grid = GridFactory.Start(cfg))
{
    var cache = grid.GetOrCreateCache<object, object>("cache_put_get");
    cache.Clear();
    var obj = string.Join("", Enumerable.Range(0, 5 * 1024));

    const int iterations = 100 * 1000;
    for (var i = 0; i < iterations; i++)
        cache.Put(i.ToString(), obj);
}
{code}

Config file:
{code}
<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.xsd
        http://www.springframework.org/schema/util
        http://www.springframework.org/schema/util/spring-util.xsd";>
    <bean id="grid.cfg" 
class="org.apache.ignite.configuration.IgniteConfiguration">
        <property name="peerClassLoadingEnabled" value="true"/>
        
                <property name="discoverySpi">
            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="ipFinder">
                    <bean 
class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
                        <property name="addresses">
                            <list>
                                <!-- In distributed environment, replace with 
actual host IP address. -->
                                <value>127.0.0.1:47500..47501</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
</beans>
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to