[jboss-user] [JBossCache] - Re: Cache loader questions

2007-11-29 Thread mircea.markus
servus, ai dreptate, scuze :(
you are right, my bad.

The thing is that the cache loader itself know how to load data in batch, but 
the calling code does not use this. I've updated 
http://jira.jboss.com/jira/browse/JBCACHE-1221

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108843#4108843

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4108843
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBossCache] - Re: Cache loader questions

2007-11-23 Thread aditsu
Hi, I think you're wrong about point 1. I wrote a simple test:

package aditsu;
  | 
  | import java.io.IOException;
  | import java.util.HashMap;
  | import java.util.Map;
  | 
  | import org.apache.log4j.BasicConfigurator;
  | import org.jboss.cache.Cache;
  | import org.jboss.cache.DefaultCacheFactory;
  | import org.jboss.cache.Fqn;
  | 
  | public class JDBCTest {
  | 
  | public static void main(final String... args) throws IOException {
  | BasicConfigurator.configure();
  | Cache c = 
DefaultCacheFactory.getInstance().createCache("aditsu/cache-jdbc.xml");
  | Map m = new HashMap();
  | c.put(new Fqn("a"), m);
  | c.put(new Fqn("b"), m);
  | c.put(new Fqn("c"), m);
  | c.stop();
  | c.destroy();
  | System.in.read();
  | c.create();
  | c.start();
  | }
  | }

and this is my cache config:


  | 
  | 
  | 
  | org.jboss.cache.transaction.DummyTransactionManagerLookup
  | REPEATABLE_READ
  | LOCAL
  | 
  | 
  | false
  | /
  | 
  | org.jboss.cache.loader.JDBCCacheLoader
  | 
  | cache.jdbc.table.name=jbosscache
  | cache.jdbc.table.create=true
  | cache.jdbc.table.drop=false
  | cache.jdbc.table.primarykey=jbosscache_pk
  | cache.jdbc.fqn.column=fqn
  | cache.jdbc.fqn.type=varchar(255)
  | cache.jdbc.node.column=node
  | cache.jdbc.node.type=bytea
  | cache.jdbc.parent.column=parent
  | cache.jdbc.driver=org.postgresql.Driver
  | cache.jdbc.url=jdbc:postgresql://localhost/jbc
  | cache.jdbc.user=postgres
  | cache.jdbc.password=
  | cache.jdbc.sql-concat=concat(1,2)
  | 
  | false
  | true
  | false
  | false
  | 
  | 
  | 
  | 
  | 

When I start the cache the 2nd time (after pressing enter), I get these log 
entries:

5226 [main] DEBUG org.jboss.cache.loader.JDBCCacheLoader  - executing sql: 
select node from jbosscache where fqn=? (/)
5229 [main] DEBUG org.jboss.cache.CacheImpl.JBossCache-Cluster  - cache mode is 
local, will not create the channel
5229 [main] DEBUG org.jboss.cache.loader.CacheLoaderManager  - preloading 
transient state from cache loader [EMAIL PROTECTED]
5229 [main] DEBUG org.jboss.cache.loader.JDBCCacheLoader  - executing sql: 
select fqn from jbosscache where parent=? (/)
5232 [main] DEBUG org.jboss.cache.loader.JDBCCacheLoader  - executing sql: 
select node from jbosscache where fqn=? (/a)
5235 [main] DEBUG org.jboss.cache.loader.JDBCCacheLoader  - executing sql: 
select fqn from jbosscache where parent=? (/a)
5238 [main] DEBUG org.jboss.cache.loader.JDBCCacheLoader  - executing sql: 
select node from jbosscache where fqn=? (/c)
5241 [main] DEBUG org.jboss.cache.loader.JDBCCacheLoader  - executing sql: 
select fqn from jbosscache where parent=? (/c)
5245 [main] DEBUG org.jboss.cache.loader.JDBCCacheLoader  - executing sql: 
select node from jbosscache where fqn=? (/b)
5266 [main] DEBUG org.jboss.cache.loader.JDBCCacheLoader  - executing sql: 
select fqn from jbosscache where parent=? (/b)

So it's executing not one but TWO queries for every single node! That's 
definitely not what I want, and contradicts what you said.

Adrian

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4107248#4107248

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4107248
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBossCache] - Re: Cache loader questions

2007-11-19 Thread aditsu
Salut, mersi pt. raspuns :)
(Hi, thanks for your answer)

1. This is good news, I'll look at the JDBCCacheLoader code
For the writes, I already have a custom implementation.

2. This was not answered properly, but from what you say it looks like at least 
2.2 is not currently possible.

3. I'm using sync replication anyway, at least for now, but the question was 
about the cache loader (which has to be async for performance reasons). I can 
implement this feature manually (to have each instance attempt to flush the 
changes from the whole cluster to db, asynchronously), but I was hoping JBC 
already had this option.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4106230#4106230

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4106230
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBossCache] - Re: Cache loader questions

2007-11-19 Thread mircea.markus
anonymous wrote : 1. Is it possible to do reads and writes in batches? 
Obviously, if I have 1 million records and I want to preload them all, it's 
better to do one "SELECT *" rather than one "SELECT ID" followed by 1 million 
"SELECT * WHERE ID=?". 
JDBCCacheLoader works like that (starting with 2.0).
anonymous wrote : 
  | Similarly, if I have 1 million updates to perform, it's better to group 
them in batches (asynchronously), and reduce the number of db transactions. 
Nice one, I've created http://jira.jboss.com/jira/browse/JBCACHE-1221 for this. 

anonymous wrote : 
  | 2. When I add a new cache to the replicated cluster (with a shared cache 
loader), can it preload all the necessary data from the cache loader (not 
blocking the cluster in any way during this operation), and then get the latest 
changes from the cluster (*all* and *only* the changes) so that it is up to 
date?
  | 
You can disable state transfer then and preload data on startup. If other 
caches write async then this won't work, though. We have some ideas of handling 
state transfer more efficiently, but not a clear date on when those will be 
implemented
anonymous wrote : 
  | 3. I understand that with a shared cache loader, the cache that originates 
a change is also the one that writes it to the cache loader.
yes
anonymous wrote :  What happens if the cache loader writes asynchronously, and 
that cache instance goes down after completing the transaction but before 
flushing the data to the db? Is it possible to have another cache write it 
instead? 
Not. After all that's the drawback of having async writings, you're not gonna 
be notified whether they failed or not. If it's critical for you to know the 
data is persisted I think you should use sync replication.


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4106062#4106062

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4106062
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user