Better HN
topnewbestaskshowjobs
Log inSign up

slaily

119 karma · joined Nov 7, 2023 (3y ago) · 6 submissions

Software Maker.
Submissions

comment 1y ago · link · parent

When your program does heavy concurrent writing and opens/closes connections for each write, most of them will fail with SQLITE_BUSY or SQLITE_LOCKED errors.

This situation can be managed with a pool of small (5 connections or less) to prevent spawning too many connections. This will reduce racing between them and allow write operations to succeed.

comment 1y ago · link · parent

If you’re building Python async apps (FastAPI, background jobs, etc.) with SQLite, you’ll eventually hit two issues

- Opening/closing connections is fast, but not free—overhead adds up under load

- SQLite writes are globally locked

aiosqlitepool is a tiny library that adds connection pooling for any asyncio SQLite driver (like aiosqlite):

- It avoids repeated database connection setup (syscalls, memory allocation) and teardown (syscalls, deallocation) by reusing long-lived connections

- Long-lived connections keep SQLite's in-memory page cache "hot." This serves frequently requested data directly from memory, speeding up repetitive queries and reducing I/O operations

- Allows your application to process significantly more database queries per second under heavy load

Enjoy!

3.

SQLite async connection pool for high-performance(github.com ↗)

197 points · by slaily · 1y ago · 84 comments

4.

Show HN: Better prompt(prompteval.co ↗)

2 points · by slaily · 1y ago · discuss

comment 2y ago · link · parent

Here's the routine I've developed:

1. Pre-work ritual: 5 minutes of breathing exercises to clear my mind.

2. Environment setup: Focus music (playlist), all notifications off.

3. Session structure:

    - 90 minute deep work blocks (using the "Deep Dive" timer)

    - 15 minute breaks between sessions
4. During sessions:

    - Single task focus (e.g., one feature or bug)

    - Handwritten notes for ideas/distractions
5. Post-session: Quick review and plan for the next block

6.

Show HN: Free deep work app with no ads, no paywalls, and no tracking(tikie.co ↗)

1 points · by slaily · 2y ago · 1 comment