Location: commands.py — execute()'s with self._engine_lock: wraps every command including SAVE
Problem:
Every client (GET, SET, everything) queues behind the full json.dump() duration during SAVE. This is the Python equivalent of Redis without fork()/BGSAVE — there's no copy-on-write trick available here.
Fix (pick one):
Document it explicitly as a blocking operation (cheapest fix, valid for an educational project).
Or: snapshot a shallow copy of _data/_expires while holding the lock, release the lock, then do the actual disk I/O outside the lock. Reduces blocked time to the copy, not the write.
Location: commands.py — execute()'s with self._engine_lock: wraps every command including SAVE
Problem:
Every client (GET, SET, everything) queues behind the full json.dump() duration during SAVE. This is the Python equivalent of Redis without fork()/BGSAVE — there's no copy-on-write trick available here.
Fix (pick one):
Document it explicitly as a blocking operation (cheapest fix, valid for an educational project).
Or: snapshot a shallow copy of _data/_expires while holding the lock, release the lock, then do the actual disk I/O outside the lock. Reduces blocked time to the copy, not the write.