简体   繁体   English

我可以将cassandra(2.0.3)用作php会话存储(例如vs. redis)吗?

[英]Can I use cassandra (2.0.3) as a php session store (eg. vs redis)?

I have been googling for days and read some cassandra books. 我已经搜寻了好几天,读了一些卡桑德拉书籍。 But I still havent got my answer yet. 但是我还没有得到答案。 We want to evaluate this a bit more before we invest our time in a redis or riak cluster to do the php session store. 在将时间投入到redis或riak集群中以进行php会话存储之前,我们希望对此进行更多评估。

Our users are being redirected geographically over 3 datacenters (US,EU,ASIA), we run a multi datacenter cassandra in all 3 locations. 我们的用户正在通过3个数据中心(美国,欧盟,亚洲)进行地理位置重定向,我们在所有3个地点都运行了一个多数据中心卡桑德拉。

Best and most efficient for us is be able to use Cassandra as a session store so we dont have to maintain another cluster. 对我们而言,最好和最高效的方法是能够将Cassandra用作会话存储,因此我们不必维护另一个集群。 We dont mind that users have to relog because they got redirected to a different datacenter, but want to minimize this as much as possible. 我们不介意用户必须重新登录,因为他们已被重定向到另一个数据中心,但希望尽可能减少这种情况。

So in our scenario is cassandra technically a good option as a php session store? 因此,在我们的方案中,从技术上来说,cassandra作为php会话存储是一个不错的选择吗? if yes, what is the best practice in cassandra to do this? 如果是,cassandra的最佳做法是什么? We got php covered. 我们得到了PHP的覆盖。

Thank you! 谢谢!

Cassandra could be a good session store. Cassandra可能是一个很好的会话存储。 However, be aware of Cassandra' eventually consistent design and choose your read settings accordingly. 但是,请注意Cassandra最终的一致设计,并相应地选择您的读取设置。 For example, if you use the default replication factor of three then it's possible a write wouldn't have been replicated fully (to the other 2 nodes) before the next read request is executed. 例如,如果您使用默认的复制因子3,则在执行下一个读取请求之前,可能没有将写入完全复制(复制到其他2个节点)。 If your read consistency level is 1 (fastest read performance) it's possible you'll get old data back from a node that hasn't received the latest write. 如果读取一致性级别为1(最快的读取性能),则可能会从尚未接收到最新写入的节点取回旧数据。 I'd recommend a read consistency of QUORUM or higher to avoid this problem - performance will be a bit lower than level 1 but it's a trade-off that's probably necessary in this situation. 我建议读取一致性为QUORUM或更高,以避免出现此问题-性能将略低于1级,但在这种情况下可能需要进行权衡。

PHP supports various methods for sessions out of the box - disk, memcached and a few others. PHP支持各种开箱即用的会话方法-磁盘,内存缓存和其他一些方法。 Guessing Cassandra isn't one of them though - but you can implement your own session storage fairly easily - see this page for an explanation - http://php.net/session.customhandler 尽管猜测Cassandra并不是其中之一-但您可以相当轻松地实现自己的会话存储-请参阅此页面以获得解释-http://php.net/session.customhandler

You have to implement a set of methods and tell PHP about them, or on newer versions, there's an interface you can implement - which is much nicer/cleaner! 您必须实现一组方法并将这些方法告诉PHP,或者在较新的版本上,可以实现一个接口-更好/更简洁!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 用户可以在 web 上更改什么? (例如 $_SESSION,JS 代码) - What can be changed by user on web? (eg. $_SESSION, JS code) php 在 redis 中存储 session - php store session in redis 可以使用XML来存储,修改和检索PHP中的数据,就像使用MySQL一样吗? 管理通用存储的数据(例如CRUD,CMS) - Can XML be used to store, modify and retrieve data in PHP like it can with MySQL? Managing data for general-purpose storage (eg. CRUD, CMS) 如何在PHP中的会话中存储对象? - How can I store objects in a session in PHP? 如何从mongoDB集合中的特定行(例如第6行)获取数据? - How can I get data from a specific row (eg. 6th row) in a mongoDB collection? 确实需要考虑 PHP 和 MySQL 字符串长度之间的差异(例如,单字节与多字节字符) - Do need to consider differences between PHP & MySQL string lengths (eg. Single Byte vs Multi Byte characters) 在texteditor中显示XML(例如tinymce,Jquery Editor)PHP - Display XML in texteditor (eg. tinymce,Jquery Editor) PHP 用于“进程运行受限”托管的PHP下载脚本(例如hostgator) - PHP download script for “processes running limited” hosting (eg. hostgator) PHP:这些Date(diff?)格式参数是什么(例如%R%a) - PHP: What are these Date (diff?) format parameters (eg. %R%a) 如何将我的Ruby on Rails模型中的参数(例如,ID,​​用户名,密码)传递给我的PHP Codeigniter控制器 - How do I pass parameters (eg. id, username, password) from my ruby on rails model to my php codeigniter controller
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM