-
-
Notifications
You must be signed in to change notification settings - Fork 169
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
Slow response times on GAE & Cloud Run #28
Comments
That's an interesting problem! 🤔 Are you using a Service Account JSON file locally and on GAE/GCR? If so, please try leaving the I hope this helps! |
Hey, thanks for the quick reaction. On local dev, I'm exposing GOOGLE_APPLICATION_CREDENTIALS as Environment variable. On GAE/GCR, I'm not setting any env vars. |
Darn... I was hoping it would be as easy as that. For the moment I have no other ideas, but I will try it out tomorrow on GAE/GCR as well, if I can at least reproduce the issue, I can hopefully also figure out why this is happening. 🤞 |
Did some digging and i found a fix. and replace the constructor with:
Instead of the auto injected guzzle client then performance returns to normal. 28 seconds down to 200 milliseconds. As for WHY this is a problem i have no idea, but this does make the problem go away. Is there anything I can to do help to get this fixed in an official release so I don't have to monkeypatch my php code? :) Edit: |
You already did! Thank you for digging into it and finding a solution! As you're currently already monkeypatching 😅, could you please try modifying the Factory in https://github.com/kreait/firebase-php/blob/master/src/Firebase/Factory.php#L418 from } elseif ((new GcpMetadata())->isAvailable()) { to } elseif ((new GcpMetadata(new Client()))->isAvailable()) { and see if this yields the same improvements? If so, I'll release a patch release today and look for a more sustainable solution after that. Some background: I initially planned to rely on Google's packages as less as possible and to make the SDK HTTP-Client-independent (as it's currently tied to Guzzle). Unfortunately, I never came around really doing it, and so, the SDK is currently in this weird state that I'm duplicating some of the functionality that |
Oh, i came across that part of the code in my bug hunting ;) That won't (completely) work because a few lines above that we call: $serviceAccount = $this->getServiceAccount(); That one ends up going into |
Ah, of course! 🤦♂ Could you please add/replace
to your project's |
Ok, that causes issues:
and 2) If i run (1/1) ErrorClass 'Kreait\Laravel\Firebase\ServiceProvider' not foundin Application.php line 196 |
Thanks for testing it out! I think the I‘ll start working on a better, more permanent solution and let you know once I have something ready. Thanks for your help and your patience! |
Thanks for the replies so far, and looking forward to being able to rip this ugly monkey patch out of my codebase ;) |
I just released a new version of Could you please do a |
Seems to work :) |
Looks like it works, thank you very much :) |
I'm glad, thanks for the feedback! 🌺 |
Hey there!
I was wondering whether you guys could help me with an issue I'm facing.
App.php:
DomainService.php
When I run this app on Google App Engine (Flex) or Google Cloud Run and invoke this method call via a Rest call, the average response time is around 16 seconds. When running locally, this is around 500ms.
Do you know where the increase in latency might come from?
We've also used https://github.com/firevel/firestore/tree/master/src, which doesn't have this problem, but Firevel is missing other functionalities.
Versions used:
"kreait/laravel-firebase": "^1.5",
"laravel/lumen-framework": "^6.0"
The text was updated successfully, but these errors were encountered: