-
Notifications
You must be signed in to change notification settings - Fork 824
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
Poor Blob performance over high latency connection #2957
Comments
Care to create a PR ? |
I need to go through some hoops since I'm in some corp, so it will take some time, but if you haven't done it till then I will definitely! |
@wegendt-bosch could you please clarify how you use I am not fond of adding yet another configuration source, so if we consider making blob buffer size configurable, we should probably use connection properties for that. What is the source of the Yet another direction for reducing the latency would be pipelining the requests. As |
One more question: do you have any benchmarks for the buffer size in your environment? |
Hi, I don't call the method myself, I use hibernate and that calls it. Therefore I can't use connection properties, since hibernate does not forward those AFAIK. Using a buffer size of 128KB is about 10 times faster, but I'm not sure you want to reserve that much RAM for transfers in local networks, this really is just for high-ping environments. The source of the input stream is a hibernate-internal stream. If you want to pursue a different direction you should probably do it instead of me, I'm just showing you my solution I'm using in a fork until this bug is resolved :) |
You probably mean |
I mean we should:
That is why I suggested
A slightly different idea might be storing the pgjdbc/pgjdbc/src/main/java/org/postgresql/util/StreamWrapper.java Lines 124 to 134 in 65f158e
Do you know the exact "hibernate-internal stream" or can you suggest a reproducer? |
In hibernate's case, it is a I don't see what's the difference of the I'll add the Math.min to allocating the buffer to handle small blobs :) |
Right you are. However, we can still consider adding optimization like |
Hm, it seems that |
It exposes |
ah sure, I can use that |
We would like to keep Java 8 compatibility indeed. |
|
I don't think you can extend existing objects, I think for Java8 reflection is the only way you could achieve this |
Fixed by #3044 |
Describe the issue
The PreparedStatement class has poor performance for storing Blobs as oids over high latency network connections, since it uses a fixed buffer size of 4 KB.
Driver Version?
latest
Java Version?
any
OS Version?
Win 10
PostgreSQL Version?
latest
To Reproduce
Steps to reproduce the behaviour:
Create a Blob and store it as oid with a network with high latency (e.g. over internet)
Expected behaviour
A clear and concise description of what you expected to happen.
And what actually happens
Transfer rates approaching network speed
Possible fix:
make
PgPreparedStatement::createBlob
use a configurable buffer size via e.g.org/postgresql/driverconfig.properties
. Suggested name:binaryTransferBufferSize
The text was updated successfully, but these errors were encountered: