键值数据有哪些良好的快速持久存储选项? [英] What are some good, fast persistent storage options for key->value data?

查看:120
本文介绍了键值数据有哪些良好的快速持久存储选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我正在编写的一个小型PHP应用程序,我们需要存储大量具有哈希键和一些简单字段值(主机",路径")的记录.例如:

For a small PHP app I am writing, we need to store a large number of records that have a hash key, and a few simple field values ('host', 'path'). eg:

'4420ffb32a' => array(
  'host' => '127.0.0.1',
  'path' => 'path/to/resource',
);

像这样的数据最好的持久存储是什么? MySQL将是最佳选择,还是对于如此简单的数据而言过于矫kill过正?什么会带来最佳性能?

What is the best persistent storage for data like this? Would MySQL be the best choice, or is it overkill for such simple data? What would give the best performance?

推荐答案

简短答案: Membase .

长答案:
基本上,您有三个选择:关系数据库,文件存储或其他内容.

Long answer:
You basically have three options: a relational database, file storage, or something else.

就像您说的那样,关系数据库肯定是过大的.就是说,如果这是已经具有MySQL或其他数据库的应用程序的一部分,我会同意的.同样,文件存储有时可能很方便(例如,写入一堆XML文件),但是磁盘I/O可能很慢.

Like you said, a relational database could definitely be overkill. That said, if this is part of an application that already has a MySQL or other database, I would go with that. Likewise, file storage can be handy sometimes (writing to a bunch of XML files, for example), but disk I/O can be slow.

现在,在 other 类别中,您拥有一些很棒的NoSQL选项,例如 CouchDB Memcached .

Now in the other category, you have some great NoSQL options like CouchDB or Memcached.

如果您不太担心数据的持久性,建议您使用内存缓存.它轻巧,易于运行,并且有一个 Memcache PHP扩展使使用起来容易.专门用于这样的键值存储.

If you aren't too worried about the persistence of your data, I'd recommend memcache. It's lightweight, easy to get running, and there is a Memcache PHP extension that makes using it easy. It is made for key-value storage like this.

memcache的一个缺点是,memcache服务停止后,所有数据都会丢失.这是 Membase 出现的地方.它是memcache的开源分支,与协议兼容,这意味着它将与所有现有的客户端库一起使用.但是,它可以保留您的数据,并实际上提供一致性和可靠性,而内存缓存本身是无法做到这一点的.

The one drawback memcache has is that all your data is lost the second the memcache service stops. This is where Membase comes in. It is an open-source fork of memcache that is protocol-compatible, meaning it will work with all existing client libraries. However, it can persist your data and actually provide consistency and reliability, something memcache can't on its own.

注意::这个答案是时间的遗物,问题本身也是这样.请不要从字面上看.

NOTE: This answer is a relic of its time, as is the question itself. Please do not take it literally.

这篇关于键值数据有哪些良好的快速持久存储选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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