One of the big problem performance wise is the lack of session token for bot. With the proto API there's a specific session per bot handshake.
Having a session has one benefit, the composite object can contain all the necessary data loaded at the start of each RPC, reducing all the fetches to a single one.
When an event occurs that would cause all sessions to be forcibly canceled, the entities can be forced out. This will remove the need for most @utils.cache_with_expiration().
Making this efficient will be easier if issue 786734 is implemented so the dimensions can'T be continuously changing.
Comment 1 by bugdroid1@chromium.org
, Apr 11 2018