Skip to content
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 query #76

Open
harding13 opened this issue Oct 23, 2017 · 8 comments
Open

Slow query #76

harding13 opened this issue Oct 23, 2017 · 8 comments

Comments

@harding13
Copy link

Hi all

i'm using firebase-php to make a query against a firebase db where i stored chat data.

the structure is a thing like this

chat
----chat_ID
------------node_ID

when i search into a chat (with one or many children) with a code like this

$firebase = new \Firebase\FirebaseLib(DEFAULT_URL, DEFAULT_TOKEN);
$value = $firebase->get('/chat/'.$chat, array('orderBy' => '"status"', 'equalTo' => '"unread"'));

the query needs almost 700ms to get a result (even if there is only one node)

I think it's too much... or not?

@ova-adam
Copy link

Same here, I'm reading a /records/rec_id/node_id and it takes 300-700ms, however on the firebase profiler, it shows 0ms.

@ova-adam
Copy link

ova-adam commented Nov 11, 2017

Looks to be a CURL issue, here are some stats from when I log with curl:

time_namelookup:  0.153
  time_connect:  0.161

time_appconnect: 0.357
time_pretransfer: 0.357
time_redirect: 0.000
time_starttransfer: 0.408
----------
time_total: 0.408

@harding13
Copy link
Author

@ova-adam so there is nothing to do?

@ova-adam
Copy link

@harding13 there is, CURL requests are very slow as you can see. Is this an issue of CURL or FB at the core?

@harding13
Copy link
Author

I see it but i don't know how to solve it :)

@ova-adam
Copy link

Is this an issue with this library, firebase, or curl? This long lag doesn't happen if I curl a website like Google.com

If this can't be eliminated, this is a deal breaker for our project.

@harding13
Copy link
Author

I choosed Firebase because of its speed. But if i must wait 0.7 sec for every query, maybe, i must switch to another technology (or another way of using FB)

@mastef
Copy link

mastef commented Jun 18, 2019

@ova-adam @harding13 Since your issue the library has been also updated so the curl handle is re-used for consecutive requests, which should reduce your connection times to the firebase server for repeat queries.

A few other things that improved connection times drastically I've mentioned here: #68 (comment)

Related SO : https://stackoverflow.com/a/26568867/10728554

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants