-
-
Notifications
You must be signed in to change notification settings - Fork 216
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
Running too slow #68
Comments
exact same issue. any ideas? |
Hello, I have not made any improvements to my pho code but I still have a delay with regards to the library that needs to be solved. In javascript the updates are so fast that they seem to be instantaneous php should behave the same way or close to that rs |
@ivent @selimonline I had some very slow initial & consecutive requests ( 5-7 seconds per request ) and the changes below are how I resolved them. Also while debugging you can use My getCurlHandler has the following added lines : + curl_setopt($this->_ch, CURLOPT_HTTPGET, true); // <-- to reset CURLOPT_POSTFIELDS
curl_setopt($this->_ch, CURLOPT_URL, $url);
curl_setopt($this->_ch, CURLOPT_TIMEOUT, $this->_timeout);
curl_setopt($this->_ch, CURLOPT_CONNECTTIMEOUT, $this->_timeout);
+ curl_setopt($this->_ch, CURLOPT_SSL_VERIFYPEER, false); // <-- set to false to speed up SSL connections ; do at your own risk
curl_setopt($this->_ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($this->_ch, CURLOPT_RETURNTRANSFER, true);
+ // curl_setopt($this->_ch, CURLOPT_VERBOSE, true); // <-- for debugging, turn off after you're done
curl_setopt($this->_ch, CURLOPT_CUSTOMREQUEST, $mode);
+ curl_setopt($this->_ch, CURLOPT_HTTPHEADER, []); // <-- reset headers when switching from write to read
+ curl_setopt($this->_ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 ); // <-- force ipv4, helps with servers that have ipv6 dns lookups misconfigured @ktamas77 you might want to consider some of these. I think it's mainly the ipv6 lookups on servers that don't support ipv6 that are slowing down Curl; as it tries to look up the host with ipv6 and then falls back on ipv4 after it fails. Might want to have an option for this, similar to the SSL option in a recent version. Related SO : https://stackoverflow.com/a/26568867/10728554 |
Hello, the script works very slow to 7 seconds to perform each operation, I know that the response of the firebase is fast so I wonder how it does to improve the response speed performance of the script.
The text was updated successfully, but these errors were encountered: