You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geode.apache.org by aashish choudhary <aa...@gmail.com> on 2020/07/28 16:22:42 UTC

hydrate geode local region at application startup

Hi,

Is there any geode api which can populate geode client side LOCAL region at
the application startup?. We are not using spring data geode just plain
geode api.

The use case is to avoid network hop for some region calls for which data
is static in nature and can be loaded from the geode server side at the
application startup.

This is what I have tried.

1. Create client cache region with client region shortcut as LOCAL.
2. There is a server side region from which I will first get all keys using
keySetOnServer() then will do getAll from the server side region. And this
server side region is used in Functions also so cannot remove it from the
server side.
3. Once I have the server side data in the client cache I can do putAll()
on the local region.
This is working if I just create a simple Java main class for testing
purposes but surprisingly when I tried to do the same thing with
application startup(akka-http application) it failed with
RegionDestroyedException saying Local region not found but it is
actually created on client side. I can see it in the debugging mode. I
don't know why it fails at application startup but the same code works fine
for simple Java main class.

Are there any alternative ways of doing the same thing or am I doing
something wrong?
I ended up creating the CACHING_PROXY_HEAP_LRU region for the same thing as
the data is static in nature and hardly changes(only 4k records) but was
hoping if i can hydrate the local cache region at startup.

With Best Regards,
Ashish

Re: hydrate geode local region at application startup

Posted by aashish choudhary <aa...@gmail.com>.
I can actually pass on the map from getAll() for further processing.

With best regards,
Ashish

On Tue, Jul 28, 2020, 9:52 PM aashish choudhary <
aashish.choudhary1@gmail.com> wrote:

> Hi,
>
> Is there any geode api which can populate geode client side LOCAL region
> at the application startup?. We are not using spring data geode just plain
> geode api.
>
> The use case is to avoid network hop for some region calls for which data
> is static in nature and can be loaded from the geode server side at the
> application startup.
>
> This is what I have tried.
>
> 1. Create client cache region with client region shortcut as LOCAL.
> 2. There is a server side region from which I will first get all keys
> using keySetOnServer() then will do getAll from the server side region. And
> this server side region is used in Functions also so cannot remove it from
> the server side.
> 3. Once I have the server side data in the client cache I can do putAll()
> on the local region.
> This is working if I just create a simple Java main class for testing
> purposes but surprisingly when I tried to do the same thing with
> application startup(akka-http application) it failed with
> RegionDestroyedException saying Local region not found but it is
> actually created on client side. I can see it in the debugging mode. I
> don't know why it fails at application startup but the same code works fine
> for simple Java main class.
>
> Are there any alternative ways of doing the same thing or am I doing
> something wrong?
> I ended up creating the CACHING_PROXY_HEAP_LRU region for the same thing
> as the data is static in nature and hardly changes(only 4k records) but was
> hoping if i can hydrate the local cache region at startup.
>
> With Best Regards,
> Ashish
>