What are some good, fast persistent storage options for key->value data? [closed]

空扰寡人 提交于 2019-11-27 16:12:33

问题


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?


回答1:


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.


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




回答2:


Just to suggest something different, redis (or redisdb-win32 if you're on a Windows servers)




回答3:


CouchDB is your answer (although it could be a little bit overkill for your necessities)..




回答4:


Strange no one mentioned Flintstone till now.

Also a good option is Doctrine.




回答5:


Might not be the best answer. But I would store it into a mySQL Database and probably use a mysql_pconnect if the data are not being extracted at the same time.

Informations about pconnect here: php.net

A common alternative to Database is a plain file but correct me if I'm wrong but concurent file access might be slower.

Good luck.




回答6:


To add some more to those already mentioned, PHP has native support for

  • MongoDB,
  • Tokyo_Tyrant and
  • Berkeley DB

For the latter there is a nice article by Johannes Schlüter.




回答7:


i would go for MySQl, just in case you need to upgrade your application in the future. Better be future proof when it comes to applications.



来源:https://stackoverflow.com/questions/3972362/what-are-some-good-fast-persistent-storage-options-for-key-value-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!