如何确定数据库服务器或嵌入式数据库是否适合?

huangapple go评论98阅读模式
英文:

How to detemine if database server or embedded database is appropriate

问题

Bolt是一个纯Go语言的键值存储,受到了Howard Chu和LMDB项目的启发。该项目的目标是为那些不需要完整数据库服务器(如Postgres或MySQL)的项目提供一个简单、快速和可靠的数据库。

如何确定一个应用程序是否需要完整的数据库服务器?我猜这与并发写入的数量有关吗?

我计划编写一个简单的分布式社交网络应用作为一个有趣的项目。

英文:

> Bolt is a pure Go key/value store inspired by Howard Chu's and the LMDB project. The goal of the project is to provide a simple, fast, and reliable database for projects that don't require a full database server such as Postgres or MySQL.

Bolt readme

How does one determine if an application requires a full database server? I assume it has to do with number of concurrent writers?

I'm planning on writing a simple distributed social networking application as a fun project.

答案1

得分: 4

  1. 一个“嵌入式数据库”位于应用程序内部。它不需要是关系型的。

例如,你计算机上的媒体管理器就有一个嵌入式数据库,用于存储音频/视频元数据和文件位置。这个数据库可以是关系型的,这种情况下,数据库可以是像sqlite或mysql这样的东西。(我认为postgres不能嵌入在应用程序中)。如果你想要缓存本地信息,或者确信应用程序内部的信息不需要为应用程序的功能而与外部进行通信,那么嵌入式数据库非常适合。嵌入式数据库的核心设计目标是具有低的占用空间,因此在许多情况下,嵌入式数据库会省略专用数据库中的一些功能。

  1. 专用数据库服务器支持一个或多个客户端的读写操作,并且通常提供比嵌入式版本更多的功能。Postgres和Mysql都是专用数据库,在网络应用程序中被广泛使用。它们都是关系型数据库,而不是键值存储,而Bolt似乎是键值存储。

  2. 键值存储是一种非关系型数据库。想象一下redis(或Python中的dicts),其中:

  • 检索:客户端提供数据库键,数据库返回对应的值。
  • 赋值:客户端提供数据库键和值,数据库分配一个新的键并赋予给定的值,或者更新现有键的值。

注意:postgreshstore,它是一种键值存储。

与关系型数据库一样,键值数据库可以嵌入在应用程序内部或独立于专用硬件上。在做出这些架构决策时,以下是一些例子问题。

  1. 我的应用程序是否依赖需要进行通信的数据?我是否希望通过写入到中央数据库来进行数据通信,还是每个聊天客户端都连接到其他客户端,采用点对点模型并存储自己的数据?

  2. 我的应用程序是否需要关系模型,还是键值存储,或者其他一些特殊的数据模型?

这只是我的个人意见,关系模型在过去的30多年中已经成功地满足了各种持久性需求。它对于嵌入式或专用部署都有非常成熟的解决方案。这是一个很好的起点。

英文:
  1. An embedded database resides within the application. It doesn't need to be relational.

For instance, the media manager on your computer has a database embedded within it to store audio/video metadata and file location. This database could be relational, in which case, the database could be something like sqlite or mysql. (i don't think postgres can be deployed embedded in an application). Embedded databases are great if you want to cache local information, or you're sure that information within the application does not need to be communicated externally for the application's functionality. A core design goal for embedded databases is having a low footprint, so in many cases embedded databases omit features found in dedicated databases.

  1. A dedicated database server supports one or many clients' read and write operations, and usually provides more features than the embedded versions. Postgres and Mysql are both dedicated databases and are used widely in networked applications. They are also both relational databases, and not key-value stores, which Bolt seems to be.

  2. A key value store is a non-relational database. Think redis (or dicts in python), where

  • retrieval: the client gives the database the key, and the database responds with the value.

  • assigning: the client provides the database a key & value, and the database assigns a new key with given value, or updates the existing key's value.

    Note: postgres has hstore, which is a key value store.

Just like relational databases, key-value databases can be embedded within or reside separately on dedicated hardware. Here are some example questions one must ask while making these architecture decisions.

  1. Does my application depend on data that need to be communicated, and do I want to communicate the data by writing to a central database, or does each chat client connect to the other client on a peer to peer model and stores its own data?

  2. Do I need a relational model in my application, or a key-value store, or some other exotic data model?

Just my personal opinion, the relational model has been successful at satisfying a wide variety of persistent requirements over the last 30 odd years. Has very mature solutions for both embedded or dedicated deployment. It is a good place to start.

huangapple
  • 本文由 发表于 2015年5月11日 08:39:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/30158146.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定