Re: We want to configure near cache on client so that we can handle high TPS items and avoid network call to server

2017-08-31 Thread afedotov
Hi,

1. You can set an eviction policy distinct from the one of the underlying
server cache but you can set a
distinct expiration policy for a near cache as for now; there is, actually,
even no NearCacheConfiguration#setExpiryPolicyFactory method
2. For example, if you have the following configuration for a cache

CacheConfiguration cacheConf = ...;
...
cacheConf.setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(new
Duration(TimeUnit.SECONDS,5)));

NearCacheConfiguration nearConf = new
NearCacheConfiguration<>(); 
nearConf.setNearEvictionPolicy(new LruEvictionPolicy<>(1000)); 

then if an entry which exists in the near cache is updated in the underlying
server cache then
near cache will be notified about it and the expiration policy will take
that fact into account.

If you access 2000 entities within 2 seconds then due to the LRU eviction
policy 1000 of them will be evicted.
If you have 100 entities in the near cache that were accessed 2 seconds ago
and read 500 entities within 3 seconds
then those 100 entities will expire and get removed from the near cache.

Kind regards,
Alex.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: We want to configure near cache on client so that we can handle high TPS items and avoid network call to server

2017-08-29 Thread hiten
1. But we want to configure different eviction policy for near cache.
According to documentation, setNearEvictionPolicy(CacheEvictionPolicy) -
Eviction policy for the near cache.
nearConf.setNearEvictionPolicy(new LruEvictionPolicy<>(1000)); 

But looks like the below configuration is not working for near cache
nearConf.setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(new
Duration(TimeUnit.SECONDS,5))); 

Any way to specifically set expiry policy for near cache and we don't want
to inherit from main cache?

2. So that means we can't set like invalidate on change to false (i.e. means
disable update events to near cache if main cache has been updated)





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: We want to configure near cache on client so that we can handle high TPS items and avoid network call to server

2017-08-29 Thread afedotov
Hi,

1. It's mostly OK, but expiry policy should be set on the main cache and it
will be inherited by the near cache
Please refer to this documentation section

2. It's not possible out of the box, but you could do some test runs and
gather statistics that could give you
some hints on the appropriate values for eviction and expiration policies
to achieve the wanted behavior or,
at least, get closer to it.
3. You can use for example IgniteCache#localEntries or IgniteCache#size
with CachePeekMode#NEAR parameter.
As well take a look at metrics

4. You could have a separate cache for a predefined subset of keys and
enable a near cache for it
5. In general, yes.

Kind regards,
Alex.

On Tue, Aug 29, 2017 at 7:53 AM, hiten [via Apache Ignite Users] <
ml+s70518n1647...@n6.nabble.com> wrote:

> Point 5. According to documentation "utilizing Ignite with affinity
> colocation, near caches should not be used".
>
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
> http://apache-ignite-users.70518.x6.nabble.com/We-want-
> to-configure-near-cache-on-client-so-that-we-can-handle-
> high-TPS-items-and-avoid-network-calr-tp16463p16470.html
> To start a new topic under Apache Ignite Users, email
> ml+s70518n1...@n6.nabble.com
> To unsubscribe from Apache Ignite Users, click here
> 
> .
> NAML
> 
>




--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/We-want-to-configure-near-cache-on-client-so-that-we-can-handle-high-TPS-items-and-avoid-network-calr-tp16463p16516.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: We want to configure near cache on client so that we can handle high TPS items and avoid network call to server

2017-08-28 Thread hiten
Point 5. According to documentation "utilizing Ignite with affinity
colocation, near caches should not be used".




--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/We-want-to-configure-near-cache-on-client-so-that-we-can-handle-high-TPS-items-and-avoid-network-calr-tp16463p16470.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


We want to configure near cache on client so that we can handle high TPS items and avoid network call to server

2017-08-28 Thread hiten
Below are the questions related to near cache on client side:
1. Is the below configuration is the correct way - 1000 items per client and
evict the entries if not accessed in 5 seconds?

NearCacheConfiguration nearConf = new
NearCacheConfiguration<>();
nearConf.setNearEvictionPolicy(new LruEvictionPolicy<>(1000));
nearConf.setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(new
Duration(TimeUnit.SECONDS,5)));

2. Is it possible not to evict the entries from near cache if entry get
updated on the server node? We want to control the eviction through
ExpiryPolicy.

3. How can we get the near cache stats? Like owned entry count or eviction
count?

4. Is it possible to configure near cache for only predefined subset of the
keys?

5. Is Near Cache gets populated only when we access data via map.get(k) or
cache.get(k) methods, and not IgniteCallable ?




--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/We-want-to-configure-near-cache-on-client-so-that-we-can-handle-high-TPS-items-and-avoid-network-calr-tp16463.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.