Google AppEngine (GAE) 做Session 真郁闷!

在Google AppEngine做Session 本身并不是一个复杂的问题,可以基于Memcached API来做,也可以基于DataStore来做,为何让我郁闷?
先看看DataStore 这低下的性能,一般读取也要100ms cpu时间,如果有些写入可能大于200ms cpu时间,这个是以前用python做程序测试的,Java的还没有试过。如果以后访问量大了,有准备付费的打算就惨了。
我们再来看看Memcached吧:
[quote]Memcache may be useful for other temporary values. However, when considering whether to store a value solely in the memcache and not backed by other persistent storage, be sure that your application behaves acceptably when the value is suddenly not available. [color=red]Values can expire from the memcache at any time[/color], and may be expired prior to the expiration deadline set for the value. For example, if the sudden absence of a user's session data would cause the session to malfunction, that data should probably be stored in the datastore in addition to the memcache.[/quote]

Memcached来存储Session 也是在不放心,当然如果你的网站没有用户机制、状态倒是不用关心这个问题。

没办法在网站应用中可以采用Memcached + DataStore配合的方式,Memcached的数据定时存储至DataStore,这种做法有一定的适用性,但是还是可能造成Session数据丢失或者错误的问题,只是几率大大降低了,而且又能提高不少性能,不过这样做还是有些变扭。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值