`
cppupu
  • 浏览: 49191 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

Google AppEngine (GAE) 做Session 真郁闷!

阅读更多
在Google AppEngine做Session 本身并不是一个复杂的问题,可以基于Memcached API来做,也可以基于DataStore来做,为何让我郁闷?
先看看DataStore 这低下的性能,一般读取也要100ms cpu时间,如果有些写入可能大于200ms cpu时间,这个是以前用python做程序测试的,Java的还没有试过。如果以后访问量大了,有准备付费的打算就惨了。
我们再来看看Memcached吧:
引用
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. Values can expire from the memcache at any time, 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.


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

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

相关推荐

Global site tag (gtag.js) - Google Analytics