Re: Cache Issue in distributed environment

2008-03-12 Thread Armin Waibel

Hi Cedric,

Cédric Talon wrote:

Hi, I am new on this mailing list and so it is my first message.



welcome to this list!



I am working on a project which is using OJB in a distributed
environment. The distributed issue is my problem ! I have read there
are important points to respect in this case.

The first one is to use Sequence Manager. It's ok for me.

The second one is the locking issue. I am using the
LockManagerRemoteImpl. So I think it is ok.


Do you use the ODMG-api implementation?
http://db.apache.org/ojb/docu/guides/odmg-guide.html
Only this implementation supports pessimistic locking by default.
The PB-api
http://db.apache.org/ojb/docu/guides/pb-guide.html
only supports optimistic locking by default.
http://db.apache.org/ojb/docu/guides/lockmanager.html

For best performance I would recommend to use optimistic locking (needs 
a 'version' column in the database table) for all concurrent modified 
persistence objects.




The last point is the cache issue. And this is the subject of this
mail. Currently I am using ObjectCacheDefaultImpl. I know it is not
suitable for distributed environment. That's why I'd like to use
distributed cache.


Here you can find a short description how the cache works
http://www.mail-archive.com/ojb-user@db.apache.org/msg16075.html
My estimation is that in most cases OJB will benefit more from a fast 
DB/DB-cache/network (in combination with a session cache) than from a 
distributed cache (except you do a lot of get object by identity stuff).

I would recommend to run some load tests with/without distributed cache.



I have heard about OS Cache but it requires a multicast network. It
is not possible in my case. I have heard about JCS too. Has anybody
ever used it? 


Sorry, I don't have experience in this.


I don't find information to configure it with OJB. Can
anybody help me ?


If you use OJB 1.0.5rc1 change the object-cache element within your 
jdbc-connection-descriptor to


one global cache region:
object-cache class=JCS
/object-cache

a cache region for each class:
object-cache class=JCSPerClass
/object-cache

For version 1.0.4 specifiy the full qualified class name (e.g. 
org.apache.ojb.broker.cache.ObjectCacheJCSPerClassImpl).


You can configure the JCS cache via the cache.ccf properties file.

regards,
Armin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Cache Issue in distributed environment

2008-03-12 Thread Armin Waibel

Armin Waibel wrote:

I don't find information to configure it with OJB. Can
anybody help me ?


If you use OJB 1.0.5rc1 change the object-cache element within your 
jdbc-connection-descriptor to


one global cache region:
object-cache class=JCS
/object-cache

a cache region for each class:
object-cache class=JCSPerClass
/object-cache

For version 1.0.4 specifiy the full qualified class name (e.g. 
org.apache.ojb.broker.cache.ObjectCacheJCSPerClassImpl).


You can configure the JCS cache via the cache.ccf properties file.


Sorry, I have to clarify my last post.
I would recommend to use the two level cache with the distributed cache 
as second level cache.

If you use OJB 1.0.5rc1:

object-cache class=twoLevel
!-- ObjectCacheTwoLevelImpl attributes --
attribute attribute-name=applicationCache attribute-value=jcs/
attribute attribute-name=copyStrategy attribute-value=default/
attribute attribute-name=forceProxies attribute-value=false/
/object-cache

OJB 1.0.4:

object-cache class=org.apache.ojb.broker.cache.ObjectCacheTwoLevelImpl
!-- ObjectCacheTwoLevelImpl attributes --
attribute attribute-name=applicationCache 
attribute-value=org.apache.ojb.broker.cache.ObjectCacheJCSImpl/
attribute attribute-name=copyStrategy 
attribute-value=org.apache.ojb.broker.cache.ObjectCacheTwoLevelImpl$CopyStrategyImpl/

attribute attribute-name=forceProxies attribute-value=false/
/object-cache

regards,
Armin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Cache Issue in distributed environment

2008-03-11 Thread Cédric Talon
Hi,
I am new on this mailing list and so it is my first message.

I am working on a project which is using OJB in a distributed environment.
The distributed issue is my problem ! I have read there are important points to 
respect in this case.

The first one is to use Sequence Manager. It's ok for me.

The second one is the locking issue. I am using the LockManagerRemoteImpl. So I 
think it is ok.

The last point is the cache issue. And this is the subject of this mail. 
Currently I am using ObjectCacheDefaultImpl. I know it is not suitable for 
distributed environment. That's why I'd like to use distributed cache.

I have heard about OS Cache but it requires a multicast network. It is not 
possible in my case.
I have heard about JCS too. Has anybody ever used it? I don't find information 
to configure it with OJB. Can anybody help me ?

