You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Christian Grobmeier <gr...@gmail.com> on 2013/05/29 12:14:20 UTC

Scale out

Hi all,

my app runs well with Cayenne and gets good feedback. With growing
data, I need to start thinking about my scaling options. I know about
ROP, but I would like to use some kind of "shared caching" or so.
Like:

DB SERVER ------> App + Cayenne 1
                    +----> App + Cayenne 2

Not sure what are my best options. Any ideas/pointers what might work well?

For background, I am currently running on EC2 but would like to have
the opportunity to just start another EC2 with the same
app/configuration. My concern is the Cayenne caching mostly. What if
App1 is doing an update and the next requests select from App2?

Thanks,
Christian


--
http://www.grobmeier.de
https://www.timeandbill.de

Re: Scale out

Posted by Christian Grobmeier <gr...@gmail.com>.
On Sat, Jun 1, 2013 at 4:45 AM, Malcolm Edgar <ma...@gmail.com>wrote:

> what about doing something virtual with a Connect session or eqquivalent.
>
>
Thanks Malcom! I am afraid I don't understand what you mean by that?


> regards Malcolm
>
>
> On 31/05/2013, at 10:38 PM, Andrus Adamchik <an...@objectstyle.org>
> wrote:
>
> >
> > On May 31, 2013, at 3:21 PM, Christian Grobmeier <gr...@gmail.com>
> wrote:
> >
> >> Thanks all for your comments and the ideas
> >> Looks like it is not an easy task and I am glad I asked so early. I
> >> will most likely not check terracotta, I am hoping for an easy
> >> solution. :-(
> >
> > Cache groups are fairly easy and lightweight if you are ready to make a
> few tradeoffs. So don't despair.
> >
> >> Unfortunately Montreal is pretty far from Germany, I would have loved
> >> to check this training out.
> >> If you want to do something like that in my country, i will happily
> assist.
> >
> > That'll be great :) I am only 2 hours flight away from Germany for most
> of the year. I've no idea how to make a successful Cayenne-only event
> though. The community is not that large and geographically spread across
> the globe. So we can either do something low key / informal thing or do a
> barcamp at some Apache event. WDYT?
> >
> > Andrus
> >
>



-- 
http://www.grobmeier.de
https://www.timeandbill.de

Re: Scale out

Posted by Malcolm Edgar <ma...@gmail.com>.
what about doing something virtual with a Connect session or eqquivalent.

regards Malcolm


On 31/05/2013, at 10:38 PM, Andrus Adamchik <an...@objectstyle.org> wrote:

> 
> On May 31, 2013, at 3:21 PM, Christian Grobmeier <gr...@gmail.com> wrote:
> 
>> Thanks all for your comments and the ideas
>> Looks like it is not an easy task and I am glad I asked so early. I
>> will most likely not check terracotta, I am hoping for an easy
>> solution. :-(
> 
> Cache groups are fairly easy and lightweight if you are ready to make a few tradeoffs. So don't despair.
> 
>> Unfortunately Montreal is pretty far from Germany, I would have loved
>> to check this training out.
>> If you want to do something like that in my country, i will happily assist.
> 
> That'll be great :) I am only 2 hours flight away from Germany for most of the year. I've no idea how to make a successful Cayenne-only event though. The community is not that large and geographically spread across the globe. So we can either do something low key / informal thing or do a barcamp at some Apache event. WDYT?
> 
> Andrus
> 

Re: Scale out

Posted by Christian Grobmeier <gr...@gmail.com>.
On Sat, Jun 1, 2013 at 8:02 AM, Andrus Adamchik <an...@objectstyle.org> wrote:
>
> On Jun 1, 2013, at 7:34 AM, Christian Grobmeier <gr...@gmail.com> wrote:
>
>>>
>>> what about doing something virtual with a Connect session or eqquivalent.
>>>
>>>
>> Thanks Malcom! I am afraid I don't understand what you mean by that?
>
> I think Malcolm is talking about an online Cayenne presentation. BTW I'll probably have videos from Montreal too.

It would be very cool to watch them.

> On Jun 1, 2013, at 7:34 AM, Christian Grobmeier <gr...@gmail.com> wrote:
>> Speaking about the actual challenges of creating an ORM gives the
>> opportunity to tell what is different to the big players. Listeners might
>> hear things which are relevant on the dayjob, even when they use Hibernate.
>
> I'll think about it, could be a great idea. Let's maybe brainstorm it after I am done with WOWODC.

Sure, no problem! Just ping me in private and we'll deal something out.

Cheers
Christian

> Thanks,
> Andrus



--
http://www.grobmeier.de
https://www.timeandbill.de

Re: Scale out

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Jun 1, 2013, at 7:34 AM, Christian Grobmeier <gr...@gmail.com> wrote:

>> 
>> what about doing something virtual with a Connect session or eqquivalent.
>> 
>> 
> Thanks Malcom! I am afraid I don't understand what you mean by that?

I think Malcolm is talking about an online Cayenne presentation. BTW I'll probably have videos from Montreal too.

On Jun 1, 2013, at 7:34 AM, Christian Grobmeier <gr...@gmail.com> wrote:
> I am currently starting with opensource.io and under this umbrella I
> organize a Struts Hackathon in Augsburg (near Munich). It's having 2 or 3
> talks on a Friday and a whole-day hackathon on Saturday. For Cayenne I
> could imagine something similar. Maybe people don't want to "Learn Cayenne
> Part 2", because they are often using Hibernate at their day jobs. But
> "Behind the scenes of an ORM" is different.
> 
> Speaking about the actual challenges of creating an ORM gives the
> opportunity to tell what is different to the big players. Listeners might
> hear things which are relevant on the dayjob, even when they use Hibernate.

I'll think about it, could be a great idea. Let's maybe brainstorm it after I am done with WOWODC.

Thanks,
Andrus

Re: Scale out

Posted by Christian Grobmeier <gr...@gmail.com>.
On Fri, May 31, 2013 at 2:38 PM, Andrus Adamchik <an...@objectstyle.org>wrote:

>
> On May 31, 2013, at 3:21 PM, Christian Grobmeier <gr...@gmail.com>
> wrote:
>
> > Thanks all for your comments and the ideas
> > Looks like it is not an easy task and I am glad I asked so early. I
> > will most likely not check terracotta, I am hoping for an easy
> > solution. :-(
>
> Cache groups are fairly easy and lightweight if you are ready to make a
> few tradeoffs. So don't despair.


I will look into them, thanks.


>  > Unfortunately Montreal is pretty far from Germany, I would have loved
> > to check this training out.
> > If you want to do something like that in my country, i will happily
> assist.
>
> That'll be great :) I am only 2 hours flight away from Germany for most of
> the year. I've no idea how to make a successful Cayenne-only event though.
> The community is not that large and geographically spread across the globe.
> So we can either do something low key / informal thing or do a barcamp at
> some Apache event. WDYT?
>

I am currently starting with opensource.io and under this umbrella I
organize a Struts Hackathon in Augsburg (near Munich). It's having 2 or 3
talks on a Friday and a whole-day hackathon on Saturday. For Cayenne I
could imagine something similar. Maybe people don't want to "Learn Cayenne
Part 2", because they are often using Hibernate at their day jobs. But
"Behind the scenes of an ORM" is different.

Speaking about the actual challenges of creating an ORM gives the
opportunity to tell what is different to the big players. Listeners might
hear things which are relevant on the dayjob, even when they use Hibernate.

Maybe even a Hackathon makes sense. I am just trying this concept, but my
idea is to not only tell people of the great features of $x, but also how
they can learn from the code.

Unfortunately I don't know other Apache events in my region (there is
sometimes a bit in Berlin). A talk alone is of course possible too, but
maybe its this hard core nerd stuff which draws a few people. After all,
this is a great chance to speak to somebody who has a real clue on ORM.



>
> Andrus
>
>


-- 
http://www.grobmeier.de
https://www.timeandbill.de

Re: Scale out

Posted by Andrus Adamchik <an...@objectstyle.org>.
On May 31, 2013, at 3:21 PM, Christian Grobmeier <gr...@gmail.com> wrote:

> Thanks all for your comments and the ideas
> Looks like it is not an easy task and I am glad I asked so early. I
> will most likely not check terracotta, I am hoping for an easy
> solution. :-(

Cache groups are fairly easy and lightweight if you are ready to make a few tradeoffs. So don't despair.

> Unfortunately Montreal is pretty far from Germany, I would have loved
> to check this training out.
> If you want to do something like that in my country, i will happily assist.

That'll be great :) I am only 2 hours flight away from Germany for most of the year. I've no idea how to make a successful Cayenne-only event though. The community is not that large and geographically spread across the globe. So we can either do something low key / informal thing or do a barcamp at some Apache event. WDYT?

Andrus


Re: Scale out

Posted by Christian Grobmeier <gr...@gmail.com>.
Thanks all for your comments and the ideas
Looks like it is not an easy task and I am glad I asked so early. I
will most likely not check terracotta, I am hoping for an easy
solution. :-(

Unfortunately Montreal is pretty far from Germany, I would have loved
to check this training out.
If you want to do something like that in my country, i will happily assist.

Cheers
Christian



On Thu, May 30, 2013 at 8:33 AM, Andrus Adamchik <an...@objectstyle.org> wrote:
> I second all the suggestions here. My rules of thumb are:
>
> * Don't try to sync individual objects. You can't cluster that well (whatever Terracotta might claim, there are issues beyond transferring object state).
> * Turn off object cache syncing completely, even within a single VM, to get consistent behavior across the cluster.
> * Use query cache. It can be clustered very efficiently.
> * Setup lifecycle events to kick certain cache groups when certain objects are modified
> * Consider optimistic locking
>
> BTW I will be discussing caching in great detail at WOWODC Cayenne Training Day in Montreal this summer ;)
>
> http://www.wocommunity.org/wowodc13/cayenne.html
>
> Andrus
>
> On May 30, 2013, at 5:02 AM, Malcolm Edgar <ma...@gmail.com> wrote:
>
>> I have found using Caching Groups with relatively short timeouts 15
>> seconds, can have a huge performance benefit while still keeping most data
>> quite fresh.
>>
>>
>> On Thu, May 30, 2013 at 11:21 AM, Mike Kienenberger <mk...@gmail.com>wrote:
>>
>>> And be careful not to overdo it.   I made that mistake in my first
>>> ecommerce app.
>>>
>>> In hindsight, it was sufficient to make sure the data was refreshed at
>>> the beginning of each request, rather than "as soon as possible".
>>>
>>>
>>> On Wed, May 29, 2013 at 7:39 PM, Aristedes Maniatis <ar...@maniatis.org>
>>> wrote:
>>>> On 29/05/13 8:14pm, Christian Grobmeier wrote:
>>>>>
>>>>> My concern is the Cayenne caching mostly. What if
>>>>> App1 is doing an update and the next requests select from App2?
>>>>
>>>>
>>>> No one can answer this other than you. What does happen?
>>>>
>>>> Are you writing an ecommerce system where data has to be fresh to the
>>>> millisecond? Or does data need to be consistent per user/session? If the
>>>> latter, sticky sessions will help you. If the former, you may need to
>>> remove
>>>> the cache entirely or use a distributed cache like Terracotta [1]
>>>>
>>>> From my own experience with distributed caching, it can get very
>>> complicated
>>>> very quickly. Luckily we were able to avoid all caching in the critical
>>>> parts of the application, and plenty of non-distributed caching in the
>>> other
>>>> parts where performance was critical but 20 minutes of staleness was OK.
>>>>
>>>> Ari
>>>>
>>>>
>>>> [1]
>>>>
>>> http://www.ehcache.org/documentation/2.4/terracotta/distributed-caching-with-terracotta
>>>>
>>>> --
>>>> -------------------------->
>>>> Aristedes Maniatis
>>>> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
>>>
>



-- 
http://www.grobmeier.de
https://www.timeandbill.de

Re: Scale out

Posted by Aristedes Maniatis <ar...@maniatis.org>.
On 30/05/13 4:33pm, Andrus Adamchik wrote:
> * Don't try to sync individual objects. You can't cluster that well (whatever Terracotta might claim, there are issues beyond transferring object state).

Yes, and one more thing to think about: what happens when you upgrade an instance on your cluster to a new version of the application. You'll end up with serialisation errors for objects which are different versions as they are synced between instances. So you will need to end up with at least two groups of clusters, each with their own backing cache, and upgrade each group as a set.

This is the same problem as having distributed sessions (rather than sticky sessions) and I've not ever found a good solution for it. But with a distributed cache the problem is even worse.


Ari


-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Re: Scale out

Posted by Andrus Adamchik <an...@objectstyle.org>.
I second all the suggestions here. My rules of thumb are:

* Don't try to sync individual objects. You can't cluster that well (whatever Terracotta might claim, there are issues beyond transferring object state).
* Turn off object cache syncing completely, even within a single VM, to get consistent behavior across the cluster.
* Use query cache. It can be clustered very efficiently.
* Setup lifecycle events to kick certain cache groups when certain objects are modified
* Consider optimistic locking

BTW I will be discussing caching in great detail at WOWODC Cayenne Training Day in Montreal this summer ;)
 
http://www.wocommunity.org/wowodc13/cayenne.html

Andrus

On May 30, 2013, at 5:02 AM, Malcolm Edgar <ma...@gmail.com> wrote:

> I have found using Caching Groups with relatively short timeouts 15
> seconds, can have a huge performance benefit while still keeping most data
> quite fresh.
> 
> 
> On Thu, May 30, 2013 at 11:21 AM, Mike Kienenberger <mk...@gmail.com>wrote:
> 
>> And be careful not to overdo it.   I made that mistake in my first
>> ecommerce app.
>> 
>> In hindsight, it was sufficient to make sure the data was refreshed at
>> the beginning of each request, rather than "as soon as possible".
>> 
>> 
>> On Wed, May 29, 2013 at 7:39 PM, Aristedes Maniatis <ar...@maniatis.org>
>> wrote:
>>> On 29/05/13 8:14pm, Christian Grobmeier wrote:
>>>> 
>>>> My concern is the Cayenne caching mostly. What if
>>>> App1 is doing an update and the next requests select from App2?
>>> 
>>> 
>>> No one can answer this other than you. What does happen?
>>> 
>>> Are you writing an ecommerce system where data has to be fresh to the
>>> millisecond? Or does data need to be consistent per user/session? If the
>>> latter, sticky sessions will help you. If the former, you may need to
>> remove
>>> the cache entirely or use a distributed cache like Terracotta [1]
>>> 
>>> From my own experience with distributed caching, it can get very
>> complicated
>>> very quickly. Luckily we were able to avoid all caching in the critical
>>> parts of the application, and plenty of non-distributed caching in the
>> other
>>> parts where performance was critical but 20 minutes of staleness was OK.
>>> 
>>> Ari
>>> 
>>> 
>>> [1]
>>> 
>> http://www.ehcache.org/documentation/2.4/terracotta/distributed-caching-with-terracotta
>>> 
>>> --
>>> -------------------------->
>>> Aristedes Maniatis
>>> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
>> 


Re: Scale out

Posted by Malcolm Edgar <ma...@gmail.com>.
I have found using Caching Groups with relatively short timeouts 15
seconds, can have a huge performance benefit while still keeping most data
quite fresh.


On Thu, May 30, 2013 at 11:21 AM, Mike Kienenberger <mk...@gmail.com>wrote:

> And be careful not to overdo it.   I made that mistake in my first
> ecommerce app.
>
> In hindsight, it was sufficient to make sure the data was refreshed at
> the beginning of each request, rather than "as soon as possible".
>
>
> On Wed, May 29, 2013 at 7:39 PM, Aristedes Maniatis <ar...@maniatis.org>
> wrote:
> > On 29/05/13 8:14pm, Christian Grobmeier wrote:
> >>
> >> My concern is the Cayenne caching mostly. What if
> >> App1 is doing an update and the next requests select from App2?
> >
> >
> > No one can answer this other than you. What does happen?
> >
> > Are you writing an ecommerce system where data has to be fresh to the
> > millisecond? Or does data need to be consistent per user/session? If the
> > latter, sticky sessions will help you. If the former, you may need to
> remove
> > the cache entirely or use a distributed cache like Terracotta [1]
> >
> > From my own experience with distributed caching, it can get very
> complicated
> > very quickly. Luckily we were able to avoid all caching in the critical
> > parts of the application, and plenty of non-distributed caching in the
> other
> > parts where performance was critical but 20 minutes of staleness was OK.
> >
> > Ari
> >
> >
> > [1]
> >
> http://www.ehcache.org/documentation/2.4/terracotta/distributed-caching-with-terracotta
> >
> > --
> > -------------------------->
> > Aristedes Maniatis
> > GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
>

Re: Scale out

Posted by Mike Kienenberger <mk...@gmail.com>.
And be careful not to overdo it.   I made that mistake in my first
ecommerce app.

In hindsight, it was sufficient to make sure the data was refreshed at
the beginning of each request, rather than "as soon as possible".


On Wed, May 29, 2013 at 7:39 PM, Aristedes Maniatis <ar...@maniatis.org> wrote:
> On 29/05/13 8:14pm, Christian Grobmeier wrote:
>>
>> My concern is the Cayenne caching mostly. What if
>> App1 is doing an update and the next requests select from App2?
>
>
> No one can answer this other than you. What does happen?
>
> Are you writing an ecommerce system where data has to be fresh to the
> millisecond? Or does data need to be consistent per user/session? If the
> latter, sticky sessions will help you. If the former, you may need to remove
> the cache entirely or use a distributed cache like Terracotta [1]
>
> From my own experience with distributed caching, it can get very complicated
> very quickly. Luckily we were able to avoid all caching in the critical
> parts of the application, and plenty of non-distributed caching in the other
> parts where performance was critical but 20 minutes of staleness was OK.
>
> Ari
>
>
> [1]
> http://www.ehcache.org/documentation/2.4/terracotta/distributed-caching-with-terracotta
>
> --
> -------------------------->
> Aristedes Maniatis
> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Re: Scale out

Posted by Aristedes Maniatis <ar...@maniatis.org>.
On 29/05/13 8:14pm, Christian Grobmeier wrote:
> My concern is the Cayenne caching mostly. What if
> App1 is doing an update and the next requests select from App2?

No one can answer this other than you. What does happen?

Are you writing an ecommerce system where data has to be fresh to the millisecond? Or does data need to be consistent per user/session? If the latter, sticky sessions will help you. If the former, you may need to remove the cache entirely or use a distributed cache like Terracotta [1]

 From my own experience with distributed caching, it can get very complicated very quickly. Luckily we were able to avoid all caching in the critical parts of the application, and plenty of non-distributed caching in the other parts where performance was critical but 20 minutes of staleness was OK.

Ari


[1] http://www.ehcache.org/documentation/2.4/terracotta/distributed-caching-with-terracotta

-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A