speed up DB by like 2x at least by using WAL
parent
adaf595669
commit
7bd48be829
|
@ -2,4 +2,6 @@
|
|||
files.db
|
||||
/files/
|
||||
ephemeral.db
|
||||
.timetracker
|
||||
.timetracker
|
||||
ephemeral.db-shm
|
||||
ephemeral.db-wal
|
||||
|
|
|
@ -26,8 +26,10 @@ That's a little more complicated.
|
|||
Eventually we'll have 2 different environments, development and production, each with different logging and such.
|
||||
|
||||
1. Initialise the database with the following command `sqlite3 ephemeral.db < schema.sql`
|
||||
1.1. If you want to speed up sqlite a little bit more, run `sqlite3 ephemeral.db` and then `PRAGMA synchronous = OFF;` and then Ctrl+D
|
||||
2. Compile and run ephemeral with `LOG=debug cargo run` for the debug build. `LOG=info cargo run -r` will run the release build.
|
||||
|
||||
|
||||
### Configuration Options
|
||||
|
||||
Configuration is done by settings environment variables in the launch command.
|
||||
|
|
|
@ -16,8 +16,20 @@ Benchmarking this software will be compared with QuadFile, the direct python equ
|
|||
|
||||
### Serving index
|
||||
|
||||
macro serving - 27k
|
||||
|
||||
### Uploading a file
|
||||
|
||||
macro upload - 42/s
|
||||
|
||||
### Serving a file
|
||||
|
||||
macro serving - 48/s
|
||||
( with a few 5xx's)
|
||||
|
||||
### Deleting a file
|
||||
|
||||
## Notes
|
||||
|
||||
Changing from functions to macros didn't really speed anything up
|
||||
is it an I/O bottleneck?
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
-- Use Write-Ahead-Logging --
|
||||
-- This speeds up queries by about 2x --
|
||||
PRAGMA journal_mode=WAL;
|
||||
-- PRAGMA synchronous = OFF; -- Disabled by default, can corrupt db if the computer suffers a catastrophic crash (or power failure)
|
||||
|
||||
-- This drops the existing files table, and re-creates it. --
|
||||
DROP TABLE IF EXISTS 'files';
|
||||
CREATE TABLE IF NOT EXISTS 'files' (
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::time::SystemTime;
|
||||
|
||||
use sqlx::{sqlite::SqliteQueryResult, Pool, Row, Sqlite};
|
||||
use sqlx::{sqlite::SqliteQueryResult, Pool, Sqlite};
|
||||
|
||||
// Adding a file to the database
|
||||
// TODO: Fix panic on fileadd with same filename (even if isDeleted) (UNIQUE constraint)
|
||||
|
|
|
@ -13,7 +13,7 @@ use rand::Rng;
|
|||
use std::fs::create_dir_all;
|
||||
use std::path::Path;
|
||||
use std::time::{Duration, SystemTime};
|
||||
use std::{env, fs};
|
||||
use std::fs;
|
||||
use tokio::{task, time};
|
||||
use tracing_subscriber::filter::EnvFilter;
|
||||
use tracing_subscriber::fmt;
|
||||
|
|
Loading…
Reference in New Issue