[JBossCache] - Re: JDBCCacheLoader bad performance when writing to DB
by gmeroz
Actually, the log above is for nodes that were laready in the DB. New nodes inserted into the DB, result in 8 select qeuries which are exatcly the same.
here is an exmaple of inserting only 2 nodes:
| for (int i=0 ; i<2 ; i++){
| Address a = new Address();
| a.setCity("a"+i);
| a.setZip(i);
| cache.put("cat","x"+i,a);
| }
|
result:
anonymous wrote :
| 17:55:46,094 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/)
| 17:55:46,438 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x0)
| 17:55:46,438 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x0)
| 17:55:46,453 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x0)
| 17:55:46,453 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x0)
| 17:55:46,453 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x0)
| 17:55:46,469 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x0)
| 17:55:46,469 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x0)
| 17:55:46,485 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x0)
| 17:55:46,563 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/__JBossInternal__/cat/x0/_ID_/5c4oa2y-6zewp7-fb3ro8v8-1-fb3ro8v8-2)
| 17:55:46,578 DEBUG [JDBCCacheLoader] executing sql: insert into ALLERGAN04.jbosscache_test (fqn, node, parent) values (?, ?, ?) (/__JBossInternal__/cat/x0/_ID_/5c4oa2y-6zewp7-fb3ro8v8-1-fb3ro8v8-2)
| 17:55:46,672 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/__JBossInternal__/cat/x0/_ID_)
| 17:55:46,672 DEBUG [JDBCCacheLoader] executing sql: insert into ALLERGAN04.jbosscache_test (fqn, node, parent) values (?, ?, ?) (/__JBossInternal__/cat/x0/_ID_)
| 17:55:46,735 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/__JBossInternal__/cat/x0)
| 17:55:46,735 DEBUG [JDBCCacheLoader] executing sql: insert into ALLERGAN04.jbosscache_test (fqn, node, parent) values (?, ?, ?) (/__JBossInternal__/cat/x0)
| 17:55:46,750 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/__JBossInternal__/cat)
| 17:55:46,750 DEBUG [JDBCCacheLoader] executing sql: insert into ALLERGAN04.jbosscache_test (fqn, node, parent) values (?, ?, ?) (/__JBossInternal__/cat)
| 17:55:46,750 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/__JBossInternal__)
| 17:55:46,766 DEBUG [JDBCCacheLoader] executing sql: insert into ALLERGAN04.jbosscache_test (fqn, node, parent) values (?, ?, ?) (/__JBossInternal__)
| 17:55:46,782 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/)
| 17:55:46,782 DEBUG [JDBCCacheLoader] executing sql: insert into ALLERGAN04.jbosscache_test (fqn, node, parent) values (?, ?, ?) (/)
| 17:55:46,797 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/__JBossInternal__/cat/x0/_ID_/5c4oa2y-6zewp7-fb3ro8v8-1-fb3ro8v8-2)
| 17:55:46,813 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/__JBossInternal__/cat/x0/_ID_/5c4oa2y-6zewp7-fb3ro8v8-1-fb3ro8v8-2)
| 17:55:46,829 DEBUG [JDBCCacheLoader] executing sql: update ALLERGAN04.jbosscache_test set node=? where fqn=?
| 17:55:46,844 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x0)
| 17:55:46,860 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x0)
| 17:55:46,860 DEBUG [JDBCCacheLoader] executing sql: insert into ALLERGAN04.jbosscache_test (fqn, node, parent) values (?, ?, ?) (/cat/x0)
| 17:55:46,875 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat)
| 17:55:46,875 DEBUG [JDBCCacheLoader] executing sql: insert into ALLERGAN04.jbosscache_test (fqn, node, parent) values (?, ?, ?) (/cat)
| 17:55:46,891 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/)
| 17:55:46,907 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x1)
| 17:55:46,907 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x1)
| 17:55:46,907 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x1)
| 17:55:46,922 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x1)
| 17:55:46,922 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x1)
| 17:55:46,938 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x1)
| 17:55:46,938 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x1)
| 17:55:46,954 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x1)
| 17:55:46,954 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/__JBossInternal__/cat/x1/_ID_/5c4oa2y-6zewp7-fb3ro8v8-1-fb3ro96y-3)
| 17:55:46,969 DEBUG [JDBCCacheLoader] executing sql: insert into ALLERGAN04.jbosscache_test (fqn, node, parent) values (?, ?, ?) (/__JBossInternal__/cat/x1/_ID_/5c4oa2y-6zewp7-fb3ro8v8-1-fb3ro96y-3)
| 17:55:46,985 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/__JBossInternal__/cat/x1/_ID_)
| 17:55:46,985 DEBUG [JDBCCacheLoader] executing sql: insert into ALLERGAN04.jbosscache_test (fqn, node, parent) values (?, ?, ?) (/__JBossInternal__/cat/x1/_ID_)
| 17:55:46,985 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/__JBossInternal__/cat/x1)
| 17:55:47,000 DEBUG [JDBCCacheLoader] executing sql: insert into ALLERGAN04.jbosscache_test (fqn, node, parent) values (?, ?, ?) (/__JBossInternal__/cat/x1)
| 17:55:47,000 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/__JBossInternal__/cat)
| 17:55:47,016 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/__JBossInternal__/cat/x1/_ID_/5c4oa2y-6zewp7-fb3ro8v8-1-fb3ro96y-3)
| 17:55:47,016 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/__JBossInternal__/cat/x1/_ID_/5c4oa2y-6zewp7-fb3ro8v8-1-fb3ro96y-3)
| 17:55:47,032 DEBUG [JDBCCacheLoader] executing sql: update ALLERGAN04.jbosscache_test set node=? where fqn=?
| 17:55:47,047 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x1)
| 17:55:47,047 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat/x1)
| 17:55:47,063 DEBUG [JDBCCacheLoader] executing sql: insert into ALLERGAN04.jbosscache_test (fqn, node, parent) values (?, ?, ?) (/cat/x1)
| 17:55:47,063 DEBUG [JDBCCacheLoader] executing sql: select node from ALLERGAN04.jbosscache_test where fqn=? (/cat)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4117383#4117383
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4117383
18 years, 3 months
[JBossCache] - Re: JDBCCacheLoader bad performance when writing to DB
by gmeroz
when setting log priority to debug, i get the following. It means that when i add a node to the cache, for each node the same select query is running 4 times. When the cache has thousands of nodes, it's a huge overhead.
| 16:59:37,992 DEBUG [JDBCCacheLoader] executing sql: select node from jbosscache_1 where fqn=? (/aag/queries/d1-1-d2-0-d3-1347132-d4-0-d5-0-d7-6-d9-109-d14-0-d15-0-24-2/3-CHILDREN-2-2)
| 16:59:38,007 DEBUG [JDBCCacheLoader] executing sql: select node from jbosscache_1 where fqn=? (/aag/queries/d1-1-d2-0-d3-1347132-d4-0-d5-0-d7-6-d9-109-d14-0-d15-0-24-2/3-CHILDREN-2-2)
| 16:59:38,007 DEBUG [JDBCCacheLoader] executing sql: select node from jbosscache_1 where fqn=? (/aag/queries/d1-1-d2-0-d3-1347132-d4-0-d5-0-d7-6-d9-109-d14-0-d15-0-24-2/3-CHILDREN-2-2)
| 16:59:38,007 DEBUG [JDBCCacheLoader] executing sql: select node from jbosscache_1 where fqn=? (/aag/queries/d1-1-d2-0-d3-1347132-d4-0-d5-0-d7-6-d9-109-d14-0-d15-0-24-2/3-CHILDREN-2-2)
| 16:59:38,007 DEBUG [JDBCCacheLoader] executing sql: select node from jbosscache_1 where fqn=? (/aag/queries/d1-1-d2-0-d3-1347132-d4-0-d5-0-d7-6-d9-109-d14-0-d15-0-24-2/1-SIBLINGS-1-1)
| 16:59:38,023 DEBUG [JDBCCacheLoader] executing sql: select node from jbosscache_1 where fqn=? (/aag/queries/d1-1-d2-0-d3-1347132-d4-0-d5-0-d7-6-d9-109-d14-0-d15-0-24-2/1-SIBLINGS-1-1)
| 16:59:38,023 DEBUG [JDBCCacheLoader] executing sql: select node from jbosscache_1 where fqn=? (/aag/queries/d1-1-d2-0-d3-1347132-d4-0-d5-0-d7-6-d9-109-d14-0-d15-0-24-2/1-SIBLINGS-1-1)
| 16:59:38,023 DEBUG [JDBCCacheLoader] executing sql: select node from jbosscache_1 where fqn=? (/aag/queries/d1-1-d2-0-d3-1347132-d4-0-d5-0-d7-6-d9-109-d14-0-d15-0-24-2/1-SIBLINGS-1-1)
| 16:59:38,039 DEBUG [JDBCCacheLoader] executing sql: select node from jbosscache_1 where fqn=? (/aag/queries/d1-1-d2-0-d3-1347132-d4-0-d5-0-d7-6-d9-109-d14-0-d15-0-24-2/2-SIBLINGS-440-440)
| 16:59:38,039 DEBUG [JDBCCacheLoader] executing sql: select node from jbosscache_1 where fqn=? (/aag/queries/d1-1-d2-0-d3-1347132-d4-0-d5-0-d7-6-d9-109-d14-0-d15-0-24-2/2-SIBLINGS-440-440)
| 16:59:38,054 DEBUG [JDBCCacheLoader] executing sql: select node from jbosscache_1 where fqn=? (/aag/queries/d1-1-d2-0-d3-1347132-d4-0-d5-0-d7-6-d9-109-d14-0-d15-0-24-2/2-SIBLINGS-440-440)
| 16:59:38,054 DEBUG [JDBCCacheLoader] executing sql: select node from jbosscache_1 where fqn=? (/aag/queries/d1-1-d2-0-d3-1347132-d4-0-d5-0-d7-6-d9-109-d14-0-d15-0-24-2/2-SIBLINGS-440-440)
| 16:59:38,070 DEBUG [JDBCCacheLoader] executing sql: select node from jbosscache_1 where fqn=? (/aag/queries/d1-1-d2-0-d3-1347132-d4-0-d5-0-d7-6-d9-109-d14-0-d15-0-24-2/2-LOWER-440-440)
| 16:59:38,070 DEBUG [JDBCCacheLoader] executing sql: select node from jbosscache_1 where fqn=? (/aag/queries/d1-1-d2-0-d3-1347132-d4-0-d5-0-d7-6-d9-109-d14-0-d15-0-24-2/2-LOWER-440-440)
| 16:59:38,070 DEBUG [JDBCCacheLoader] executing sql: select node from jbosscache_1 where fqn=? (/aag/queries/d1-1-d2-0-d3-1347132-d4-0-d5-0-d7-6-d9-109-d14-0-d15-0-24-2/2-LOWER-440-440)
| 16:59:38,085 DEBUG [JDBCCacheLoader] executing sql: select node from jbosscache_1 where fqn=? (/aag/queries/d1-1-d2-0-d3-1347132-d4-0-d5-0-d7-6-d9-109-d14-0-d15-0-24-2/2-LOWER-440-440)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4117380#4117380
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4117380
18 years, 3 months
[JBoss Seam] - Seam contexts and stateful session instances
by ruettimac
Hi,
I discovered a behaviour while implementing a simple page to edit an entity bean which I can not explain what happens is right or not.
I expect:
My stateful session bean has the following annotations:
@Stateful
| @Scope(ScopeType.EVENT)
and the following method to load the customer I like to edit in the page:
@Create
| public void loadCustomer() {
and the method to persist the changes:
public String persistChanges() {
So I expect, that I get an instance of the stateful session bean on which I call all three methods. But in reality, the method loadCustomer will be called more than once because I get another instance of the session bean (hash code) for loading the page and for saving the page. In addition, the instance also differs for saving the entity bean; reading the hash code of the bean instance in persistChanges(), the create annotated method gives me another hash code than the final instance in persistChanges. As far as I know, this behaviour is OK for J2EE because you do not care what instance you receive (instance pooling).
But I expected, that the seam context annotation for event or conversation should give me the same instance of the bean? It would be helpful for me if someone explain me about the relationship of the seam context's and their relation to the stateful session bean instances.
The business case works - the changed values will be persisted, but for me the create annotated method should only be called once ...
Regards,
Cyrill
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4117373#4117373
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4117373
18 years, 3 months