Repository navigation
Release connection into pool with "Discard All"(new) - #74
Conversation
|
Just a small comment... Measuring the total running time of the Npgsql unit tests doesn't really say much about performance - none of the tests do any serious processing and 99% of the time is probably spent connecting and disconnecting. A better approach would be to write a speed test in SpeedTests.cs specifically to measure what you want... |
|
It's a good idea.The patch only impacts connect and disconnect.So i add two speed tests, one with pool another without pool. In fact current resource releasing need _planIndex+1 commands.So when _planIndex is large than 1 this patch will be more efficient. ---------------------------result of speed tests--------------------------------------- run test cases without this pacth: |
|
I have two suggestions:
|
|
have done |
|
Great! But I still got a problem. :( When the connection is taken back from the pool, the extra_float_digits parameter is reset by the discard all and I get an error in the Bug10992DoubleValueSupport test. I think this can be reverted by re adding the extra_float_digits=2 parameter in the startup packet. |
|
I reverted the last commit and add a comment. Because while had set extra_float_digits=2 parameter in the startup packet,do not need set it again in postgresql8,4 . If "put the set extra floating outside the if protocol version" we had to set extra_float_digits=2 twice in postgresql8,4 , or check protocol version again. |
|
Great! Now, I got another problem :( While I did a last test in my dev machine, I noticed that it is complaining about an unrecognized configuration parameter: This is happening because my postgresql 8.4.1 doesn't have support for this parameter setting. So, with this patch, if Npgsql is used in a server which doesn't have this parameter support, it will always fail to connect. :( According to Npgsql code comment about this parameter, ( the link in the comment is wrong. It has been changed) I talked about this parameter change on this mail http://lists.pgfoundry.org/pipermail/npgsql-devel/2010-February/001074.html The following versions have support for this parameter: "[...] The fix has been backpatched all the way to 7.4, so the following versions We need to check how to handle that. |
|
According the link ssl_renegotiation_limit was setted to avoid a bug in Mono.Security.dll. Does this bug still exists? |
|
Yes, this bug still exist. Also, in fact, this parameter is also used to prevent a bug in ssl libraries used in the Postgresql itself (http://www.postgresql.org/message-id/[email protected]) Npgsql already have support to use SSLStream class instead of Mono libraries, but it is still optional. The user has to request explicitly to use it. I agree with you that we will have to use the set command and we can even optimize it to be set only when ssl is being used. But this would imply in more checks after the "discard all" Would you mind to make those changes in your pull request? Also, after the last merges I did yesterday, it needs to be rebased. Thanks in advance. We will need to talk about how to handle those set commands we need to send after "discard all" command. I'm starting to think we could use an initalization vector with all the set parameters needed to be sent at a time. For example: Npgsql calls discard all We could create this initialization vector when the connection starts and reuse it whenever we get a new connection from the pool. This way "discard all" can be used without worrying about which other parameters have to be set after it. |
|
I agree with your. And it's needed to make sure that there is no error in any of parameters setting when combining them into one command. I noticed when executing "SET lc_monetary='C'" ,the exception was ignored in the current source. Do this means some version of PostgreSQL do not support "SET lc_monetary='C'"? If so we must execute "SET lc_monetary='C'" in individual command. |
This is a new patch to replace PR54
|
Hi,francisco |
Release connection into pool with "Discard All"(new)
|
Sorry I didn't answer your question before. I think the set lc_monetary code is wrapped in the try catch because I copied it from the other settings part :) |
Hi,francisco
This is a new patch to replace #54,please give a look.
I had tested it for PG8.4 and PG9.2,all cases passed.And the performance also look like before.
run test cases without this pacth:
tests runs:645
Time:52.936
run test cases with this pacth:
tests runs:647
Time:52.897
Chen Huajun