Firebase 即時資料庫操作類型

Firebase 即時資料庫分析器指令

若要產生即時資料庫執行個體中操作的速度和頻寬使用量的報告,請使用下列命令:

firebase database:profile
標記選項描述
-h, --help輸出使用資訊。
-o, --output FILENAME將輸出儲存到指定檔案。
-i, --input FILENAME根據指定的檔案而不是來自伺服器的流日誌產生報告。
-d, --duration SECONDS收集指定秒數的資料庫使用資訊。
--raw將收集的原始統計資訊輸出為換行符號分隔的 JSON。

操作類型

並發連接

此操作反映了與資料庫的即時連接(例如,當新客戶端透過 SDK 連接時)。 RESTful 連接不會反映在並發連接操作中。

{
    "name": "concurrent-connect",
    "timestamp": 1484776334900
}

並發斷開

並發斷開反映已與資料庫斷開連線的連線(例如,當客戶端中斷連線或登出時)。

{
    "name": "concurrent-disconnect",
    "timestamp": 1484776341844
}

即時寫入

來自即時連線的寫入請求。例如,Web 用戶端的set()push()操作。刪除請求也算是realtime-write操作,並反映 0 位元組的寫入。

{
    "allowed": true, // If security rules allow the operation
    "bytes": 1,
    "millis": 2,
    "name": "realtime-write",
    "path": [
        "foo"
    ],
    "timestamp": 1484776538763
}

即時交易

此操作類型包括透過即時連接進行的交易。重複交易可能是失敗嘗試和重試的結果。

{
    "allowed": true,
    "bytes": 20,
    "millis": 2,
    "name": "realtime-transaction",
    "path": [
        "foo"
    ],
    "timestamp": 1484776854610
}

即時更新

這些即時更新操作反映了特定資料的覆蓋,而不是realtime-write中更一般的寫入操作。

{
    "allowed": true,
    "bytes": 5,
    "millis": 2,
    "name": "realtime-update",
    "path": [
        "foo"
    ],
    "timestamp": 1484776538769
}

聽者-聽

這些操作反映了客戶端對特定位置的資料的初始請求。例如,Web 客戶端的on()once()方法。

{
    "allowed": true,
    "bytes": 0,
    "millis": 26,
    "name": "listener-listen",
    "path": [
        "foo"
    ],
    "querySet": [],
    "timestamp": 1484776335024,
    "unIndexed": false
}

聽眾廣播

此操作涵蓋每次寫入和更新操作後從伺服器發送到在給定位置偵聽的所有用戶端的資料。資料的改變導致廣播操作。但是,如果沒有任何用戶端正在偵聽,您可能會看到 0 個更新。

{
    "bytes": 56, // Total bytes sent across clients
    "clientsUpdated": 3, // This may be 0 if no clients are listening
    "millis": 17,
    "name": "listener-broadcast",
    "path": [
        "baz",
        "mar"
    ],
    "timestamp": 1484775969928
}

聽者-不聽

這些操作反映了透過分離方法登出或停止偵聽的偵聽客戶端(例如,用於 Web 的off()或用於 iOS 的removeAllObservers )。

{
    "name": "listener-unlisten",
    "path": [
        "foo"
    ],
    "timestamp": 1484776335044
}

休息閱讀

透過 REST API GET請求。

{
    "allowed": true,
    "bytes": 348, // This would be 0 if the read data was null
    "millis": 26,
    "name": "rest-read",
    "path": [],
    "querySet": [
        {
            "default": true,
            "endIndexValue": "[MAX_NAME]",
            "equality": false,
            "index": {},
            "limit": null,
            "range": false,
            "simpleLimit": false,
            "startIndexValue": "[MIN_NAME]",
            "viewFrom": null
        }
    ],
    "timestamp": 1484775747416
}

剩餘寫入

透過 REST API 發出PUTPOST請求。 DELETE請求反映 0 位元組的rest-write操作。

{
    "allowed": true,
    "bytes": 13,
    "millis": 116,
    "name": "rest-write",
    "path": [],
    "timestamp": 1484775917216
}

剩餘交易

對於類似事務的行為,請使用條件請求rest-transaction操作使用Etagif-match標頭擷取請求。

{
    "allowed": true,
    "bytes": 13,
    "millis": 116,
    "name": "rest-transaction",
    "path": [],
    "timestamp": 1484775917216
}

休息更新

透過 REST API 的更新反映PATCH請求。

{
    "allowed": true,
    "bytes": 5,
    "millis": 11,
    "name": "rest-update",
    "path": [
        "baz",
        "mar"
    ],
    "timestamp": 1484775969930
}

斷開連線時

這些操作反映了為寫入操作新增了onDisconnect偵聽器。例如,當您使用onDisconnect().setValue()時。

{
    "allowed": true,
    "bytes": 4,
    "millis": 2,
    "name": "on-disconnect-put",
    "path": [
        "baz",
        "mar"
    ],
    "timestamp": 1484775969930
}

斷開連線時更新

這些操作反映了為更新操作新增了onDisconnect偵聽器。例如,當您使用onDisconnect().updateChildren()

{
    "allowed": true,
    "bytes": 4,
    "millis": 2,
    "name": "on-disconnect-update",
    "path": [
        "baz",
        "mar"
    ],
    "timestamp": 1484775969930
}

斷開連線時取消

這些操作反映了 onDisconnect 偵聽器的刪除。例如,當您使用onDisconnect().set().cancel()時。

{
    "millis": 2,
    "name": "on-disconnect-cancel",
    "path": [
        "baz",
        "mar"
    ],
    "timestamp": 1484775969930
}

斷開連接時運行

這些操作反映了onDisconnect監聽器的觸發。當即時用戶端在新增至少一個onDisconnect偵聽器後斷開連線時,分析器會記錄單一run-on-disconnect操作,以反映觸發的所有onDisconnect偵聽器的聚合位元組和時間。

{
    "bytes": 4,
    "millis": 2,
    "name": "run-on-disconnect",
    "timestamp": 1484775969930
}