通过网络共享的 Sqlite [英] Sqlite over a network share

查看:94
本文介绍了通过网络共享的 Sqlite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人有在局域网(Windows 或 Linux)上的 SMB 共享上运行 Sqlite 数据库的实际经验?

Does anyone have real world experience running a Sqlite database on an SMB share on a LAN (Windows or Linux)?

文档 中可以清楚地看出这并不是最快的方法共享一个Sqlite数据库.

Its clear from the documentation that this is not really the fastest way to share a Sqlite database.

明显的警告是它可能很慢,而且Sqlite一次只支持单线程写入数据库.因此,您的并发性降低了很多,因为您的数据库更新现在将阻塞数据库更长时间(当数据通过网络传输时,数据库将被锁定).

The obvious caveats are that it may be slow, and Sqlite only supports a single thread writing to the DB at a time. So you become a lot less concurrent cause your DB updates now will block the DB for longer (DB will be locked while data is in transit over the network).

对于我的应用程序,我想共享的数据量相当小,写入也不太频繁(最多每隔几秒写入几次).

For my application the amount of data that I would like to share is fairly small and writes are not too frequent (a few writes every few seconds at most).

我应该注意什么?这能行吗?

What should I watch out for? Can this work?

我知道这不是 Sqlite 的设计目的,我对基于 Postgres/MySql/Sql Server 的解决方案不太感兴趣,因为我试图以最少的依赖关系使我的应用程序尽可能轻便.

I know this is not what Sqlite was designed for, I am less interested in a Postgres/MySql/Sql Server based solution as I am trying to keep my app a light as possible with a minimal amount of dependencies.

相关链接:

来自 sqlite 邮件列表,所以我猜测一个大问题是 SMB(windows 或 linux)上的文件锁 apis 有多不可靠

From the sqlite mailing list, so I guess one big question is how unreliable are the filelock apis over SMB (windows or linux)

推荐答案

我对基于文件的数据库(即那些没有数据库服务器进程的数据库)的经验可以追溯到二十多年前,如果你试图分享它们,它们不可避免地最终会被破坏.我强烈建议你再看看 MySQL.

My experience of file based databases (i.e. those without a database server process), which goes back over twenty years, is that if you try to share them, they will inevitably eventually get corrupted. I'd strongly suggest you look at MySQL again.

请注意,我不是在选择 SQLite - 我自己使用它,而不是作为共享数据库.

And please note, I am not picking on SQLite - I use it myself, just not as a shared database.

这篇关于通过网络共享的 Sqlite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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