-
-
Notifications
You must be signed in to change notification settings - Fork 979
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
Phpiredis + predis 1.0 performance issue #180
Comments
Did you try disabling persistent connections and see if the issue is still present? |
Yes, the issue is still present without persistant connexion |
Try replacing this line in $buffer = stream_socket_recvfrom($socket, 4096); And see if anything changes. |
Looks like it fixes the issue , nice ! |
Actually I'm surprised to see I used Thanks! |
Similarly to the socket-ext based connection using phpiredis, in our stream based PhpiredisStreamConnection class we should read data from the stream using stream_socket_recvfrom() instead of fread() because the latter could block until a timeout is reached when the read buffer contains less data then the specified length. IMPORTANT: stream_socket_recvfrom() bypasses stream wrappers which means that TLS/SSL, as requested by PR #158, won't ever work with this connection class as the function returns the original encrypted bytes. This commit fixes issue #180.
Similarly to the socket-ext based connection using phpiredis, in our stream based PhpiredisStreamConnection class we should read data from the stream using stream_socket_recvfrom() instead of fread() because the latter could block until a timeout is reached when the read buffer contains less data then the specified length. IMPORTANT: stream_socket_recvfrom() bypasses stream wrappers which means that TLS/SSL, as requested by PR #158, won't ever work with this connection class as the function returns the original encrypted bytes. This commit fixes issue #180.
Not sure if the issue is in predis or phpiredis itself, but I ve got a performance issue with predis and phpiredis and I don't reproduce the issue without the phpiredis connector
script to reproduce:
array('tcp' => 'Predis\Connection\PhpiredisStreamConnection') ); $predis = new Predis\Client($parameters, $options); $t = microtime(true); $c = $predis->get('communities'); echo "time to fetch communities : ".(microtime(true)-$t); ?>some call , like 1 / 3 or 1/4 takes 60 seconds
time to fetch communities : 60.002037643
if I remove the 'connections' option the script runs fast all time
time to fetch communities : 0.0055761337280273
The text was updated successfully, but these errors were encountered: