You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Ajay <aj...@6dtech.co.in> on 2017/05/13 15:13:35 UTC

Ignite2.0 memory policy

Hi,

Please explain points

1)How to add custom memory policy?
2)Can disable default memory policy?
3)Is ignite supports any compression?

Thanks 



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Ignite2-0-memory-policy-tp12756.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Ignite2.0 memory policy

Posted by Denis Magda <dm...@apache.org>.
> 3)Is ignite supports any compression?

There is a ticket for that. Probably it will be added in the nearest time.
https://issues.apache.org/jira/browse/IGNITE-3592 <https://issues.apache.org/jira/browse/IGNITE-3592>

In the meanwhile, you can use EntryProcessor API [1] compressing whole objects or individual fields when onBeforePut method is called and decompress on onGet call. However, once the whole object or a field is compressed you will no be able to query them with SQL. This is something you have to pay for.

[1] CacheInterceptor <https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/cache/CacheInterceptor.html>

—
Denis

> On May 13, 2017, at 8:13 AM, Ajay <aj...@6dtech.co.in> wrote:
> 
> Hi,
> 
> Please explain points
> 
> 1)How to add custom memory policy?
> 2)Can disable default memory policy?
> 3)Is ignite supports any compression?
> 
> Thanks 
> 
> 
> 
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Ignite2-0-memory-policy-tp12756.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Ignite2.0 memory policy

Posted by Denis Magda <dm...@apache.org>.
Ajay,

Did you come across this section of the page memory documentations?
https://apacheignite.readme.io/docs/page-memory#memory-policies

Even more, after reading the section till the end you will find a reference to an example:
https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/datagrid/MemoryPoliciesExample.java

Let us know if anything is still unclear.

—
Denis

> On May 13, 2017, at 10:09 AM, Ivan Rakov <iv...@gmail.com> wrote:
> 
> Hi Ajay,
> 
> 1) You can specify list of memory policies in memory configuration:
> 
> 
>> MemoryConfiguration memCfg = new MemoryConfiguration();
>> 
>> MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration();
>> 
>> plcCfg.setInitialSize(100 * 1000 * 1000);
>> plcCfg.setMaxSize(200 * 1000 * 1000);
>> plcCfg.setName("myPolicy");
>> 
>> memCfg.setMemoryPolicies(plcCfg);
> 2) Default memory policy can't be disabled. However, you can set your custom memory policy as default:
>> 
>> memCfg.setDefaultMemoryPolicyName("myPolicy");
> 3) Please clarify, what kind of compression do you mean?
> 
> Best Regards,
> Ivan Rakov
> 
> On 13.05.2017 18:13, Ajay wrote:
>> Hi,
>> 
>> Please explain points
>> 
>> 1)How to add custom memory policy?
>> 2)Can disable default memory policy?
>> 3)Is ignite supports any compression?
>> 
>> Thanks 
>> 
>> 
>> 
>> --
>> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Ignite2-0-memory-policy-tp12756.html <http://apache-ignite-users.70518.x6.nabble.com/Ignite2-0-memory-policy-tp12756.html>
>> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
> 


Re: Ignite2.0 memory policy

Posted by Denis Magda <dm...@gridgain.com>.
Yes, that a general Spring rule - 'set' has to be excluded from a method
name. Hope you already checked that 'statisticsEnabled' works for you.

Denis

On Saturday, May 13, 2017, Ajay <aj...@6dtech.co.in> wrote:

> No why i asked is when i enabled statisticsEnabled getting following error
> so
> that
>
>  Error setting property values; nested exception is
> org.springframework.beans.NotWritablePropertyException: Invalid property
> 'isStatisticsEnabled' of bean class
> [org.apache.ignite.configuration.CacheConfiguration]: Bean property
> 'isStatisticsEnabled' is not writable or has an invalid setter method. Did
> you mean 'statisticsEnabled'?
>
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Ignite2-0-memory-policy-tp12756p12829.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Ignite2.0 memory policy

Posted by Ajay <aj...@6dtech.co.in>.
No why i asked is when i enabled statisticsEnabled getting following error so
that

 Error setting property values; nested exception is
org.springframework.beans.NotWritablePropertyException: Invalid property
'isStatisticsEnabled' of bean class
[org.apache.ignite.configuration.CacheConfiguration]: Bean property
'isStatisticsEnabled' is not writable or has an invalid setter method. Did
you mean 'statisticsEnabled'?





--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Ignite2-0-memory-policy-tp12756p12829.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Ignite2.0 memory policy

Posted by Denis Magda <dm...@gridgain.com>.
Just add these parameters to the already existing cache and policy
configurations on your side. There is nothing special about that, common
Spring XML stuff.
https://apacheignite.readme.io/v2.0/docs/memory-and-cache-metrics

Later on we will add an xml snippet to the doc.

Denis

On Saturday, May 13, 2017, Ajay <aj...@6dtech.co.in> wrote:

> Hi,
>
> Do you have xml configurations for to enable page and cache metrics?
>
>
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Ignite2-0-memory-policy-tp12756p12762.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Ignite2.0 memory policy

Posted by Ajay <aj...@6dtech.co.in>.
Hi,

Do you have xml configurations for to enable page and cache metrics?






--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Ignite2-0-memory-policy-tp12756p12762.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Ignite2.0 memory policy

