sqlite读写分离库
Project description
sqlite-rw
为sqlite提供读写分离能力,提高并发度。
解决什么问题?
sqlite是一个很好用的嵌入式数据库,但是由于sqlite采用了库级别的文件锁,所以并发能力不强,当存在慢SQL,比如在大表上select count(*) from large_table的时候,会导致其他任务无法写入。
sqlite-rw就是为了解决这个问题的,思路如下
- 采用读写分离的存储模式,每次写入会持久化写库,并且记录日志到binlog表,然后异步写入读库。
- 读取的时候可以选择从读库或者写库读取,默认从读库读取。
提高并发度的原理
- sqlite本身读取是支持并发的,但是写入是不能和读取并发的。所以读库本身是支持并发读取的,同步的写操作是通过id主键写入的,耗时会比较短,基本上不会阻塞读操作。
- 由于是读写分离的,在读库存在慢SQL的情况下,写库也能够正常工作,在读库慢SQL执行完成之后,系统会把写库的数据同步到读库中,使两者保持一致。
使用限制和影响
- 存储量相比于单独的sqlite会翻倍
- 写入性能会有所下降,待详细的基准测试
- 依赖
web.py的db接口进行操作
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sqlite-rw-0.0.2.tar.gz
(7.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sqlite-rw-0.0.2.tar.gz.
File metadata
- Download URL: sqlite-rw-0.0.2.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fb4fae1380e3f3734be2fb5c411ffaee0a0841746c4a78e6dbc64a0853494aa
|
|
| MD5 |
048f186ad28fe2bdbb51e9a1e408f209
|
|
| BLAKE2b-256 |
616b494e34f7f3e554ebecce7e625cb0af4521ae8b3d7ad97ea2d7cc1ba55727
|
File details
Details for the file sqlite_rw-0.0.2-py3-none-any.whl.
File metadata
- Download URL: sqlite_rw-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98fe5db5f65c6dcaad0df305820b9b4d7e11923cbe4611b0de53b7648970ff25
|
|
| MD5 |
a20dd8fbe120b5b8dbcbd0f0b4e0e609
|
|
| BLAKE2b-256 |
cf5738e422d1c542985957f353d06889d9b867f025b54de51b2dcaea0f4116f1
|