Juan Hernandez has posted comments on this change.

Change subject: engine: Datasource configuration fixes
......................................................................


Patch Set 1:

(1 comment)

....................................................
File packaging/services/ovirt-engine/ovirt-engine.xml.in
Line 150:             <share-prepared-statements/>
Line 151:           </statement>
Line 152:           <validation>
Line 153:             <check-valid-connection-sql>select 
1</check-valid-connection-sql>
Line 154:             <background-validation>true</background-validation>
Where did you see that deprecation notice?

Doing the validation in background helps performance because it is done less 
times. The query used is "select 1" which runs very quickly, but it requires a 
network round trip anyhow, so it is expensive. So reducing this is good for 
performance.

Imagine the following situation: at t=0 a connection in the pool breaks, for 
whatever the reason, the background validation thread will validate it later, 
say at t=10. Now, at t=5 the application gets the broken connection and tries 
to use it. It will fail, and the failure will be reported immediately to the 
application which will have to handle it. In our case that means that the 
command will fail.

On the other hand this is what happens with immediate validation: at t=0 the 
connection breaks, at t=5 the application gets it and then, before returning it 
to the application the server validates it. If validation fails the connection 
is discarded and the server gets a new connection for the application, till a 
good one is found.

So using background validation improves performance but also increases the 
amount of failed commands, specially when the connection to the database is 
fragile. I think that in our case it is better to validate immediately.

Also take into account that even if we do get a connection and then use it for 
just one SQL statement what happens under the hood is that the application 
server will use that same connection for the duration of the transaction. The 
server gets the connection from the pool the first time you call 
"getConnection" in the transaction and returns it to the pool when the 
transaction finishes.
Line 155:           </validation>
Line 156:         </datasource>
Line 157: 
Line 158:         <drivers>


-- 
To view, visit http://gerrit.ovirt.org/19735
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib7cbe97f0baf85f8b6785726380a7a4dcb9d20f8
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liran Zelkha <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Eli Mesika <[email protected]>
Gerrit-Reviewer: Juan Hernandez <[email protected]>
Gerrit-Reviewer: Liran Zelkha <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to