[ http://www.datanucleus.org/servlet/jira/browse/NUCRDBMS-447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18111#action_18111 ]
Andy Jefferson edited comment on NUCRDBMS-447 at 10/8/10 12:04 PM:
-------------------------------------------------------------------
So in ConnectionFactoryImpl, where it doesn't release the connection when in a transaction, add a check on a persistence property and don't release when not transactional too. So we then would have one connection for the transactional usage (tx ConnectionFactory), and one connection for non-tx usage (nontx ConnectionFactory).
This mode of operation (retain non-tx connection) has to be enabled by a persistence property since many people will not want connections to be retained (if they have many PM's then one per PM will soon exhaust any connection pool).
But then maybe there is more to it, and I'm waiting for you to attach your code so know what is "pooled" variable, and indeed what changes are made in ConnectionManager.
was (Author: andy):
So in ConnectionFactoryImpl, where it doesn't release the connection when in a transaction, add a check on a persistence property and don't release when not transactional too. That way, when the ObjectManager first needs a connection (transactional or non-transactional) it is obtained, and will be retained for the duration of the ObjectManager's life. An alternative is to have one connection for the transactional usage, and at commit/rollback release it, and when the first non-tx operation comes in have a connection for non-tx usage (and release it at the start of the next transaction). Multi-threaded usage impacts on this, so need to make sure that checks are in place to handle any overlap of usages.
This mode of operation (retain non-tx connection) has to be enabled by a persistence property since many people will not want connections to be retained (if they have many PM's then one per PM will soon exhaust any connection pool).
But then maybe there is more to it, and I'm waiting for you to attach your code so know what is "pooled" variable, and indeed what changes are made in ConnectionManager.
> Option to retain datastore connection when operating non-transactional
> ----------------------------------------------------------------------
>
> Key: NUCRDBMS-447
> URL: http://www.datanucleus.org/servlet/jira/browse/NUCRDBMS-447
> Project: DataNucleus RDBMS
> Issue Type: New Feature
> Components: Persistence
> Reporter: Fernando Padilla
>
> I bet we can discuss the pros/cons, but we've seen good performance gains from turning on a feature like this. I know that the connection pool bears the brunt of this, but even then, it's just wasting resources and increasing contention around the connection pool.
> a) we switched to BoneCP from DBCP and saw a huge performance gain, since it was so much more efficient at
> get/release of connections
> b) even so the connection pool and datanuclues both do different things when it gets/releases a connection from
> the pool, and this is just totally wasted cpu and roundtrips to the database
> ps - we hacked our DN to enable a feature like this, and it does seem to help performance (as long as you have adequate connection pool/db connection settings). Sadly, we hacked it in such a way that we don't have a clean patch to submit. We can talk about what we did, but ultimately what you come up with will probably be better than what we did. :)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://www.datanucleus.org/servlet/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|