-
Notifications
You must be signed in to change notification settings - Fork 72
Merge close and prepare statement packets in unnamed mode #92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge close and prepare statement packets in unnamed mode #92
Conversation
Hi @hkrutzer, we received more reports about issues so we reverted your previous patch to unblock folks. We're keen on moving forward with this PR, could you please rebase on master? |
…lixir-ecto#83)"" This reverts commit ed3067e.
This removes one roundtrip to the database.
f40b57b
to
359e1ad
Compare
Done |
We need to understand why the previous patch (and likely this patch) are causing statements to leak though. Any ideas on the root cause will be welcome. |
I am not sure this is the case. The prepared statement count we are seeing is stable: It could be that #93 is not running |
Right. It is most likely that other scenarios are causing the leakage, which we were not yet able to reproduce! |
I tried test "produce the expected amount of prepared statements in named mode" do
{:ok, conn} = MyXQL.start_link(@opts)
assert prepared_stmt_count() == 0
MyXQL.query!(conn, "SELECT 42", [], cache_statement: "42")
assert prepared_stmt_count() == 1
MyXQL.query!(conn, "SELECT 1337", [], cache_statement: "69")
assert prepared_stmt_count() == 2
MyXQL.query!(conn, "SELECT 42", [], cache_statement: "42")
assert prepared_stmt_count() == 2
MyXQL.query!(conn, "SELECT 42", [], cache_statement: "42")
assert prepared_stmt_count() == 2
end but this passes. I will try running our test suite with different driver versions next week. |
I'll take a look tomorrow! |
I rebased my older commit but it is broken. I don't know enough about where |
Another attempt here |
Closing in favor of more recent PR. |
After #83 we saw an increase in performance in for repeated queries, but a decrease for other queries. The second type of query has a more strict performance requirement for us, and this was no longer being met (by a significant amount). This patch fixes that by removing a database roundtrip.
Unfortunately it was easier for me to create this patch than to investigate why exactly things were slowed down so much. It has been running in our prod environment for around two weeks.
This is the version we are running but it should be identical