Hi George,

Basically it's because of the "_ah_SESSION" token. This token is created 
whenever an app engine standard application stores a user's session and 
contains all the information about the session.

Something that was not easy to find is that when it's created it is then 
stored both on memcache and on datastore, and never cleaned from datastore, 
even if its expiration (_expires) period passes. 

We have ended creating a cloud function to delete from datastore all 
expired entries with a cron, but that has reached a whole new level of 
issues with security (which I will leave for another post).

One last thing, is, as feedback, it´s a bit "sneaky" to store data from the 
users in datastore without providing a free way to clean it afterwards. I 
mean, just to clean up the expired entries we are gonna have to pay for:
- Reading from the datastore.
- Deleting from the datastore.
- Cloud function periodically activated.

For something that is neither our wish nor our desire to have, ;).

On the other hand, if we didn't pay for it, I already have more than 500 MB 
of expired session entries on datastore, meaning that I'd still have to pay 
to store something I have no wish or use to store, without any notification 
of it.

The reference by which i found out was a few articles similar to 
this: http://www.zoftino.com/google-app-engine-session-data-cleanup. 
Once you start to look in depth, it's all over the place, but if your not 
aware, it's hard to find it referenced in the docs.

Anyway, thanks for your assistance.

Miguel Pagán Murphy


On Wednesday, September 19, 2018 at 2:35:11 AM UTC+2, George (Cloud 
Platform Support) wrote:
>
> Hello Miguel, 
>
> To clean data in both Memcache and Datastore, you should use the 
> corresponding key. In case of the Memcache, to remove a value from the 
> cache (to evict it immediately), call the remove() method with the key as 
> its argument. To remove every value from the cache for the application, 
> call the clear() method. Related detail may be read on the "Using Memcache" 
> page 
> <https://cloud.google.com/appengine/docs/standard/java/memcache/using#putting_and_getting_values>.
>  
> In Memcache, you may write your data limiting its persistence: the app can 
> provide an expiration time when a value is stored, as either a number of 
> seconds relative to when the value is added, or as an absolute Unix epoch 
> time in the future. This is documented on the "Memcache Overview" page 
> <https://cloud.google.com/appengine/docs/standard/php/memcache/#how_cached_data_expires>
> . 
>
> Similarly, in case of Datastore, when an entity is no longer needed, you 
> can remove it from Cloud Datastore with the key's delete() method, a 
> statement similar to sandy.key.delete(). The "Creating, Retrieving, 
> Updating, and Deleting Entities" page 
> <https://cloud.google.com/appengine/docs/standard/python/ndb/creating-entities>
>  
> might offer more insight. In both cases, your code should keep track of the 
> keys, to be able to perform the delete operation. You may use App Engine 
> Cron Service to perform these operations at appropriate times, in 
> accordance with your app's needs.  
>
> How did you ascertain that Memcache data was persisted to Datastore? When 
> did you first notice it? 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/126fdb77-4812-40e7-805a-6872e9b86f89%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • [google-app... Miguel Pagan Murphy
    • [googl... 'George (Cloud Platform Support)' via Google App Engine
      • [g... Miguel Pagan Murphy
        • ... 'Yasser Karout (Cloud Platform Support)' via Google App Engine

Reply via email to