Hi firebase team! We use Firebase as a backend for our service. It has a PeopleViewController that displays users within a radius of the current user. The radius can vary from 1 to 40 miles. Also there is a check for blocked users, age, sex. At the very beginning of the development of the project, a temporary implementation was made for this capability within the application. I created several managers who fulfilled these requests, and then gave the result to PeopleViewController. At the beginning of the project, because of the tight deadlines, pagination was not implemented, but the pagination was not particularly needed since the users even in the radius were less than 100. Now, in one radius there can be more than 600 users and I think it is not right that these requests are performed inside application. We move these functions from the app Side to the cloud function so that we can adjust how many users should be in each issue.
The problem is that even a warmed-up cloud function works slower than all functions related to this capability inside the application. On average, the code inside the application for a radius of 40 miles and the inclusion of all age groups returns 646 users in 1.5 seconds, while the best result is cloud functions 3.6. Below I will give examples of the time and code with the app side and cloud funciton.
The results are obtained using the code that is executed in the application:
1 number of users 646, 1.6775569915771484 seconds
2 number of users 646, 1.4022901058197021 seconds
3 number of users 646, 1.5957129001617432 seconds
The results with the cloud function time are specified in milliseconds. The parameters and location are the same as the code that is run from the application:
Also I want to say that I read this post, but as I wrote at the beginning, that even the heated function works like this. What is the reason for such a big difference in the result? How can this be remedied or what are the solutions to this problem?
Hi firebase team! We use Firebase as a backend for our service. It has a
PeopleViewController
that displays users within a radius of the current user. The radius can vary from 1 to 40 miles. Also there is a check for blocked users, age, sex. At the very beginning of the development of the project, a temporary implementation was made for this capability within the application. I created several managers who fulfilled these requests, and then gave the result to PeopleViewController. At the beginning of the project, because of the tight deadlines, pagination was not implemented, but the pagination was not particularly needed since the users even in the radius were less than 100. Now, in one radius there can be more than 600 users and I think it is not right that these requests are performed inside application. We move these functions from the app Side to the cloud function so that we can adjust how many users should be in each issue. The problem is that even a warmed-up cloud function works slower than all functions related to this capability inside the application. On average, the code inside the application for a radius of 40 miles and the inclusion of all age groups returns 646 users in 1.5 seconds, while the best result is cloud functions 3.6. Below I will give examples of the time and code with the app side and cloud funciton.The results are obtained using the code that is executed in the application:
The results with the cloud function time are specified in milliseconds. The parameters and location are the same as the code that is run from the application:
In the managers who request a list of users and filter the received data within the application.
From
BlockSystemManager
This function is located in the
PeopleSearchManager
and calls the cloud functionCloud function
Also I want to say that I read this post, but as I wrote at the beginning, that even the heated function works like this. What is the reason for such a big difference in the result? How can this be remedied or what are the solutions to this problem?