You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by monstereo <me...@gmail.com> on 2018/07/23 08:22:45 UTC

Waiting too long, to load 7k datas to cache.... And Client gets null value

Here is the config file:
 <property name="dataStorageConfiguration">
                <bean
class="org.apache.ignite.configuration.DataStorageConfiguration">
                    <property name="dataRegionConfigurations">
                        <list>
                            <bean
class="org.apache.ignite.configuration.DataRegionConfiguration">
                                <property name="name" value="10MB_Region"/>
                                <property name="initialSize"
value="#{10L*1024*1024}"/>
                                <property name="maxSize"
value="#{10L*1024*1024}"/>
                                <property name="pageEvictionMode"
value="RANDOM_2_LRU"/>
                                <property name="evictionThreshold"
value="0.5"/>
                            </bean>
                        </list>
                    </property>
                </bean>
            </property>

            <property name="cacheConfiguration">
                <bean
class="org.apache.ignite.configuration.CacheConfiguration">
                    
                    <property name="name" value="testCache"/>
                    
                    <property name="cacheMode" value="REPLICATED"/>
                    
                    <property name="dataRegionName" value="10MB_Region"/>
                </bean>
            </property>


Here is the main app
public static void populateCache(IgniteCache igniteCache){
        for (int i = 0; i < 10; i++){
            igniteCache.put(i, String.valueOf(i));
        }
    }

public static void main(String[] args) {
        Ignite igniteNode =
IgniteFactory.createIgniteNodeWithSpecificConfiguration("s", configPath);
        IgniteConfiguration igniteConfiguration =
igniteNode.configuration();
        IgniteCache igniteCache = igniteNode.getOrCreateCache("testCache");
        populateCache(igniteCache);
        System.out.println(igniteCache.size());

}

when i changed to i<7000 (in  populateCache method),  server node appears(I
mean, i can see "[11:13:09] Topology snapshot [ver=1, servers=1, clients=0,
CPUs=4, offheap=1.2GB, heap=1.3GB]") but too wait to write 
System.out.println(igniteCache.size());

Now at the same time I have created client node :

  Ignite client =
IgniteFactory.createIgniteNodeWithSpecificConfiguration("c", cluster_1);
        IgniteCache igniteCache = client.getOrCreateCache("testCache");
        System.out.println(igniteCache.get(6999));

this returns null,

it should not return null -> it should return::
* cache is not ready
* or wait until cache is ready and get the result which is 6999



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

Re: Waiting too long, to load 7k datas to cache.... And Client gets null value

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

You can try

           // Wait until cache is fully populated locally
            while (igniteCache.localSize(CachePeekMode.ALL) < 2000000) { }

            System.out.println("Now consumer has all backup " +
igniteCache.size());
            System.out.println("Now decrease the latch");
            latch.countDown();

Regards,

-- 
Ilya Kasnacheev

2018-07-24 22:12 GMT+03:00 monstereo <me...@gmail.com>:

