Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift GeoFire 4观察输入的快照大小和计费_Swift_Firebase_Geofire - Fatal编程技术网

Swift GeoFire 4观察输入的快照大小和计费

Swift GeoFire 4观察输入的快照大小和计费,swift,firebase,geofire,Swift,Firebase,Geofire,我正在使用geofire检索半径范围内的密钥,需要帮助了解如何对其进行配置以降低成本 下面是我用于输入密钥的代码: /** How observers work for goquery https://stackoverflow.com/questions/45179245/geofire-swift-3-cant-stop-observing */ var itemsProcessed = 0 self.circleQuery!.observe(.keyEnte

我正在使用geofire检索半径范围内的密钥,需要帮助了解如何对其进行配置以降低成本

下面是我用于输入密钥的代码:

/**

            How observers work for goquery
 https://stackoverflow.com/questions/45179245/geofire-swift-3-cant-stop-observing
 */

var itemsProcessed = 0
self.circleQuery!.observe(.keyEntered, with: { (key: String!, location: CLLocation!) in

    itemsProcessed = itemsProcessed + 1
NSLog("Controller | initiateGeoQuery | processed key \(itemsProcessed) with value: '\(key)', it has entered the search area and is at location '\(location)' , cirecleQuery has center: \(self.circleQuery!.center) , and radius: \(self.circleQuery!.radius)")


    NSLog("AEViewController waiting 60 seconds before next key entered")
    sleep(60)
在这个测试用例中,我在半径外有320个节点,位于中国,在范围内有2个节点,我在欧盟

我得到以下输出:

2020-02-15 15:01:55.198665+0000 Renal2[14181:706800] Controller | initiateGeoQuery | processed key 1 with value: 'Optional("adROWaUdK5gd6JKAfMW8DzfXpJB3")', it has entered the search area and is at location 'Optional(<xx.34939780,yy.23826435> +/- 0.00m (speed -1.00 mps / course -1.00) @ 15/02/2020, 15:01:55 Greenwich Mean Time)' , cirecleQuery has center: <xx.34939292,yy.23826781> +/- 65.00m (speed -1.00 mps / course -1.00) @ 15/02/2020, 15:01:54 Greenwich Mean Time , and radius: 50.0
2020-02-15 15:02:55.201683+0000 Renal2[14181:706800] Controller | initiateGeoQuery | processed key 2 with value: 'Optional("9fzIKheb8Ubvmu1tCA9V0uw0DOj1")', it has entered the search area and is at location 'Optional(<xx.34959316,yy.23812573> +/- 0.00m (speed -1.00 mps / course -1.00) @ 15/02/2020, 15:01:55 Greenwich Mean Time)' , cirecleQuery has center: <xx.34939292,yy.23826781> +/- 65.00m (speed -1.00 mps / course -1.00) @ 15/02/2020, 15:01:54 Greenwich Mean Time , and radius: 50.0
第二项:

┌──────┬───────┬───────┬─────────┐
│ Path │ Total │ Count │ Average │
└──────┴───────┴───────┴─────────┘
这完全是意料之中的事,也很匹配

出乎意料的是,如果我使用半径以外的150个键而不是320个键运行相同的测试,带宽如下所示:

┌───────────────────────────────────────────────────┬───────────┬───────┬──────────┐
│ Path                                              │ Total     │ Count │ Average  │
├───────────────────────────────────────────────────┼───────────┼───────┼──────────┤
│ /GeoFire                                          │ 56.04 kB  │ 4     │ 14.01 kB │
现在,考虑到当今商业模式中的一个真实场景,应用程序是全球化的,比如说,在全球范围内分布着1000.000个密钥并不罕见。在我的例子中,光线大约有50公里,一个现实的场景是光线中有大约20/30个关键点

我是否需要支付1.000.000 x 0.36 KB,几乎370MB的费用?每节课

当然,我在这里做错了什么,根据下面的博客

我可以看到:

GeoFire在如何在查询中查找关键字方面很聪明。它不需要将所有GeoFire数据加载到内存中。如果你的用户在旧金山寻找自行车商店,GeoFire不会为纽约的地点加载数据,而是意识到他们在这个国家的另一边。它只检查实际上在附近的位置。无论你的数据集有多大,这都能让你的应用程序轻巧、响应迅速

当我开始这个项目时,我的假设是账单也应该很轻,你能帮我理解我做错了什么吗

非常感谢

┌───────────────────────────────────────────────────┬───────────┬───────┬──────────┐
│ Path                                              │ Total     │ Count │ Average  │
├───────────────────────────────────────────────────┼───────────┼───────┼──────────┤
│ /GeoFire                                          │ 56.04 kB  │ 4     │ 14.01 kB │