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

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

问题描述

对于我编写的一个小型PHP应用程序,我们需要存储大量具有哈希键和一些简单字段值('host','path')的记录。例如:

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

对于这样的数据,最好的永久存储是什么? MySQL会是最好的选择,还是对于这样简单的数据呢?

简短答案 /www.membase.org/rel =noreferrer> Membase






长答案:

您基本上有三个选项:关系数据库,文件存储或其他。



一个关系数据库肯定是过度的。也就是说,如果这是已经有一个MySQL或其他数据库的应用程序的一部分,我会去的。同样,文件存储可以方便地(例如写入一堆XML文件),但磁盘I / O可能很慢。



现在在其他类别,您有一些非常好的NoSQL选项,例如 CouchDB Memcached



如果您不太担心数据的持久性,我建议memcache。它轻量级,易于运行,还有一个 Memcache PHP扩展,使用它很容易。它是为这样的键值存储。



内存缓存的一个缺点是所有的数据丢失第二个memcache服务停止。这是 Membase 的来源。它是一个开源的memcache分支,是协议兼容的,意思是它将与所有现有的客户端库一起使用。但是,它可以持久保存您的数据,实际提供一致性和可靠性,而内存缓存本身不能使用。


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',
);

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?

解决方案

Short answer: Membase.


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

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.

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

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.

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.

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

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