You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geode.apache.org by Amit Pandey <am...@gmail.com> on 2017/02/26 18:42:23 UTC

How to preinitialize cache before use

Hi,

We have a region which we try to.

The first time we do that there is  some logs like :-

[info 2017/02/27 00:09:55.089 IST <main> tid=0x1] Initialization of region
_B__lots_60 completed
[info 2017/02/27 00:09:55.090 IST <main> tid=0x1] Initializing region
_B__lots_7
[info 2017/02/27 00:09:55.090 IST <main> tid=0x1] Initialization of region
_B__lots_7 completed
[info 2017/02/27 00:09:55.091 IST <main> tid=0x1] Initializing region
_B__lots_8
[info 2017/02/27 00:09:55.091 IST <main> tid=0x1] Initialization of region
_B__lots_8 completed
[info 2017/02/27 00:09:55.092 IST <main> tid=0x1] Initializing region
_B__lots_9

And I see that inserts are much slower than later when its pretty fast..In
production this flow will be done once or twice a day and we need it to be
as fast as possible. Is there any way to preinitialize these things or
avoid this the first time it is used?

Regards

Re: How to preinitialize cache before use

Posted by Amit Pandey <am...@gmail.com>.
Hey Guys,

Thanks for the reply. I think I have to use
PartitionRegionHelper.assignBucketsToPartitions()
as I use Spring Data Geode to start the servers.

Regards

On Wed, Mar 1, 2017 at 4:20 AM, Galen M O'Sullivan <go...@pivotal.io>
wrote:

> Hi Amit,
>
> Take a look at `gfsh start server --assign-buckets` if you're starting
> with GFSH (run this on the last server), or PartitionRegionHelper.assignBucketsToPartitions().
> This needs to be invoked after all of the servers are up and running.
>
> Best,
> Galen
>
> On Sun, Feb 26, 2017 at 10:42 AM, Amit Pandey <am...@gmail.com>
> wrote:
>
>> Hi,
>>
>> We have a region which we try to.
>>
>> The first time we do that there is  some logs like :-
>>
>> [info 2017/02/27 00:09:55.089 IST <main> tid=0x1] Initialization of
>> region _B__lots_60 completed
>> [info 2017/02/27 00:09:55.090 IST <main> tid=0x1] Initializing region
>> _B__lots_7
>> [info 2017/02/27 00:09:55.090 IST <main> tid=0x1] Initialization of
>> region _B__lots_7 completed
>> [info 2017/02/27 00:09:55.091 IST <main> tid=0x1] Initializing region
>> _B__lots_8
>> [info 2017/02/27 00:09:55.091 IST <main> tid=0x1] Initialization of
>> region _B__lots_8 completed
>> [info 2017/02/27 00:09:55.092 IST <main> tid=0x1] Initializing region
>> _B__lots_9
>>
>> And I see that inserts are much slower than later when its pretty
>> fast..In production this flow will be done once or twice a day and we need
>> it to be as fast as possible. Is there any way to preinitialize these
>> things or avoid this the first time it is used?
>>
>> Regards
>>
>
>

Re: How to preinitialize cache before use

Posted by Galen M O'Sullivan <go...@pivotal.io>.
Hi Amit,

Take a look at `gfsh start server --assign-buckets` if you're starting with
GFSH (run this on the last server), or
PartitionRegionHelper.assignBucketsToPartitions().  This needs to be
invoked after all of the servers are up and running.

Best,
Galen

On Sun, Feb 26, 2017 at 10:42 AM, Amit Pandey <am...@gmail.com>
wrote:

> Hi,
>
> We have a region which we try to.
>
> The first time we do that there is  some logs like :-
>
> [info 2017/02/27 00:09:55.089 IST <main> tid=0x1] Initialization of region
> _B__lots_60 completed
> [info 2017/02/27 00:09:55.090 IST <main> tid=0x1] Initializing region
> _B__lots_7
> [info 2017/02/27 00:09:55.090 IST <main> tid=0x1] Initialization of region
> _B__lots_7 completed
> [info 2017/02/27 00:09:55.091 IST <main> tid=0x1] Initializing region
> _B__lots_8
> [info 2017/02/27 00:09:55.091 IST <main> tid=0x1] Initialization of region
> _B__lots_8 completed
> [info 2017/02/27 00:09:55.092 IST <main> tid=0x1] Initializing region
> _B__lots_9
>
> And I see that inserts are much slower than later when its pretty fast..In
> production this flow will be done once or twice a day and we need it to be
> as fast as possible. Is there any way to preinitialize these things or
> avoid this the first time it is used?
>
> Regards
>

Re: How to preinitialize cache before use

Posted by Hitesh Khamesra <hi...@yahoo.com>.
See if following method helps "org.apache.geode.cache.partition.PartitionRegionHelper.assignBucketsToPartitions". This needs 
to call when all servers are up.
  /**
   * Decide which partitions will host which buckets. Gemfire normally assigns buckets to partitions
   * as needed when data is added to a partitioned region. This method provides way to assign all of
   * the buckets without putting any data in partition region. This method should not be called
   * until all of the partitions are running because it will divide the buckets between the running
   * partitions. If the buckets are already assigned this method will have no effect.
   * 
   * This method will block until all buckets are assigned.
   * 
   * @param region The region which should have it's buckets assigned.
   * @throws IllegalStateException if the provided region is something other than a
   *         {@linkplain DataPolicy#PARTITION partitioned Region}
   * @since GemFire 6.0
   */
  public static void assignBucketsToPartitions(Region<?, ?> region)

      From: Amit Pandey <am...@gmail.com>
 To: user@geode.apache.org 
 Sent: Sunday, February 26, 2017 10:42 AM
 Subject: How to preinitialize cache before use
   
Hi, 
We have a region which we try to.
The first time we do that there is  some logs like :-
[info 2017/02/27 00:09:55.089 IST <main> tid=0x1] Initialization of region _B__lots_60 completed[info 2017/02/27 00:09:55.090 IST <main> tid=0x1] Initializing region _B__lots_7[info 2017/02/27 00:09:55.090 IST <main> tid=0x1] Initialization of region _B__lots_7 completed[info 2017/02/27 00:09:55.091 IST <main> tid=0x1] Initializing region _B__lots_8[info 2017/02/27 00:09:55.091 IST <main> tid=0x1] Initialization of region _B__lots_8 completed[info 2017/02/27 00:09:55.092 IST <main> tid=0x1] Initializing region _B__lots_9
And I see that inserts are much slower than later when its pretty fast..In production this flow will be done once or twice a day and we need it to be as fast as possible. Is there any way to preinitialize these things or avoid this the first time it is used?
Regards