Thanks for response. Yes, I tried to reproduce in latest Ignite 2.1 and all
works good.

Sorry, forgot to specify version. If that an issue it is in ver.
2.0.0#20170430-sha1:d4eef3c6
Other system information:
Config URL:
file:/C:/work/apache-ignite/apache-ignite-fabric-2.0.0-bin/examples/config/my-client-example-memory-policies.xml
OS: Windows 7 6.1 amd64
Language runtime: Java Platform API Specification ver. 1.8
VM information: Java(TM) SE Runtime Environment 1.8.0_121-b13 Oracle
Corporation Java HotSpot(TM) 64-Bit Server VM 25.121-b13
VM total memory: 5.3GB



On Thu, Aug 10, 2017 at 8:47 PM, afedotov <[email protected]>
wrote:

> Hi,
>
> Provided configuration works as expected on Ignite version 2.1.
> On my side, in this configuration, I got 3 memory segment allocations.
>
> Have you tried requesting cache.size() after populating the cache?
> Please provide the full configuration files so as I could check them.
>
> Kind regards,
> Alex.
>
> On Thu, Aug 10, 2017 at 6:58 PM, smironchyk [via Apache Ignite Users] <[hidden
> email] <http:///user/SendEmail.jtp?type=node&node=16105&i=0>> wrote:
>
>> Hi! I am trying to configure and test my custom memory policy for the
>> simple 1 client - 1 server node topology.
>>
>> In order to do this I added memory configuration for my server node like
>> this with 1GB_Region_Eviction memory policy configured.
>>
>>         <property name="memoryConfiguration">
>>             <bean class="org.apache.ignite.confi
>> guration.MemoryConfiguration">
>>
>>                 <property name="pageSize" value="#{16 * 1024}"/>
>>
>>                 <property name="memoryPolicies">
>>                     <list>
>>                         <bean class="org.apache.ignite.confi
>> guration.MemoryPolicyConfiguration">
>>                             <property name="name"
>> value="1GB_Region_Eviction"/>
>>                             <property name="metricsEnabled" value="true"
>> />
>>                             <property name="initialSize" value="#{250 *
>> 1024 * 1024}"/>
>>                             <property name="maxSize" value="#{1l * 1024 *
>> 1024 * 1024}"/>
>>                             <property name="pageEvictionMode"
>> value="RANDOM_2_LRU"/>
>>                         </bean>
>>
>>                     </list>
>>                 </property>
>>             </bean>
>>         </property>
>>
>> My client node connects to server and starts putting new entries with
>> size ~ 2MB to cache with interval in 1 sec. See client config below.
>> <bean class="org.apache.ignite.configuration.IgniteConfiguration">
>>         <property name="clientMode" value="true"/>
>>
>>         <property name="peerClassLoadingEnabled" value="true"/>
>>
>>         <property name="cacheConfiguration">
>>             <list>
>>                 <bean class="org.apache.ignite.confi
>> guration.CacheConfiguration">
>>                     <property name="name" value="MyCache1"/>
>>                     <property name="statisticsEnabled" value="true" />
>>                     <property name="rebalanceMode" value="SYNC"/>
>>                     <property name="memoryPolicyName"
>> value="1GB_Region_Eviction"/>
>>
>>                     <property name="writeSynchronizationMode"
>> value="FULL_SYNC"/>
>>                     <property name="backups" value="0"/>
>>                     <property name="eagerTtl" value="false"/>
>>                     <property name="expiryPolicyFactory">
>>                         <bean class="javax.cache.expiry.CreatedExpiryPolicy"
>> factory-method="factoryOf">
>>                             <constructor-arg value="THIRTY_MINUTES"/>
>>                         </bean>
>>                     </property>
>>                 </bean>
>>             </list>
>>         </property>
>> ...
>>     </bean>
>>
>> I've got message in server node log like this
>> [12:34:16,622][INFO][sys-stripe-1-#2%null%][PageMemoryNoStoreImpl]
>> Allocated next memory segment [plcName=1GB_Region_Eviction, chunkSize=268.4
>> MB]
>> And after this no more memory chunks allocated by node. And my maxSize
>> ignored by cache.
>> What am I doing wrong here. Please advise.
>>
>> my-client-example-memory-policies.xml
>> <http://apache-ignite-users.70518.x6.nabble.com/file/n16101/my-client-example-memory-policies.xml>
>> my-example-memory-policies.xml
>> <http://apache-ignite-users.70518.x6.nabble.com/file/n16101/my-example-memory-policies.xml>
>> MyMemoryPoliciesExample.java
>> <http://apache-ignite-users.70518.x6.nabble.com/file/n16101/MyMemoryPoliciesExample.java>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://apache-ignite-users.70518.x6.nabble.com/Ignite-fails-
>> to-allocate-more-memory-then-initially-allocated-when-maxSi
>> ze-property-provided-in-Memon-tp16101.html
>> To start a new topic under Apache Ignite Users, email [hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=16105&i=1>
>> To unsubscribe from Apache Ignite Users, click here.
>> NAML
>> <http://apache-ignite-users.70518.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
> ------------------------------
> View this message in context: Re: Ignite fails to allocate more memory
> then initially allocated when maxSize property provided in
> MemoryPolicyConfiguration
> <http://apache-ignite-users.70518.x6.nabble.com/Ignite-fails-to-allocate-more-memory-then-initially-allocated-when-maxSize-property-provided-in-Memon-tp16101p16105.html>
>
> Sent from the Apache Ignite Users mailing list archive
> <http://apache-ignite-users.70518.x6.nabble.com/> at Nabble.com.
>



-- 
*Siarhei Mironchyk*
*Developer*
o:   +375.17.228.25.92
m:  +375.29.568.19.01
e:   [email protected] <[email protected]>
skype:   mironchik.sergei.olegovich


*EIS Group Powering Insurance Innovation*
*® *visit us:  www.eisgroup.com
<?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.xsd
        http://www.springframework.org/schema/util
        http://www.springframework.org/schema/util/spring-util.xsd";>
    <bean class="org.apache.ignite.configuration.IgniteConfiguration">
        <property name="clientMode" value="true"/>
        <!-- Set to true to enable distributed class loading for examples, default is false. -->
        <property name="peerClassLoadingEnabled" value="true"/>

        <property name="cacheConfiguration">
            <list>
                <bean class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="MyCache1"/>
                    <property name="statisticsEnabled" value="true" />
                    <!--<property name="onheapCacheEnabled" value="true"/>-->
                    <property name="rebalanceMode" value="SYNC"/>
                    <property name="memoryPolicyName" value="1GB_Region_Eviction"/>

                    <property name="writeSynchronizationMode" value="FULL_SYNC"/>
                    <property name="backups" value="0"/>
                    <property name="eagerTtl" value="false"/>
                    <property name="expiryPolicyFactory">
                        <bean class="javax.cache.expiry.CreatedExpiryPolicy" factory-method="factoryOf">
                            <constructor-arg value="THIRTY_MINUTES"/>
                        </bean>
                    </property>

                    <!--<property name="evictionPolicy">-->
                        <!--&lt;!&ndash; LRU eviction policy. &ndash;&gt;-->
                        <!--<bean class="org.apache.ignite.cache.eviction.lru.LruEvictionPolicy">-->
                            <!--<property name="maxSize" value="1000"/>-->
                        <!--</bean>-->
                    <!--</property>-->
                </bean>
            </list>
        </property>

        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
        <property name="discoverySpi">
            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="ipFinder">
                    <!--
                        Ignite provides several options for automatic discovery that can be used
                        instead os static IP based discovery. For information on all options refer
                        to our documentation: http://apacheignite.readme.io/docs/cluster-config
                    -->
                    <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
                    <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
                    <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..47509</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
</beans>
<?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.xsd
        http://www.springframework.org/schema/util
        http://www.springframework.org/schema/util/spring-util.xsd";>
    <bean class="org.apache.ignite.configuration.IgniteConfiguration">
        <!-- Set to true to enable distributed class loading for examples, default is false. -->
        <property name="peerClassLoadingEnabled" value="true"/>

        <!-- Memory configuration for OFF-HEAP memory. Entry supposedly go here after it's evicted from HEAP -->
        <property name="memoryConfiguration">
            <bean class="org.apache.ignite.configuration.MemoryConfiguration">
                <!-- Setting the page size to 16 kB, not enough to hold average policy, but max acceptable value -->
                <property name="pageSize" value="#{16 * 1024}"/>
                <!--<property name="defaultMemoryPolicySize" value="#{4L * 1024 * 1024 * 1024}"/>-->
                <!--<property name="systemCacheInitialSize" value="#{100 * 1024 * 1024}"/>-->
                <!--<property name="systemCacheMaxSize" value="#{100 * 1024 * 1024}"/>-->

                <!-- Setting a name of the default memory policy. Required to set only if the default policy's
                    parameters are overridden like it's done below. -->
                <property name="defaultMemoryPolicyName" value="Default_Region"/>

                <!-- Defining several memory policies for different memory regions -->
                <property name="memoryPolicies">
                    <list>
                        <!--
                            Default memory region that grows endlessly. A cache is bound to this memory region
                            unless it sets another one in its CacheConfiguration.
                        -->
                        <bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration">
                            <property name="name" value="Default_Region"/>
                            <property name="initialSize" value="#{320 * 1024 * 1024}"/>
                            <property name="maxSize" value="#{320 * 1024 * 1024}"/>
                            <property name="pageEvictionMode" value="RANDOM_2_LRU"/>
                        </bean>

                        <!-- If the overall memory usage goes beyond the maximum size, then an out of memory exception will be thrown-->
                        <bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration">
                            <property name="name" value="1GB_Region_Eviction"/>
                            <property name="metricsEnabled" value="true" />
                            <property name="initialSize" value="#{250 * 1024 * 1024}"/>
                            <property name="maxSize" value="#{1l * 1024 * 1024 * 1024}"/>
                            <property name="pageEvictionMode" value="RANDOM_2_LRU"/>
                        </bean>

                    </list>
                </property>
            </bean>
        </property>

        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
        <property name="discoverySpi">
            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="ipFinder">
                    <!--
                        Ignite provides several options for automatic discovery that can be used
                        instead os static IP based discovery. For information on all options refer
                        to our documentation: http://apacheignite.readme.io/docs/cluster-config
                    -->
                    <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
                    <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
                    <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..47509</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
</beans>

Attachment: MyMemoryPoliciesExample.java
Description: Binary data

Reply via email to