Regards
Cedric TALON

Clear cache issue!

2006-10-16 Thread Vagula

Hi All,



I'm using the following code:



QueryByCriteria queryByCriteria =

new QueryByCriteria(RefInfoData.class, criteria,
true);



broker.clearCache();



Collection refInfo =

(Collection)
broker.getCollectionByQuery(queryByCriteria);   



For the class 'RefInfoData' we have set the cache level as
default implementation.



When we use the method broker.clearCache() we are facing
performance issues.

But when we don't clear cache there is dirty read.

   

We are maintaining the cache for reference tables.



Is there a way to clear cache for the specific object
instead of whole cache?





Regards,

Vagula







 CAUTION - Disclaimer *
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
for the use of the addressee(s). If you are not the intended recipient, please 
notify the sender by e-mail and delete the original message. Further, you are 
not to copy, disclose, or distribute this e-mail or its contents to any other 
person and any such actions are unlawful. This e-mail may contain viruses. 
Infosys has taken every reasonable precaution to minimize this risk, but is not 
liable for any damage you may sustain as a result of any virus in this e-mail. 
You should carry out your own virus checks before opening the e-mail or 
attachment. Infosys reserves the right to monitor and review the content of all 
messages sent to or from this e-mail address. Messages sent to or from this 
e-mail address may be stored on the Infosys e-mail system.
***INFOSYS End of Disclaimer INFOSYS***

Re: Clear cache issue!

2006-10-16 Thread Vasily Ivanov

Hi Vagula,

Consider this one:
broker.removeFromCache(entityOrId);

Cheers,
 Vasily

On 10/16/06, Vagula [EMAIL PROTECTED] wrote:


Hi All,



I'm using the following code:



QueryByCriteria queryByCriteria =

new QueryByCriteria(RefInfoData.class, criteria,
true);



broker.clearCache();



Collection refInfo =

(Collection)
broker.getCollectionByQuery(queryByCriteria);



For the class 'RefInfoData' we have set the cache level as
default implementation.



When we use the method broker.clearCache() we are facing
performance issues.

But when we don't clear cache there is dirty read.



We are maintaining the cache for reference tables.



Is there a way to clear cache for the specific object
instead of whole cache?





Regards,

Vagula







 CAUTION - Disclaimer *
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
for the use of the addressee(s). If you are not the intended recipient, please 
notify the sender by e-mail and delete the original message. Further, you are 
not to copy, disclose, or distribute this e-mail or its contents to any other 
person and any such actions are unlawful. This e-mail may contain viruses. 
Infosys has taken every reasonable precaution to minimize this risk, but is not 
liable for any damage you may sustain as a result of any virus in this e-mail. 
You should carry out your own virus checks before opening the e-mail or 
attachment. Infosys reserves the right to monitor and review the content of all 
messages sent to or from this e-mail address. Messages sent to or from this 
e-mail address may be stored on the Infosys e-mail system.
***INFOSYS End of Disclaimer INFOSYS***



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Clear cache issue!

2006-10-16 Thread Vagula
Hi,

I tried this:
broker.removeFromCache(entityOrId);
But this also results in dirty read.

Regards,
Vagula 
 

-Original Message-
From: Vasily Ivanov [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 16, 2006 12:51 PM
To: OJB Users List
Subject: Re: Clear cache issue!

Hi Vagula,

Consider this one:
broker.removeFromCache(entityOrId);

Cheers,
  Vasily

On 10/16/06, Vagula [EMAIL PROTECTED] wrote:

 Hi All,



 I'm using the following code:



 QueryByCriteria queryByCriteria =

 new QueryByCriteria(RefInfoData.class,
criteria,
 true);



 broker.clearCache();



 Collection refInfo =

 (Collection)
 broker.getCollectionByQuery(queryByCriteria);



 For the class 'RefInfoData' we have set the cache level as
 default implementation.



 When we use the method broker.clearCache() we are facing
 performance issues.

 But when we don't clear cache there is dirty read.



 We are maintaining the cache for reference tables.



 Is there a way to clear cache for the specific object
 instead of whole cache?





 Regards,

 Vagula







  CAUTION - Disclaimer *
 This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended
solely for the use of the addressee(s). If you are not the intended
recipient, please notify the sender by e-mail and delete the original
message. Further, you are not to copy, disclose, or distribute this
e-mail or its contents to any other person and any such actions are
unlawful. This e-mail may contain viruses. Infosys has taken every
reasonable precaution to minimize this risk, but is not liable for any
damage you may sustain as a result of any virus in this e-mail. You
should carry out your own virus checks before opening the e-mail or
attachment. Infosys reserves the right to monitor and review the content
of all messages sent to or from this e-mail address. Messages sent to or
from this e-mail address may be stored on the Infosys e-mail system.
 ***INFOSYS End of Disclaimer INFOSYS***


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Cache issue

2004-02-14 Thread Armin Waibel
Hi Tino,

I don't think that OJB is the problem (but maybe I'm wrong). The only 
difference between the Criteria is the 'distinct' flag. So I this Access 
has a problem with the distinct flag. Please enable p6spy to trace the 
generated SQL statements.
See
http://db.apache.org/ojb/faq.html#How can I trace and/or profile SQL 
statements executed by OJB?

