Reducing Saved State Size

We are using webhooks to save and load Rooms. We are already truncating the state objects by discarding all the debug entries. There is a Binary entry in the state which sometimes get really big. From the looks of it the properties for the room are saved in the binary key which we need but there also seems to be a lot of other data in the key and we were wondering if we could discard some of that data. There keys "18" and "19" inside Binary. Do those keys have any specific meaning.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Tinasious,

    Thank you for choosing Photon and for this excellent question!

    The Binary keys have their respective DebugInfo keys so you may guess what each key mean.

    e.g.
    {
            "Binary": {
                "18": "RAAAAAdzAAhwcm9wMUtl...",
                "19": "RGl6AAEAAAAAAAN6AANp...",
                "20": "RGJ6AAMBAAAFAAAAA..."
            },
            "DebugInfo": {
                "DEBUG_PROPERTIES_18": {            },
                "DEBUG_EVENTS_19": {            },
                "DEBUG_GROUPS_20":{            }
            }
    }
    So you may want to remove those that you do not need.
    In your case you may not see "20" or "DEBUG_GROUPS_20" b/c you do not use "Interest Groups".
    I think only the room properties part is always sent even if you do not set any.
    By default empty room properties are sent like this:
    {
    "Binary":{"18":"RAAAAAFi+nkAAHM="},
    {"DEBUG_PROPERTIES_18":{"250":[]}
    }
    (the "250":[] means that there are no lobby properties keys)

    Another option would be to save the binary base64 values if they are unchangeable always (e.g. static properties) or in some cases (depending on other room options/params) and just inject it when returning the state.

    You can also take a look inside "ActorList" and apply same logic.