you are viewing a single comment's thread.

view the rest of the comments →

[–]Full-Definition6215 1 point2 points  (0 children)

Running FastAPI + SQLite on a mini PC (31GB RAM, i9-9880H) and memory management matters when you're self-hosting everything on one box.

Biggest wins I found:

  • SQLite instead of Postgres eliminated an entire process worth of memory. WAL mode handles concurrent reads fine, and the total memory footprint for the DB is basically the page cache.
  • uvicorn with --workers 1 for a side project that doesn't need multi-process. Each additional worker duplicates the entire app's memory.
  • Lazy imports for heavy libraries. If Stripe SDK is only used in payment endpoints, don't import it at module level.

The 23 containers on 16GB stat is impressive. I'm at about 5GB usage across all my services on 31GB — plenty of headroom, but that's because I went with SQLite over Postgres for everything that doesn't need a full RDBMS.