基于Memcache的消息队列? [英] Memcache-based message queue?

查看:105
本文介绍了基于Memcache的消息队列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一款多人游戏,它需要一个消息队列(即,假设没有意外的缓存驱逐,消息输入,消息输出,没有重复或已删除消息).这是我知道的基于内存缓存的队列:

I'm working on a multiplayer game and it needs a message queue (i.e., messages in, messages out, no duplicates or deleted messages assuming there are no unexpected cache evictions). Here are the memcache-based queues I'm aware of:

  • MemcacheQ: http://memcachedb.org/memcacheq/
  • Starling: http://rubyforge.org/projects/starling/
  • Depcached: http://www.marcworrell.com/article-2287-en.html
  • Sparrow: http://code.google.com/p/sparrow/

我从此博客文章:

所有消息均以整数作为键进行保存.有一个键具有下一个键,而一个键具有队列中最旧消息的键.要访问这些增量/减量方法用作其原子,因此有两个充当锁的键.它们将递增,如果返回值为1,则该进程具有锁,否则它将继续递增.该过程完成后,将其值重新设置为0.简单但有效.一个警告是整数将溢出,因此有一些逻辑可以在我们接近该限制时将使用的密钥设置为1.由于增量操作是原子操作,因此只有在使用两个或多个内存缓存(用于冗余)时才需要锁定,以使它们保持同步.

我的问题是,是否存在可以在App Engine上运行的基于Memcache的消息队列服务?

My question is, is there a memcache-based message queue service that can run on App Engine?

推荐答案

我会非常谨慎地以这种方式使用Google App Engine内存缓存.您担心意外的缓存逐出"是正确的.

I would be very careful using the Google App Engine Memcache in this way. You are right to be worrying about "unexpected cache evictions".

Google希望您将内存缓存用于缓存数据,而不是存储.他们不保证将数据保留在缓存中.从 GAE文档:

Google expect you to use the memcache for caching data and not storing it. They don't guarantee to keep data in the cache. From the GAE Documentation:

默认情况下,项目永远不会过期 可能由于记忆而驱逐了物品 压力.

By default, items never expire, though items may be evicted due to memory pressure.

编辑:始终存在 Amazon的简单排队服务.但是,这可能不符合价格/性能水平,如下所述:

There's always Amazon's Simple Queueing Service. However, this may not meet price/performance levels either as:

  1. 从Google到Amazon服务器的呼叫会有延迟.
  2. 您最终将为所有数据流量支付两次费用-支付离开Goog​​le的费用,然后再次支付进入亚马逊的费用.

这篇关于基于Memcache的消息队列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