[EJB 3.0] - Performance issues with batch insert
by toni
Hi,
in our webapplication the user can trigger a batch insert, which will create about 400 entities. This takes about 40 minutes.
In the beginning each entity gets created within a second. The more entities are inserted and the further the process progreses, the slower it gets.
In the end it takes about 7 seconds to create one and this trend seems to continue. I'm currently running a test to insert a few thousand entities to see what happens.
First I thought that this might be because of some imperformant SELECT statements of mine. There is lots of business logic involved in creating a single entity with all it's relationships.
However, if after a batch insert has been completed successfully I start another one, then the same thing happens over. Considerably fast in the beginning and the slowly slowing down.
If it would be about the tables growing larger, then the second batch insert should be slow from the very start.
Does anybody know what could be the cause of this?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4043425#4043425
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043425
19 years
[JBoss Seam] - Re: Nested conversations and transaction management
by FabBoco
Christian,
thank you again.
anonymous wrote :
| You believe that there are nested transactions and that transactions span requests. These things do not happen or don't exist.
|
Your answers helped me to realize that this is not true.
anonymous wrote :
| It took me a while to realize that you actually wanted to say "persistence context" whenever you said "transaction", because that is what you are looking for.
|
If you call - do all or nothing - "persistence context" it is ok for me too.
Anyway, following your answers I get to exactly:
anonymous wrote :
| - A long-running conversation that is started when the form in 1) is rendered
|
| - A Seam-managed persistence context with @In EntityManager (read the docs) that is bound to that conversation (automatically)
|
| - The conversation should begin with FlushModeType.MANUAL, so that the persistence context does not write to the database until em.flush() is called
|
| - All your screens and popups run inside the same long-running conversation (JSF POSTback propagates the conversation, for opening a new window etc. and propagation during GET use s:link or s:button)
|
| - ....
|
It is not working yet (my application is a little more complex of my description), but I think to be able to fix it myself.
Tank you again.
Regards
Fab.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4043420#4043420
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043420
19 years
[JBoss Seam] - Re: Nested conversations and transaction management
by christian.bauer@jboss.com
OK, last post from me, this is what you need:
- A long-running conversation that is started when the form in 1) is rendered
- A Seam-managed persistence context with @In EntityManager (read the docs) that is bound to that conversation (automatically)
- The conversation should begin with FlushModeType.MANUAL, so that the persistence context does not write to the database until em.flush() is called
- All your screens and popups run inside the same long-running conversation (JSF POSTback propagates the conversation, for opening a new window etc. and propagation during GET use s:link or s:button)
- Use the @In EntityManager to load objects and queue objects for storing (unflushed)
- If you want to cancel the whole thing, end the conversation without flushing the persistence context
- If you want to commit the whole thing, call em.flush() in the request that also ends the conversation
Finally, this is _not_ trivial although there is probably no framework that makes this easier than Seam. For example, I did not even mention the word "transaction", because what the TransactionalSeamPhaseListener is doing is just fine.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4043418#4043418
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043418
19 years
[JBoss Seam] - can I join a session with a conversation?
by mnrz
hello
I have some beans in one conversation (or rather some pages) but I want to use another page which is in session scope and then back to last conversation and resume the job but when I enter the session scope page after pressing the button to go back it throws exception and tell me the conversation has been ended.
is this possible? or I missed something to resolve that.
here is my pages.xml:
setting.xhtml is the page in session scope:
| <pages>
| <page view-id="/pages/main/searchQuery.xhtml" >
| <navigation from-action="#{indexSearch.search}">
| <rule if-outcome="resultQuery">
| <begin-conversation join="true" />
| <redirect view-id="/pages/main/resultQuery.xhtml" />
| </rule>
| </navigation>
| </page>
|
| <page view-id="/pages/main/setting.xhtml" >
| <navigation from-action="#{userSetting.continueNextPage}">
| <rule if-outcome="nextPage">
| <redirect view-id="/pages/main/resultQuery.xhtml" />
| </rule>
| </navigation>
| <navigation from-action="#{userSetting.apply}">
| <rule if-outcome="resultQuery">
| <redirect view-id="/pages/main/resultQuery.xhtml" />
| </rule>
| </navigation>
| </page>
|
| <page view-id="/pages/main/resultQuery.xhtml" conversation-required="true"
| no-conversation-view-id="/pages/main/searchQuery.xhtml">
| <navigation from-action="#{searchResult.back}">
| <rule if-outcome="back">
| <end-conversation/>
| <render view-id="/pages/main/searchQuery.xhtml" />
| </rule>
| </navigation>
| <navigation from-action="#{searchResult.setting}">
| <rule if-outcome="setting">
| <redirect view-id="/pages/main/setting.xhtml" />
| </rule>
| </navigation>
| </page>
|
| <page view-id="/login.xhtml">
| <navigation from-action="#{identity.login}">
| <rule if-outcome="success">
| <redirect view-id="/resultQuery.xhtml"/>
| </rule>
| </navigation>
| </page>
| </pages>
|
thank you very much
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4043417#4043417
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043417
19 years