mirror of https://github.com/fail2ban/fail2ban
extremely speedup of all database operations:
- (synchronous = OFF) write data through OS without syncing - (journal_mode = MEMORY) use memory for the transaction loggingpull/1436/head
parent
34ae0b916e
commit
db9e724038
|
@ -182,8 +182,11 @@ class Fail2BanDb(object):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
cur = self._db.cursor()
|
cur = self._db.cursor()
|
||||||
cur.execute("PRAGMA foreign_keys = ON;")
|
cur.execute("PRAGMA foreign_keys = ON")
|
||||||
|
# speedup: write data through OS without syncing (no wait):
|
||||||
|
cur.execute("PRAGMA synchronous = OFF")
|
||||||
|
# speedup: transaction log in memory, alternate using OFF (disable, rollback will be impossible):
|
||||||
|
cur.execute("PRAGMA journal_mode = MEMORY")
|
||||||
try:
|
try:
|
||||||
cur.execute("SELECT version FROM fail2banDb LIMIT 1")
|
cur.execute("SELECT version FROM fail2banDb LIMIT 1")
|
||||||
except sqlite3.OperationalError:
|
except sqlite3.OperationalError:
|
||||||
|
|
Loading…
Reference in New Issue