Posted by Denis Magda <dm...@apache.org>.
Please see below

> On May 13, 2017, at 11:03 AM, Ajay <aj...@6dtech.co.in> wrote:
> 
> Hi,
> 
> Thanks for quick reply.
> 
> Coming to question is:
> 
> 1) I did configuration in in server node xml like
> 
> <property name="memoryConfiguration">
> 	<bean class="org.apache.ignite.configuration.MemoryConfiguration">
> 		<property name="defaultMemoryPolicyName" value="Default_Region" />
> 		<property name="pageSize" value="4096" />
> 		<property name="systemCacheInitialSize" value="#{40 * 1024 * 1024}" />
> 		<property name="systemCacheMaxSize" value="#{40 * 1024 * 1024}" />
> 		<property name="memoryPolicies">
> 			<list>
> 				<bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration">
> 					<property name="name" value="Default_Region" />
> 					<property name="initialSize" value="#{1 * 1024 * 1024 * 1024}" />
> 					<property name="maxSize" value="#{2 * 1024 * 1024 * 1024}" />
> 					<property name="pageEvictionMode" value="RANDOM_2_LRU" />
> 				</bean>
> 
> 			</list>
> 		</property>
> 	</bean>
> </property>
> 
> 
> After iam starting the server node iam getting exception 
> Caused by: class org.apache.ignite.IgniteCheckedException: MemoryPolicy
> maxSize must not be smaller than initialSize [name=Default_Region,
> initSize=1.1 GB, maxSize=-2147483648 B]
> 
> Did i made any wrong configurations?

You overflowed integer type positive numbers range. You have to convert it to long value explicitly:
<property name="maxSize" value="#{2L * 1024 * 1024 * 1024}"/>


> 
> 2)Once region reached maximum size new data will store into default region
> or one more custom region will create?

As the ‘maxSize' javadoc and the documentation I shared before say:

If the overall memory usage goes beyond the maximum size parameter then an out of memory exception will be thrown. To avoid this use an eviction algorithm or set the size to a bigger value.

> 
> 2)When i saw visor command line gui it was showing entries in heap section
> and off-heap is empty is any wrong configurations enabled?
> 
> 

You need to set MemoryPolicyConfiguration.setMetricsEnabled to true. Read more here:
https://apacheignite.readme.io/v2.0/docs/memory-and-cache-metrics#section-memory-metrics <https://apacheignite.readme.io/v2.0/docs/memory-and-cache-metrics#section-memory-metrics>

If this helps then let me know. I think we need to set this parameter to true automatically if cache metrics are enabled.


—
Denis

> 
> 
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Ignite2-0-memory-policy-tp12756p12760.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Ignite2.0 memory policy

Posted by Ajay <aj...@6dtech.co.in>.
Hi,

Thanks for quick reply.

Coming to question is:

1) I did configuration in in server node xml like

<property name="memoryConfiguration">
	<bean class="org.apache.ignite.configuration.MemoryConfiguration">
		<property name="defaultMemoryPolicyName" value="Default_Region" />
		<property name="pageSize" value="4096" />
		<property name="systemCacheInitialSize" value="#{40 * 1024 * 1024}" />
		<property name="systemCacheMaxSize" value="#{40 * 1024 * 1024}" />
		<property name="memoryPolicies">
			<list>
				<bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration">
					<property name="name" value="Default_Region" />
					<property name="initialSize" value="#{1 * 1024 * 1024 * 1024}" />
					<property name="maxSize" value="#{2 * 1024 * 1024 * 1024}" />
					<property name="pageEvictionMode" value="RANDOM_2_LRU" />
				</bean>

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


After iam starting the server node iam getting exception 
Caused by: class org.apache.ignite.IgniteCheckedException: MemoryPolicy
maxSize must not be smaller than initialSize [name=Default_Region,
initSize=1.1 GB, maxSize=-2147483648 B]

Did i made any wrong configurations?

2)Once region reached maximum size new data will store into default region
or one more custom region will create?

2)When i saw visor command line gui it was showing entries in heap section
and off-heap is empty is any wrong configurations enabled?




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Ignite2-0-memory-policy-tp12756p12760.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Ignite2.0 memory policy

Posted by Ivan Rakov <iv...@gmail.com>.
Hi Ajay,

1) You can specify list of memory policies in memory configuration:

> MemoryConfiguration memCfg =new MemoryConfiguration();
>
> MemoryPolicyConfiguration plcCfg =new MemoryPolicyConfiguration();
>
> plcCfg.setInitialSize(100 *1000 *1000);
> plcCfg.setMaxSize(200 *1000 *1000);
> plcCfg.setName("myPolicy");
>
> memCfg.setMemoryPolicies(plcCfg);
2) Default memory policy can't be disabled. However, you can set your 
custom memory policy as default:
> memCfg.setDefaultMemoryPolicyName("myPolicy");
3) Please clarify, what kind of compression do you mean?

Best Regards,
Ivan Rakov


On 13.05.2017 18:13, Ajay wrote:
> Hi,
>
> Please explain points
>
> 1)How to add custom memory policy?
> 2)Can disable default memory policy?
> 3)Is ignite supports any compression?
>
> Thanks
>
>
>
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Ignite2-0-memory-policy-tp12756.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.