> thanks, ilya
>
> however, client does not wait until backup has complete. Here is the my
> codes:
>
> First I create node1, and wait until cache size is 2.000.000
> Then i run another nodes (node2, client) and yes client will wait until 2
> node2 runs
> But i want client to wait until backup operation is done.
>
> Because, when I use GridGain web console:
>                      even if I see this output "Now consumer has all backup
> " + igniteCache.size()"
>                      in grid console, backup is creating, (its number is
> increasing -> 100k , 805k , 1.3M ... 2M)
>                      and backup is creating, client can get data(of course
> gets correct result, because cache has been created before by node1)
>
>
>
> For node 1(Create 2.000.000 datas in cache)
>
> public static void populateCache(IgniteCache igniteCache){
>         for (int i = 0; i < 2000000; i++){
>             igniteCache.put(i, String.valueOf(i));
>         }
>     }
>
>     public static void main(String[] args) {
>         Ignite node1 = Ignition.start(defaultconfigpath);
>         IgniteCountDownLatch igniteCountDownLatch =
> publisher.countDownLatch(
>                                             "simpleLatch", 2, false, true);
>
>
>         CacheConfiguration cacheConfiguration = new CacheConfiguration();
>         cacheConfiguration.setName("sampleCache");
>         cacheConfiguration.setCacheMode(CacheMode.REPLICATED);
>         IgniteCache igniteCache =
> publisher.getOrCreateCache(cacheConfiguration);
>
>         populateCache(igniteCache);
>         System.out.println(igniteCache.size());
>
>     }
>
> here is the node 2:
>
> public static void main(String[] args) {
>         Ignite node2 =Ignition.start(defaultconfigpath);
>
>         IgniteCache igniteCache = consumer.getOrCreateCache("
> sampleCache");
>
>         IgniteCountDownLatch latch = consumer.countDownLatch(
>                 "simpleLatch", 2, false, true);
>
>         if (igniteCache.size() == 2000000){
>             System.out.println("Now consumer has all backup " +
> igniteCache.size());
>             System.out.println("Now decrease the latch");
>             latch.countDown();
>         }
>
>     }
>
>
> here is the client:
>
> public static void main(String[] args) {
>         Ignite client = Ignition.start(defaultconfigpath);
>         Ignition.setClientMode(true);
>
>         IgniteCountDownLatch latch = client.countDownLatch(
>                 "simpleLatch", 2, false, true);
>
>         System.out.println("Client is wait to latch");
>
>         latch.await();
>
>         System.out.println("Now client can get values");
>         IgniteCache igniteCache = client.getOrCreateCache("sampleCache");
>         System.out.println(igniteCache.get(799999));
>     }
>
>
> ilya.kasnacheev wrote
> > Hello!
> >
> > You can use ignite.countDownLatch(). I believe we've already discussed
> > this
> > approach.
> >
> > Regards,
> >
> > --
> > Ilya Kasnacheev
> >
> > 2018-07-24 18:14 GMT+03:00 monstereo &lt;
>
> > mehmetozanguven@
>
> > &gt;:
> >
> >> ??
> >>
> >> monstereo wrote
> >> > thank you,
> >> > As you stated, it is about my memory configuration, I solved it. (When
> >> I
> >> > increase the memory)
> >> >
> >> > But can you explain external synch. part for " "cache is not ready" if
> >> the
> >> > cache is already created but not populated yet. You need external sync
> >> > here."
> >> >
> >> > Which method ignite provides for this "cache is not ready". (I am
> >> looking
> >> > for -> "client can not run the get method, until cache is ready.")
> >> >
> >> >
> >> > ilya.kasnacheev wrote
> >> >> Hello!
> >> >>
> >> >> Can you please provide the thread dump while running this code?
> >> >>
> >> >> Note that 10M is a very very small number for a memory model and it
> >> might
> >> >> affect your case.
> >> >>
> >> >> Also note that cache.get() should absolutely not return "cache is not
> >> >> ready" if the cache is already created but not populated yet. You
> need
> >> >> external sync here.
> >> >>
> >> >> Regards,
> >> >>
> >> >>
> >> >> --
> >> >> Ilya Kasnacheev
> >> >>
> >> >> 2018-07-23 11:22 GMT+03:00 monstereo &lt;
> >> >
> >> >> mehmetozanguven@
> >> >
> >> >> &gt;:
> >> >>
> >> >>> Here is the config file:
> >> >>>
> >> >>
> >> >
> > <property name="dataStorageConfiguration">
> >> >>>
> >> >>
> >> >
> > <bean
> >>
> >  >>
> >> >>
> >> >>  class="org.apache.ignite.configuration.DataStorageConfiguration">
> >> >>>
> >> >>
> >> >
> > <property name="dataRegionConfigurations">
> >> >>>
> >> >>
> >> >
> > <list>
> >> >>>
> >> >>
> >> >
> > <bean
> >>
> >  >>
> >> >>
> >> >>  class="org.apache.ignite.configuration.DataRegionConfiguration">
> >> >>>
> >> >>
> >> >
> > <property name="name" value="10MB_Region"/>
> >> >>>
> >> >>
> >> >
> > <property name="initialSize"
> >>
> >  >>
> >> >>
> >> >>  value="#{10L*1024*1024}"/>
> >> >>>
> >> >>
> >> >
> > <property name="maxSize"
> >>
> >  >>
> >> >>
> >> >>  value="#{10L*1024*1024}"/>
> >> >>>
> >> >>
> >> >
> > <property name="pageEvictionMode"
> >>
> >  >>
> >> >>
> >> >>  value="RANDOM_2_LRU"/>
> >> >>>
> >> >>
> >> >
> > <property name="evictionThreshold"
> >>
> >  >>
> >> >>
> >> >>  value="0.5"/>
> >> >>>
> >> >>
> >> >
> > </bean>
> >> >>>
> >> >>
> >> >
> > </list>
> >> >>>
> >> >>
> >> >
> > </property>
> >> >>>
> >> >>
> >> >
> > </bean>
> >> >>>
> >> >>
> >> >
> > </property>
> >> >>>
> >> >>>
> >> >>
> >> >
> > <property name="cacheConfiguration">
> >> >>>
> >> >>
> >> >
> > <bean
> >>
> >  >>
> >> >>
> >> >>  class="org.apache.ignite.configuration.CacheConfiguration">
> >> >>>
> >> >>>
> >> >>
> >> >
> > <property name="name" value="testCache"/>
> >> >>>
> >> >>>
> >> >>
> >> >
> > <property name="cacheMode" value="REPLICATED"/>
> >> >>>
> >> >>>
> >> >>
> >> >
> > <property name="dataRegionName" value="10MB_Region"/>
> >> >>>
> >> >>
> >> >
> > </bean>
> >> >>>
> >> >>
> >> >
> > </property>
> >> >>>
> >> >>>
> >> >>> Here is the main app
> >> >>> public static void populateCache(IgniteCache igniteCache){
> >> >>>         for (int i = 0; i < 10; i++){
> >> >>>             igniteCache.put(i, String.valueOf(i));
> >> >>>         }
> >> >>>     }
> >> >>>
> >> >>> public static void main(String[] args) {
> >> >>>         Ignite igniteNode =
> >> >>> IgniteFactory.createIgniteNodeWithSpecificConfiguration("s",
> >> >>> configPath);
> >> >>>         IgniteConfiguration igniteConfiguration =
> >> >>> igniteNode.configuration();
> >> >>>         IgniteCache igniteCache = igniteNode.getOrCreateCache("
> >> >>> testCache");
> >> >>>         populateCache(igniteCache);
> >> >>>         System.out.println(igniteCache.size());
> >> >>>
> >> >>> }
> >> >>>
> >> >>> when i changed to i<7000 (in  populateCache method),  server node
> >> >>> appears(I
> >> >>> mean, i can see "[11:13:09] Topology snapshot [ver=1, servers=1,
> >> >>> clients=0,
> >> >>> CPUs=4, offheap=1.2GB, heap=1.3GB]") but too wait to write
> >> >>> System.out.println(igniteCache.size());
> >> >>>
> >> >>> Now at the same time I have created client node :
> >> >>>
> >> >>>   Ignite client =
> >> >>> IgniteFactory.createIgniteNodeWithSpecificConfiguration("c",
> >> cluster_1);
> >> >>>         IgniteCache igniteCache = client.getOrCreateCache("
> >> testCache");
> >> >>>         System.out.println(igniteCache.get(6999));
> >> >>>
> >> >>> this returns null,
> >> >>>
> >> >>> it should not return null -> it should return::
> >> >>> * cache is not ready
> >> >>> * or wait until cache is ready and get the result which is 6999
> >> >>>
> >> >>>
> >> >>>
> >> >>> --
> >> >>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
> >> >>>
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > --
> >> > Sent from: http://apache-ignite-users.70518.x6.nabble.com/
> >>
> >>
> >>
> >>
> >>
> >> --
> >> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
> >>
>
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: Waiting too long, to load 7k datas to cache.... And Client gets null value

Posted by monstereo <me...@gmail.com>.
thanks, ilya 

however, client does not wait until backup has complete. Here is the my
codes:

First I create node1, and wait until cache size is 2.000.000
Then i run another nodes (node2, client) and yes client will wait until 2
node2 runs
But i want client to wait until backup operation is done.

Because, when I use GridGain web console:
                     even if I see this output "Now consumer has all backup
" + igniteCache.size()"
                     in grid console, backup is creating, (its number is
increasing -> 100k , 805k , 1.3M ... 2M)
                     and backup is creating, client can get data(of course
gets correct result, because cache has been created before by node1)



For node 1(Create 2.000.000 datas in cache)

public static void populateCache(IgniteCache igniteCache){
        for (int i = 0; i < 2000000; i++){
            igniteCache.put(i, String.valueOf(i));
        }
    }

    public static void main(String[] args) {
        Ignite node1 = Ignition.start(defaultconfigpath);
        IgniteCountDownLatch igniteCountDownLatch =
publisher.countDownLatch(
                                            "simpleLatch", 2, false, true);


        CacheConfiguration cacheConfiguration = new CacheConfiguration();
        cacheConfiguration.setName("sampleCache");
        cacheConfiguration.setCacheMode(CacheMode.REPLICATED);
        IgniteCache igniteCache =
publisher.getOrCreateCache(cacheConfiguration);

        populateCache(igniteCache);
        System.out.println(igniteCache.size());

    }

here is the node 2:

public static void main(String[] args) {
        Ignite node2 =Ignition.start(defaultconfigpath);

        IgniteCache igniteCache = consumer.getOrCreateCache("sampleCache");

        IgniteCountDownLatch latch = consumer.countDownLatch(
                "simpleLatch", 2, false, true);

        if (igniteCache.size() == 2000000){
            System.out.println("Now consumer has all backup " +
igniteCache.size());
            System.out.println("Now decrease the latch");
            latch.countDown();
        }

    }


here is the client:

public static void main(String[] args) {
        Ignite client = Ignition.start(defaultconfigpath);
        Ignition.setClientMode(true);

        IgniteCountDownLatch latch = client.countDownLatch(
                "simpleLatch", 2, false, true);

        System.out.println("Client is wait to latch");

        latch.await();

        System.out.println("Now client can get values");
        IgniteCache igniteCache = client.getOrCreateCache("sampleCache");
        System.out.println(igniteCache.get(799999));
    }


ilya.kasnacheev wrote
> Hello!
> 
> You can use ignite.countDownLatch(). I believe we've already discussed
> this
> approach.
> 
> Regards,
> 
> -- 
> Ilya Kasnacheev
> 
> 2018-07-24 18:14 GMT+03:00 monstereo &lt;

> mehmetozanguven@

> &gt;:
> 
>> ??
>>
>> monstereo wrote
>> > thank you,
>> > As you stated, it is about my memory configuration, I solved it. (When
>> I
>> > increase the memory)
>> >
>> > But can you explain external synch. part for " "cache is not ready" if
>> the
>> > cache is already created but not populated yet. You need external sync
>> > here."
>> >
>> > Which method ignite provides for this "cache is not ready". (I am
>> looking
>> > for -> "client can not run the get method, until cache is ready.")
>> >
>> >
>> > ilya.kasnacheev wrote
>> >> Hello!
>> >>
>> >> Can you please provide the thread dump while running this code?
>> >>
>> >> Note that 10M is a very very small number for a memory model and it
>> might
>> >> affect your case.
>> >>
>> >> Also note that cache.get() should absolutely not return "cache is not
>> >> ready" if the cache is already created but not populated yet. You need
>> >> external sync here.
>> >>
>> >> Regards,
>> >>
>> >>
>> >> --
>> >> Ilya Kasnacheev
>> >>
>> >> 2018-07-23 11:22 GMT+03:00 monstereo &lt;
>> >
>> >> mehmetozanguven@
>> >
>> >> &gt;:
>> >>
>> >>> Here is the config file:
>> >>>
>> >>
>> > 
> <property name="dataStorageConfiguration">
>> >>>
>> >>
>> > 
> <bean
>>
>  >>
>> >>
>> >>  class="org.apache.ignite.configuration.DataStorageConfiguration">
>> >>>
>> >>
>> > 
> <property name="dataRegionConfigurations">
>> >>>
>> >>
>> > 
> <list>
>> >>>
>> >>
>> > 
> <bean
>>
>  >>
>> >>
>> >>  class="org.apache.ignite.configuration.DataRegionConfiguration">
>> >>>
>> >>
>> > 
> <property name="name" value="10MB_Region"/>
>> >>>
>> >>
>> > 
> <property name="initialSize"
>>
>  >>
>> >>
>> >>  value="#{10L*1024*1024}"/>
>> >>>
>> >>
>> > 
> <property name="maxSize"
>>
>  >>
>> >>
>> >>  value="#{10L*1024*1024}"/>
>> >>>
>> >>
>> > 
> <property name="pageEvictionMode"
>>
>  >>
>> >>
>> >>  value="RANDOM_2_LRU"/>
>> >>>
>> >>
>> > 
> <property name="evictionThreshold"
>>
>  >>
>> >>
>> >>  value="0.5"/>
>> >>>
>> >>
>> > 
> </bean>
>> >>>
>> >>
>> > 
> </list>
>> >>>
>> >>
>> > 
> </property>
>> >>>
>> >>
>> > 
> </bean>
>> >>>
>> >>
>> > 
> </property>
>> >>>
>> >>>
>> >>
>> > 
> <property name="cacheConfiguration">
>> >>>
>> >>
>> > 
> <bean
>>
>  >>
>> >>
>> >>  class="org.apache.ignite.configuration.CacheConfiguration">
>> >>>
>> >>>
>> >>
>> > 
> <property name="name" value="testCache"/>
>> >>>
>> >>>
>> >>
>> > 
> <property name="cacheMode" value="REPLICATED"/>
>> >>>
>> >>>
>> >>
>> > 
> <property name="dataRegionName" value="10MB_Region"/>
>> >>>
>> >>
>> > 
> </bean>
>> >>>
>> >>
>> > 
> </property>
>> >>>
>> >>>
>> >>> Here is the main app
>> >>> public static void populateCache(IgniteCache igniteCache){
>> >>>         for (int i = 0; i < 10; i++){
>> >>>             igniteCache.put(i, String.valueOf(i));
>> >>>         }
>> >>>     }
>> >>>
>> >>> public static void main(String[] args) {
>> >>>         Ignite igniteNode =
>> >>> IgniteFactory.createIgniteNodeWithSpecificConfiguration("s",
>> >>> configPath);
>> >>>         IgniteConfiguration igniteConfiguration =
>> >>> igniteNode.configuration();
>> >>>         IgniteCache igniteCache = igniteNode.getOrCreateCache("
>> >>> testCache");
>> >>>         populateCache(igniteCache);
>> >>>         System.out.println(igniteCache.size());
>> >>>
>> >>> }
>> >>>
>> >>> when i changed to i<7000 (in  populateCache method),  server node
>> >>> appears(I
>> >>> mean, i can see "[11:13:09] Topology snapshot [ver=1, servers=1,
>> >>> clients=0,
>> >>> CPUs=4, offheap=1.2GB, heap=1.3GB]") but too wait to write
>> >>> System.out.println(igniteCache.size());
>> >>>
>> >>> Now at the same time I have created client node :
>> >>>
>> >>>   Ignite client =
>> >>> IgniteFactory.createIgniteNodeWithSpecificConfiguration("c",
>> cluster_1);
>> >>>         IgniteCache igniteCache = client.getOrCreateCache("
>> testCache");
>> >>>         System.out.println(igniteCache.get(6999));
>> >>>
>> >>> this returns null,
>> >>>
>> >>> it should not return null -> it should return::
>> >>> * cache is not ready
>> >>> * or wait until cache is ready and get the result which is 6999
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>> >>>
>> >
>> >
>> >
>> >
>> >
>> > --
>> > Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>
>>
>>
>>
>>
>> --
>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>





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

Re: Waiting too long, to load 7k datas to cache.... And Client gets null value

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

You can use ignite.countDownLatch(). I believe we've already discussed this
approach.

Regards,

-- 
Ilya Kasnacheev

2018-07-24 18:14 GMT+03:00 monstereo <me...@gmail.com>:

> ??
>
> monstereo wrote
> > thank you,
> > As you stated, it is about my memory configuration, I solved it. (When I
> > increase the memory)
> >
> > But can you explain external synch. part for " "cache is not ready" if
> the
> > cache is already created but not populated yet. You need external sync
> > here."
> >
> > Which method ignite provides for this "cache is not ready". (I am looking
> > for -> "client can not run the get method, until cache is ready.")
> >
> >
> > ilya.kasnacheev wrote
> >> Hello!
> >>
> >> Can you please provide the thread dump while running this code?
> >>
> >> Note that 10M is a very very small number for a memory model and it
> might
> >> affect your case.
> >>
> >> Also note that cache.get() should absolutely not return "cache is not
> >> ready" if the cache is already created but not populated yet. You need
> >> external sync here.
> >>
> >> Regards,
> >>
> >>
> >> --
> >> Ilya Kasnacheev
> >>
> >> 2018-07-23 11:22 GMT+03:00 monstereo &lt;
> >
> >> mehmetozanguven@
> >
> >> &gt;:
> >>
> >>> Here is the config file:
> >>>
> >>
> > <property name="dataStorageConfiguration">
> >>>
> >>
> > <bean
> >>
> >>
> >>  class="org.apache.ignite.configuration.DataStorageConfiguration">
> >>>
> >>
> > <property name="dataRegionConfigurations">
> >>>
> >>
> > <list>
> >>>
> >>
> > <bean
> >>
> >>
> >>  class="org.apache.ignite.configuration.DataRegionConfiguration">
> >>>
> >>
> > <property name="name" value="10MB_Region"/>
> >>>
> >>
> > <property name="initialSize"
> >>
> >>
> >>  value="#{10L*1024*1024}"/>
> >>>
> >>
> > <property name="maxSize"
> >>
> >>
> >>  value="#{10L*1024*1024}"/>
> >>>
> >>
> > <property name="pageEvictionMode"
> >>
> >>
> >>  value="RANDOM_2_LRU"/>
> >>>
> >>
> > <property name="evictionThreshold"
> >>
> >>
> >>  value="0.5"/>
> >>>
> >>
> > </bean>
> >>>
> >>
> > </list>
> >>>
> >>
> > </property>
> >>>
> >>
> > </bean>
> >>>
> >>
> > </property>
> >>>
> >>>
> >>
> > <property name="cacheConfiguration">
> >>>
> >>
> > <bean
> >>
> >>
> >>  class="org.apache.ignite.configuration.CacheConfiguration">
> >>>
> >>>
> >>
> > <property name="name" value="testCache"/>
> >>>
> >>>
> >>
> > <property name="cacheMode" value="REPLICATED"/>
> >>>
> >>>
> >>
> > <property name="dataRegionName" value="10MB_Region"/>
> >>>
> >>
> > </bean>
> >>>
> >>
> > </property>
> >>>
> >>>
> >>> Here is the main app
> >>> public static void populateCache(IgniteCache igniteCache){
> >>>         for (int i = 0; i < 10; i++){
> >>>             igniteCache.put(i, String.valueOf(i));
> >>>         }
> >>>     }
> >>>
> >>> public static void main(String[] args) {
> >>>         Ignite igniteNode =
> >>> IgniteFactory.createIgniteNodeWithSpecificConfiguration("s",
> >>> configPath);
> >>>         IgniteConfiguration igniteConfiguration =
> >>> igniteNode.configuration();
> >>>         IgniteCache igniteCache = igniteNode.getOrCreateCache("
> >>> testCache");
> >>>         populateCache(igniteCache);
> >>>         System.out.println(igniteCache.size());
> >>>
> >>> }
> >>>
> >>> when i changed to i<7000 (in  populateCache method),  server node
> >>> appears(I
> >>> mean, i can see "[11:13:09] Topology snapshot [ver=1, servers=1,
> >>> clients=0,
> >>> CPUs=4, offheap=1.2GB, heap=1.3GB]") but too wait to write
> >>> System.out.println(igniteCache.size());
> >>>
> >>> Now at the same time I have created client node :
> >>>
> >>>   Ignite client =
> >>> IgniteFactory.createIgniteNodeWithSpecificConfiguration("c",
> cluster_1);
> >>>         IgniteCache igniteCache = client.getOrCreateCache("
> testCache");
> >>>         System.out.println(igniteCache.get(6999));
> >>>
> >>> this returns null,
> >>>
> >>> it should not return null -> it should return::
> >>> * cache is not ready
> >>> * or wait until cache is ready and get the result which is 6999
> >>>
> >>>
> >>>
> >>> --
> >>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
> >>>
> >
> >
> >
> >
> >
> > --
> > Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: Waiting too long, to load 7k datas to cache.... And Client gets null value

Posted by monstereo <me...@gmail.com>.
??

monstereo wrote
> thank you,
> As you stated, it is about my memory configuration, I solved it. (When I
> increase the memory)
> 
> But can you explain external synch. part for " "cache is not ready" if the
> cache is already created but not populated yet. You need external sync
> here."
> 
> Which method ignite provides for this "cache is not ready". (I am looking
> for -> "client can not run the get method, until cache is ready.")
> 
> 
> ilya.kasnacheev wrote
>> Hello!
>> 
>> Can you please provide the thread dump while running this code?
>> 
>> Note that 10M is a very very small number for a memory model and it might
>> affect your case.
>> 
>> Also note that cache.get() should absolutely not return "cache is not
>> ready" if the cache is already created but not populated yet. You need
>> external sync here.
>> 
>> Regards,
>> 
>> 
>> -- 
>> Ilya Kasnacheev
>> 
>> 2018-07-23 11:22 GMT+03:00 monstereo &lt;
> 
>> mehmetozanguven@
> 
>> &gt;:
>> 
>>> Here is the config file:
>>>  
>> 
> <property name="dataStorageConfiguration">
>>>                 
>> 
> <bean
>>
>>
>>  class="org.apache.ignite.configuration.DataStorageConfiguration">
>>>                     
>> 
> <property name="dataRegionConfigurations">
>>>                         
>> 
> <list>
>>>                             
>> 
> <bean
>>
>>
>>  class="org.apache.ignite.configuration.DataRegionConfiguration">
>>>                                 
>> 
> <property name="name" value="10MB_Region"/>
>>>                                 
>> 
> <property name="initialSize"
>>
>>
>>  value="#{10L*1024*1024}"/>
>>>                                 
>> 
> <property name="maxSize"
>>
>>
>>  value="#{10L*1024*1024}"/>
>>>                                 
>> 
> <property name="pageEvictionMode"
>>
>>
>>  value="RANDOM_2_LRU"/>
>>>                                 
>> 
> <property name="evictionThreshold"
>>
>>
>>  value="0.5"/>
>>>                             
>> 
> </bean>
>>>                         
>> 
> </list>
>>>                     
>> 
> </property>
>>>                 
>> 
> </bean>
>>>             
>> 
> </property>
>>>
>>>             
>> 
> <property name="cacheConfiguration">
>>>                 
>> 
> <bean
>>
>>
>>  class="org.apache.ignite.configuration.CacheConfiguration">
>>>
>>>                     
>> 
> <property name="name" value="testCache"/>
>>>
>>>                     
>> 
> <property name="cacheMode" value="REPLICATED"/>
>>>
>>>                     
>> 
> <property name="dataRegionName" value="10MB_Region"/>
>>>                 
>> 
> </bean>
>>>             
>> 
> </property>
>>>
>>>
>>> Here is the main app
>>> public static void populateCache(IgniteCache igniteCache){
>>>         for (int i = 0; i < 10; i++){
>>>             igniteCache.put(i, String.valueOf(i));
>>>         }
>>>     }
>>>
>>> public static void main(String[] args) {
>>>         Ignite igniteNode =
>>> IgniteFactory.createIgniteNodeWithSpecificConfiguration("s",
>>> configPath);
>>>         IgniteConfiguration igniteConfiguration =
>>> igniteNode.configuration();
>>>         IgniteCache igniteCache = igniteNode.getOrCreateCache("
>>> testCache");
>>>         populateCache(igniteCache);
>>>         System.out.println(igniteCache.size());
>>>
>>> }
>>>
>>> when i changed to i<7000 (in  populateCache method),  server node
>>> appears(I
>>> mean, i can see "[11:13:09] Topology snapshot [ver=1, servers=1,
>>> clients=0,
>>> CPUs=4, offheap=1.2GB, heap=1.3GB]") but too wait to write
>>> System.out.println(igniteCache.size());
>>>
>>> Now at the same time I have created client node :
>>>
>>>   Ignite client =
>>> IgniteFactory.createIgniteNodeWithSpecificConfiguration("c", cluster_1);
>>>         IgniteCache igniteCache = client.getOrCreateCache("testCache");
>>>         System.out.println(igniteCache.get(6999));
>>>
>>> this returns null,
>>>
>>> it should not return null -> it should return::
>>> * cache is not ready
>>> * or wait until cache is ready and get the result which is 6999
>>>
>>>
>>>
>>> --
>>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>>
> 
> 
> 
> 
> 
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/





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

Re: Waiting too long, to load 7k datas to cache.... And Client gets null value

Posted by monstereo <me...@gmail.com>.
thank you,
As you stated, it is about my memory configuration, I solved it. (When I
increase the memory)

But can you explain external synch. part for " "cache is not ready" if the
cache is already created but not populated yet. You need external sync
here."

Which method ignite provides for this "cache is not ready". (I am looking
for -> "client can not run the get method, until cache is ready.")


ilya.kasnacheev wrote
> Hello!
> 
> Can you please provide the thread dump while running this code?
> 
> Note that 10M is a very very small number for a memory model and it might
> affect your case.
> 
> Also note that cache.get() should absolutely not return "cache is not
> ready" if the cache is already created but not populated yet. You need
> external sync here.
> 
> Regards,
> 
> 
> -- 
> Ilya Kasnacheev
> 
> 2018-07-23 11:22 GMT+03:00 monstereo &lt;

> mehmetozanguven@

> &gt;:
> 
>> Here is the config file:
>>  
> <property name="dataStorageConfiguration">
>>                 
> <bean
>>
>  class="org.apache.ignite.configuration.DataStorageConfiguration">
>>                     
> <property name="dataRegionConfigurations">
>>                         
> <list>
>>                             
> <bean
>>
>  class="org.apache.ignite.configuration.DataRegionConfiguration">
>>                                 
> <property name="name" value="10MB_Region"/>
>>                                 
> <property name="initialSize"
>>
>  value="#{10L*1024*1024}"/>
>>                                 
> <property name="maxSize"
>>
>  value="#{10L*1024*1024}"/>
>>                                 
> <property name="pageEvictionMode"
>>
>  value="RANDOM_2_LRU"/>
>>                                 
> <property name="evictionThreshold"
>>
>  value="0.5"/>
>>                             
> </bean>
>>                         
> </list>
>>                     
> </property>
>>                 
> </bean>
>>             
> </property>
>>
>>             
> <property name="cacheConfiguration">
>>                 
> <bean
>>
>  class="org.apache.ignite.configuration.CacheConfiguration">
>>
>>                     
> <property name="name" value="testCache"/>
>>
>>                     
> <property name="cacheMode" value="REPLICATED"/>
>>
>>                     
> <property name="dataRegionName" value="10MB_Region"/>
>>                 
> </bean>
>>             
> </property>
>>
>>
>> Here is the main app
>> public static void populateCache(IgniteCache igniteCache){
>>         for (int i = 0; i < 10; i++){
>>             igniteCache.put(i, String.valueOf(i));
>>         }
>>     }
>>
>> public static void main(String[] args) {
>>         Ignite igniteNode =
>> IgniteFactory.createIgniteNodeWithSpecificConfiguration("s", configPath);
>>         IgniteConfiguration igniteConfiguration =
>> igniteNode.configuration();
>>         IgniteCache igniteCache = igniteNode.getOrCreateCache("
>> testCache");
>>         populateCache(igniteCache);
>>         System.out.println(igniteCache.size());
>>
>> }
>>
>> when i changed to i<7000 (in  populateCache method),  server node
>> appears(I
>> mean, i can see "[11:13:09] Topology snapshot [ver=1, servers=1,
>> clients=0,
>> CPUs=4, offheap=1.2GB, heap=1.3GB]") but too wait to write
>> System.out.println(igniteCache.size());
>>
>> Now at the same time I have created client node :
>>
>>   Ignite client =
>> IgniteFactory.createIgniteNodeWithSpecificConfiguration("c", cluster_1);
>>         IgniteCache igniteCache = client.getOrCreateCache("testCache");
>>         System.out.println(igniteCache.get(6999));
>>
>> this returns null,
>>
>> it should not return null -> it should return::
>> * cache is not ready
>> * or wait until cache is ready and get the result which is 6999
>>
>>
>>
>> --
>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>





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

Re: Waiting too long, to load 7k datas to cache.... And Client gets null value

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

Can you please provide the thread dump while running this code?

Note that 10M is a very very small number for a memory model and it might
affect your case.

Also note that cache.get() should absolutely not return "cache is not
ready" if the cache is already created but not populated yet. You need
external sync here.

Regards,


-- 
Ilya Kasnacheev

2018-07-23 11:22 GMT+03:00 monstereo <me...@gmail.com>:

> Here is the config file:
>  <property name="dataStorageConfiguration">
>                 <bean
> class="org.apache.ignite.configuration.DataStorageConfiguration">
>                     <property name="dataRegionConfigurations">
>                         <list>
>                             <bean
> class="org.apache.ignite.configuration.DataRegionConfiguration">
>                                 <property name="name" value="10MB_Region"/>
>                                 <property name="initialSize"
> value="#{10L*1024*1024}"/>
>                                 <property name="maxSize"
> value="#{10L*1024*1024}"/>
>                                 <property name="pageEvictionMode"
> value="RANDOM_2_LRU"/>
>                                 <property name="evictionThreshold"
> value="0.5"/>
>                             </bean>
>                         </list>
>                     </property>
>                 </bean>
>             </property>
>
>             <property name="cacheConfiguration">
>                 <bean
> class="org.apache.ignite.configuration.CacheConfiguration">
>
>                     <property name="name" value="testCache"/>
>
>                     <property name="cacheMode" value="REPLICATED"/>
>
>                     <property name="dataRegionName" value="10MB_Region"/>
>                 </bean>
>             </property>
>
>
> Here is the main app
> public static void populateCache(IgniteCache igniteCache){
>         for (int i = 0; i < 10; i++){
>             igniteCache.put(i, String.valueOf(i));
>         }
>     }
>
> public static void main(String[] args) {
>         Ignite igniteNode =
> IgniteFactory.createIgniteNodeWithSpecificConfiguration("s", configPath);
>         IgniteConfiguration igniteConfiguration =
> igniteNode.configuration();
>         IgniteCache igniteCache = igniteNode.getOrCreateCache("
> testCache");
>         populateCache(igniteCache);
>         System.out.println(igniteCache.size());
>
> }
>
> when i changed to i<7000 (in  populateCache method),  server node appears(I
> mean, i can see "[11:13:09] Topology snapshot [ver=1, servers=1, clients=0,
> CPUs=4, offheap=1.2GB, heap=1.3GB]") but too wait to write
> System.out.println(igniteCache.size());
>
> Now at the same time I have created client node :
>
>   Ignite client =
> IgniteFactory.createIgniteNodeWithSpecificConfiguration("c", cluster_1);
>         IgniteCache igniteCache = client.getOrCreateCache("testCache");
>         System.out.println(igniteCache.get(6999));
>
> this returns null,
>
> it should not return null -> it should return::
> * cache is not ready
> * or wait until cache is ready and get the result which is 6999
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>