问题
I've noticed that the _expires
property of _ah_SESSION
is indexed. This surely comes handy when querying for expired sessions. But there seems to be a downside to this. The _expires
property contains monotonically increasing values. Which means that index records for this property will most likely end up on a single tablet server. I am concerned that such tablet server could be easily overloaded by applications which update session data often. Is there a way of telling App Engine NOT to index the _expires
property? Perhaps something along the lines of adding a rule to appengine-web.xml
, for example:
<session-index-expiration>false</session-index-expiration>
To the best of my knowledge, answer to my question is "no". I am thinking of submitting a feature request. But maybe I am missing something. Your input will be much appreciated.
Update 1: I filed a feature request for this. Please consider giving it a vote by "starring" it: https://issuetracker.google.com/issues/71583968
Update 2: The feature request was noticed by Google and "a solution is currently being investigated". In the issue tracker discussion, there is a post saying that it may be possible to prevent the _expires
property from being indexed by means of datastore-indexes.xml
configuration file. However, since this file seems to deal exclusively with declaring custom indexes, I fail to see how it can be used to disable a single property index. Any ideas?
PS: I originally believed the somewhat widespread myth that _ah_SESSION
entities are automatically rewritten after every request merely to update the expiration timestamp. But this is not true. According to the actual implementation of SessionManager, such rewrites are enforced only when the session is at least 25% expired. Which significantly reduces the risk of contention caused by indexing the _expires
property. At least for applications which use sessions mainly to keep track of logged in/out users.
来源:https://stackoverflow.com/questions/48036619/contention-issues-due-to-indexing-expires-property-sessions-on-google-app-e