How does the generated SQL for both Criteria look like?
Try to invoke these statements against your DB and compare the results.
If both statements return the same result ... OJB has a problem ;-)
regards,
Armin
Tino Schöllhorn wrote:
Hello Armin,

I could pinpoint the described error. It all boils to the 
QueryFactory.newQuery(Class, Criteria, boolean) method. if I execute the 
code to retrieve an instance of class Person with:

Criteria crit = new Criteria();
crit.addEqualTo(id, 85);
Query query = QueryFactory.newQuery(Person.class, crit);
   
Collection c = pb.getCollectionByQuery(query);
 and so on

everything works perfectly and the instances of Person are instantiated 
correctly. But if I use the method described in the first place:

Criteria crit = new Criteria();
crit.addEqualTo(id, 85);
Query query = QueryFactory.newQuery(Person.class, crit, true);
After that query the LONGVARCHARS aren't correctly instantiated.

I think that this might be an error of OJB.

With regards
Tino




Armin Waibel wrote:

Hi,

Tino Schöllhorn wrote:

Hi,

I have (again) something weird which I suppose is just a 
configuration problem:

I have a class Person which has one LONGVARCHAR-Field. The first time 
the object is accessed the LONGVARCHAR-field is returned correctly.


hmm, does this mean first time after creation? Which cache was used?
Maybe first time after store it was found in cache, second time it was 
read from DB. So I assume your database truncate the String on insert.
Maybe I'm wrong ;-)

regards,
Armin
But the second time it is accessed it returns just 256 (I suppose) 
characters.

I am using Access as 'database' but I don't think this is the problem.

Do you have any ideas what I could try?
Tino


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Cache issue

2004-02-13 Thread Armin Waibel
Hi,

Tino Schöllhorn wrote:

Hi,

I have (again) something weird which I suppose is just a configuration 
problem:

I have a class Person which has one LONGVARCHAR-Field. The first time 
the object is accessed the LONGVARCHAR-field is returned correctly.
hmm, does this mean first time after creation? Which cache was used?
Maybe first time after store it was found in cache, second time it was 
read from DB. So I assume your database truncate the String on insert.
Maybe I'm wrong ;-)

regards,
Armin
But 
the second time it is accessed it returns just 256 (I suppose) characters.

I am using Access as 'database' but I don't think this is the problem.

Do you have any ideas what I could try?
Tino


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Cache issue

2004-02-13 Thread Tino Schöllhorn
Hello Armin,

I could pinpoint the described error. It all boils to the 
QueryFactory.newQuery(Class, Criteria, boolean) method. if I execute the 
code to retrieve an instance of class Person with:

Criteria crit = new Criteria();
crit.addEqualTo(id, 85);
Query query = QueryFactory.newQuery(Person.class, crit);

Collection c = pb.getCollectionByQuery(query);
 and so on
everything works perfectly and the instances of Person are instantiated 
correctly. But if I use the method described in the first place:

Criteria crit = new Criteria();
crit.addEqualTo(id, 85);
Query query = QueryFactory.newQuery(Person.class, crit, true);
After that query the LONGVARCHARS aren't correctly instantiated.

I think that this might be an error of OJB.

With regards
Tino




Armin Waibel wrote:

Hi,

Tino Schöllhorn wrote:

Hi,

I have (again) something weird which I suppose is just a configuration 
problem:

I have a class Person which has one LONGVARCHAR-Field. The first time 
the object is accessed the LONGVARCHAR-field is returned correctly.


hmm, does this mean first time after creation? Which cache was used?
Maybe first time after store it was found in cache, second time it was 
read from DB. So I assume your database truncate the String on insert.
Maybe I'm wrong ;-)

regards,
Armin
But the second time it is accessed it returns just 256 (I suppose) 
characters.

I am using Access as 'database' but I don't think this is the problem.

Do you have any ideas what I could try?
Tino


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]