Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Caching a Multi-tenant applicantion
Caching a Multi-tenant applicantion [message #499349] Fri, 20 November 2009 20:02 Go to next message
Geraldo Lopes de Souza is currently offline Geraldo Lopes de Souza
Messages: 6
Registered: November 2009
Junior Member
Hi,

First, let me thank you for your effort making this product available as
community open-source.

Consider a multi-tenant application, that uses a shared database with
differents schemas (one for each tenant) , with a three tier web
application.

Can you share your thoughts of how caching could be enabled in this kind
of application and what are the consequences.

Thank you in advance, and please be tolerant with my english and little
knowledge of EclipseLink

Geraldo Lopes de Souza
Re: Caching a Multi-tenant applicantion [message #499353 is a reply to message #499349] Sat, 21 November 2009 02:31 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom Eugelink
Messages: 807
Registered: July 2009
Senior Member
As soon as you have multiple clients accessing the database (in my case stand alone swing apps) you need to disable caching in order to be able to get changes made in the DB into your memory.


Geraldo Lopes de Souza wrote:
> Hi,
>
> First, let me thank you for your effort making this product available as
> community open-source.
>
> Consider a multi-tenant application, that uses a shared database with
> differents schemas (one for each tenant) , with a three tier web
> application.
>
> Can you share your thoughts of how caching could be enabled in this kind
> of application and what are the consequences.
>
> Thank you in advance, and please be tolerant with my english and little
> knowledge of EclipseLink
>
> Geraldo Lopes de Souza
>
>
>
>
Re: Caching a Multi-tenant applicantion [message #499362 is a reply to message #499353] Sat, 21 November 2009 07:25 Go to previous messageGo to next message
Geraldo Lopes de Souza is currently offline Geraldo Lopes de Souza
Messages: 6
Registered: November 2009
Junior Member
tbee,

By "disable caching" have you meant shared cache ?.
According to the docs there are 3 types of caches: Session cache, Unit
of Work Cache and Isolated Client session. Which one do you use ?


Thank you in advance,

Geraldo Lopes de Souza

References
http://wiki.eclipse.org/Introduction_to_Cache_%28ELUG%29
http://wiki.eclipse.org/Introduction_to_EclipseLink_Sessions _%28ELUG%29#Isolated_Client_Sessions


Em 21-11-2009 05:31, tbee escreveu:
> As soon as you have multiple clients accessing the database (in my case
> stand alone swing apps) you need to disable caching in order to be able
> to get changes made in the DB into your memory.
>
>
> Geraldo Lopes de Souza wrote:
>> Hi,
>>
>> First, let me thank you for your effort making this product available
>> as community open-source.
>>
>> Consider a multi-tenant application, that uses a shared database with
>> differents schemas (one for each tenant) , with a three tier web
>> application.
>>
>> Can you share your thoughts of how caching could be enabled in this
>> kind of application and what are the consequences.
>>
>> Thank you in advance, and please be tolerant with my english and
>> little knowledge of EclipseLink
>>
>> Geraldo Lopes de Souza
>>
>>
>>
>>
Re: Caching a Multi-tenant applicantion [message #499698 is a reply to message #499349] Mon, 23 November 2009 13:36 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

How are you enabling each tenant to use their own schema?

If you have a persistence-unit or EntityManagerFactory per tenant, then you should be fine with the shared cache on, which is the default.

If you have a single persistence-unit, or single EntityManagerFactory, and are configuring the different schemas per EntityManager, then you need to disable the shared cache, as each EntityManager sees different data.

The shared cache is the session cache.
It can be disabled using the persistence-unit property,
"eclipselink.cache.shared.default"="false"

You can also selectively disable/enable it for certain classes, if you have some data in a shared schema.

The UnitOfWork and IsolatedClientSession cache can be for the most part ignored, the only live as long as the EntityManager or transaction.


James : Wiki : Book : Blog : Twitter
Re: Caching a Multi-tenant applicantion [message #499794 is a reply to message #499362] Tue, 24 November 2009 03:11 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom Eugelink
Messages: 807
Registered: July 2009
Senior Member
Half my family has the mexican flue, so I needed to divert some of my time the last few day :-)

Anyhow, I'm using JPA and I configured this in order to get the changes in the DB made by other EM's, after I do a clear() on mine;

lOptions.put(PersistenceUnitProperties.CACHE_SHARED_DEFAULT, "false");

FYI: CACHE_TYPE_DEFAULT = "eclipselink.cache.type.default"


Geraldo Lopes de Souza wrote:
> tbee,
>
> By "disable caching" have you meant shared cache ?.
> According to the docs there are 3 types of caches: Session cache, Unit
> of Work Cache and Isolated Client session. Which one do you use ?
>
>
> Thank you in advance,
>
> Geraldo Lopes de Souza
>
> References
> http://wiki.eclipse.org/Introduction_to_Cache_%28ELUG%29
> http://wiki.eclipse.org/Introduction_to_EclipseLink_Sessions _%28ELUG%29#Isolated_Client_Sessions
>
>
>
> Em 21-11-2009 05:31, tbee escreveu:
>> As soon as you have multiple clients accessing the database (in my case
>> stand alone swing apps) you need to disable caching in order to be able
>> to get changes made in the DB into your memory.
>>
>>
>> Geraldo Lopes de Souza wrote:
>>> Hi,
>>>
>>> First, let me thank you for your effort making this product available
>>> as community open-source.
>>>
>>> Consider a multi-tenant application, that uses a shared database with
>>> differents schemas (one for each tenant) , with a three tier web
>>> application.
>>>
>>> Can you share your thoughts of how caching could be enabled in this
>>> kind of application and what are the consequences.
>>>
>>> Thank you in advance, and please be tolerant with my english and
>>> little knowledge of EclipseLink
>>>
>>> Geraldo Lopes de Souza
>>>
>>>
>>>
>>>
>
Re: Caching a Multi-tenant applicantion [message #499930 is a reply to message #499794] Tue, 24 November 2009 09:41 Go to previous message
Geraldo Lopes de Souza is currently offline Geraldo Lopes de Souza
Messages: 6
Registered: November 2009
Junior Member
tbee,

Thanks for the answers and good luck for you and your family.

Regards,

Geraldo

Em 24-11-2009 06:11, tbee escreveu:
> Half my family has the mexican flue, so I needed to divert some of my
> time the last few day :-)
>
> Anyhow, I'm using JPA and I configured this in order to get the changes
> in the DB made by other EM's, after I do a clear() on mine;
>
> lOptions.put(PersistenceUnitProperties.CACHE_SHARED_DEFAULT, "false");
>
> FYI: CACHE_TYPE_DEFAULT = "eclipselink.cache.type.default"
>
>
> Geraldo Lopes de Souza wrote:
>> tbee,
>>
>> By "disable caching" have you meant shared cache ?.
>> According to the docs there are 3 types of caches: Session cache, Unit
>> of Work Cache and Isolated Client session. Which one do you use ?
>>
>>
>> Thank you in advance,
>>
>> Geraldo Lopes de Souza
>>
>> References
>> http://wiki.eclipse.org/Introduction_to_Cache_%28ELUG%29
>> http://wiki.eclipse.org/Introduction_to_EclipseLink_Sessions _%28ELUG%29#Isolated_Client_Sessions
>>
>>
>>
>> Em 21-11-2009 05:31, tbee escreveu:
>>> As soon as you have multiple clients accessing the database (in my case
>>> stand alone swing apps) you need to disable caching in order to be able
>>> to get changes made in the DB into your memory.
>>>
>>>
>>> Geraldo Lopes de Souza wrote:
>>>> Hi,
>>>>
>>>> First, let me thank you for your effort making this product available
>>>> as community open-source.
>>>>
>>>> Consider a multi-tenant application, that uses a shared database with
>>>> differents schemas (one for each tenant) , with a three tier web
>>>> application.
>>>>
>>>> Can you share your thoughts of how caching could be enabled in this
>>>> kind of application and what are the consequences.
>>>>
>>>> Thank you in advance, and please be tolerant with my english and
>>>> little knowledge of EclipseLink
>>>>
>>>> Geraldo Lopes de Souza
>>>>
>>>>
>>>>
>>>>
>>
Previous Topic:Unsatisfied import package javax.lang.model.type
Next Topic:Eclipselink is spending an hour releasing write locks
Goto Forum:
  


Current Time: Fri Aug 29 18:42:18 EDT 2014

Powered by FUDForum. Page generated in 0.02066 seconds