轻量级数据库(SQL 或 NoSQL) [英] Lightweight database (SQL or NoSQL)

查看:46
本文介绍了轻量级数据库(SQL 或 NoSQL)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个网站,该网站必须存在于内存可用性非常低的 VM 上(目前我被告知预期 512mb).不幸的是,至少在不久的将来,数据库和 Web 应用程序必须是同一台服务器.

I'm currently working on a website that must exist on a VM with very low memory availability (at the moment I am told to expect 512mb). Unfortunately, at least in the immediate future, the database and web application must be the same server.

现在我已经阅读了这里的一些问题,并尝试进行自己的研究,但可供选择的选项实在太多了.本质上,什么是我可以安装的足够轻巧的数据库服务器?SQL 或 NoSQL 并不重要.它不会是数据库密集型的,但我不想受到我现在选择的任何限制.这意味着,如果可能的话,通往多服务器扩展的道路会很好,但显然不是现阶段的要求.

Now I've read through some questions here and tried to do my own research but there are just so many options to choose from. Essentially, what will be a light enough database server that I can install? SQL or NoSQL doesn't really matter; it won't be database intensive but I would like to not be constraint with whatever I choose now. Meaning, if possible, a path towards multi-server scaling would be great but obviously not a requirement at this stage.

我目前的想法是 MongoDB 或 MySQL,但我不确定它们是否是最佳选择.

My current thoughts are either MongoDB or MySQL but I'm not sure if those are the best choices.

我的 Web 应用程序在 nginx 上运行,使用 PHP,我认为这是目前最好的选择,所以我主要关心的是数据库方面.

My web application is running on nginx with PHP which I think is the best choice for now so my main concern is the database side.

推荐答案

如果你需要最轻量的数据库,我会说 sqlite 3.它是为此任务而设计的,小而快,根据我的经验,它可靠且易于使用.

if you need the lightest-weight database i would say sqlite 3. it's purpose designed for this task, is small and fast, and in my experience is reliable and easy to use.

我自己不使用 php,但这里似乎有 支持.

i don't use php myself, but there appears to be support here.

sqlite 几乎支持标准"sql,除了它不强制类型 - 您可以将列定义为文本,但如果您愿意,可以存储和检索整数值.实际上,这没什么大不了的,只要您不使用此功能",您将来可以轻松切换到更大的数据库.

sqlite supports pretty much "standard" sql, except that it doesn't enforce types - you can define a column to be text, but store and retrieve an integer value, if you feel like it. in practice, it's not a big deal and as long as you don't use this "feature" you can switch to a larger database in the future with little trouble.

但是,在实践中,我会从 mysql 开始,因为它可能已经安装并且可用.如果它给您带来内存使用问题,请切换到 sqlite.但是对于一个简单的,没有多余的数据库,你还不如从 mysql 开始.

but, in practice, i would start with mysql since it is likely already installed and available. if it gives you issues with memory use, switch to sqlite. but for a simple, no frills database, you might as well start with mysql.

这篇关于轻量级数据库(SQL 或 NoSQL)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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