“App started breaking under the first production load test, even though the structure was correct.” Sometimes it’s not just about having a perfect application structure but about proper configuration tuning. That’s why I’m sharing another comparison, the earlier run without tuning (present on my profile) and the optimized version after tuning. At ~300 concurrent users, latency behavior degraded sharply, P99 reached ~2.7s and max spikes went up to ~7s, even though average response time still looked normal. The issue wasn’t the API structure or queries; it was how DB connections were being handled under concurrency. Pooling wasn’t properly enforced, so requests started queuing instead of executing in parallel. After fixing proper pool acquisition and ensuring each request correctly borrows/releases a connection, performance stabilized under the same load. Same system. Different behavior under pressure. #fastapi #python #backenddevelopment #postgresql
Improving Performance with Proper DB Connection Tuning
More Relevant Posts
-
One thread. Three concurrent requests. Zero threads blocked. That is what async FastAPI looks like when it works correctly. I have been exploring Python and FastAPI recently — and the async model was the thing I wanted to understand properly before forming any opinion. Here is the honest picture: → Async helps only when your endpoint is waiting — on databases, APIs, file reads (I/O-bound) → Async does nothing for CPU-heavy work — use multiprocessing or task queues for that → Committing to async means your database driver must also be async — psycopg2 blocks the event loop → Java 21 virtual threads give Spring Boot similar concurrency without changing the programming model I also compared FastAPI and Spring Boot feature by feature — validation, DI, ORM, security, scheduling, migrations — and evaluated both against a real test project. Link in comments. #FastAPI #Python #SpringBoot #BackendEngineering #Async
To view or add a comment, sign in
-
Mastered the HTTP Request-Response Cycle & Methods! 🐍 Moving deeper into my Python Backend journey, I’ve realized that a great API isn't just about the code—it’s about how it communicates. Today, I took a deep dive into HTTP (HyperText Transfer Protocol), the backbone of every interaction on the internet. Here is what I explored today: 🔄 The Request-Response Cycle: Learned how a Client (Browser) and Server (Backend) talk to each other. Understanding that every request I send from the frontend needs a structured response from my FastAPI server. 🛠️ The "Big Four" HTTP Methods: GET: Fetching data safely (The "Read" operation). POST: Sending new data to the server (The "Create" operation). PUT: Replacing or updating existing data (The "Update" operation). DELETE: Removing data from the system (The "Delete" operation). 🚦 Status Codes & Headers: Started identifying the "secret language" of servers—from the successful 200 OK to the dreaded 404 Not Found and 500 Internal Server Error. This knowledge is the bridge between my local Python scripts and the global web. I'm now ready to start building RESTful APIs that can handle real-world traffic! #Python #WebDevelopment #HTTP #BackendDeveloper #CodingJourney #FastAPI #SoftwareEngineering #RESTAPI #TechCommunity #ContinuousLearning
To view or add a comment, sign in
-
-
Stop memorizing IP addresses. 🛑 I got tired of typing ssh root@192.1xx.xx.xxx from memory every time I needed to check a server. So, I built ssh-to-server — a tiny CLI tool that turns your SSH config into an interactive menu. Why use it? 📂 Zero Config: It automatically reads your existing ~/.ssh/config. ⌨️ Interactive UI: Pick a server using arrow keys or quick number shortcuts. 🛠️ Respects your setup: Works with your IdentityFile, custom ports, and proxy jumps. Is it revolutionary? No. Does it save me from 20 daily typos? Absolutely🤓 Built with Python, Click, and a healthy dose of terminal customization procrastination. 📦 Install it: uv tool install ssh-to-server (or pip install ssh-to-server) 🔗 GitHub: https://lnkd.in/eh--kjfZ If your SSH config is longer than your shopping list, this one's for you. 🤝 #Python #DevOps #CLI #OpenSource #Productivity
To view or add a comment, sign in
-
-
Rate limiting shouldn't come with a side of dependency hell. 🐍 Most Python rate limiters force a trade-off: either use a basic "fixed-window" script or pull in a heavy framework with a dozen sub-dependencies. This library was built to provide production-grade primitives with an emphasis on architectural flexibility and a zero-dependency footprint. The Technical Breakdown: ✅ 6 Algorithms: Beyond the standard Token Bucket. Includes Fixed/Sliding Windows and ADAPTIVE logic for dynamic scaling. ✅ 3 Backends: Native support for Memory and Redis, supporting both local-first and distributed environments. ✅ Zero Dependencies: Designed for high-security environments and lean builds. No requirements.txt bloat. ✅ Implementation: Clean integration via decorators for functions or middleware for web frameworks. If you are managing API quotas or protecting services from traffic spikes, the implementation details and performance focus are worth a look. https://lnkd.in/gnikRUHa #Python #SoftwareEngineering #SystemDesign #OpenSource #Backend #DistributedSystems
To view or add a comment, sign in
-
-
built a billing system from scratch to better understand how they work under the hood 🛠️ the hardest part wasn't writing the code, it was handling edge cases. if someone double-clicks "Pay," a poorly designed system charges them twice. i solved that using idempotency keys: duplicate requests return the same result, so customers are only charged once. What’s inside: - Atomic transactions: subscription and invoice are created together, or neither is saved. - State machine logic: invalid status changes are blocked (canceled subscriptions can’t be reactivated accidentally). - Idempotent payments: repeated requests don’t create duplicate charges. - Redis queue: payments are accepted instantly and processed asynchronously in the background. Learned more building this system than from most tutorials. github: https://lnkd.in/eKNz_6VE #backend #python #systemdesign
To view or add a comment, sign in
-
-
🏗️ Building the Backbone: From Python Classes to Persistent Data "The best way to learn is to build, break, and fix. 🛠️ Over the last few days, I’ve been architecting the backend for my FastAPI TodoApp. It’s been a journey of connecting the dots: Defining the Schema: Using SQLAlchemy to turn Python classes into database tables. Establishing the Link: Setting up the engine and SessionLocal to bridge the gap between my app and SQLite. Overcoming Hurdles: Navigating Windows environment variables and mastering the SQLite3 CLI to verify data integrity. The foundation is now officially set. By calling models.Base.metadata.create_all(engine), my app now automatically generates its own database environment on startup. Next stop: Developing the CRUD API endpoints to bring this data to life! 🚀" #Python #FastAPI #SQLAlchemy #BackendDevelopment #CleanCode #SoftwareEngineering
To view or add a comment, sign in
-
-
Today I ran into a classic backend bug while testing my FastAPI project 🚀 Everything was working fine until login started throwing a 500 error. After debugging, I found the issue: Environment variables are always read as strings — which caused a failure in timedelta() while generating JWT tokens. A small fix (casting to int) solved it, but the learning was huge: ✔ Always validate environment configs ✔ Debugging > coding ✔ Real-world issues teach the most Also successfully: ✅ Deployed FastAPI app on Render ✅ Integrated PostgreSQL ✅ Implemented authentication with JWT ✅ Added pagination Next step: Docker + CI/CD 🔥 Live API: https://lnkd.in/gVAWNtVp #FastAPI #BackendDevelopment #Python #DevOps #LearningInPublic
To view or add a comment, sign in
-
Day 4 of learning backend from first principles. Today I went deeper into how the web actually communicates. Focused on: • HTTP — request/response cycle • How servers handle multiple requests • Built basic real-time communication using WebSockets in Python Big realization: HTTP is stateless — every request is independent. But real-world apps (chat, live updates, notifications) need continuous communication. That’s where WebSockets come in. Instead of: Request → Response → Close It becomes: Connection → Continuous data flow This is the difference between: Loading a page vs building real-time systems. Still connecting the dots, but now I’m starting to see: Backend isn’t just APIs — it’s communication architecture. #BackendDevelopment #Django #WebSockets #HTTP #WebDevelopment #LearnInPublic #Python #SoftwareEngineering
To view or add a comment, sign in
-
Quick infrastructure update for anyone using Invinoveritas: The API has moved from a raw IP endpoint to a stable HTTPS domain: Old: https://lnkd.in/d4cCaff8 New: https://lnkd.in/dx99Rc5A What this means practically: MCP clients (Claude Desktop, Cursor, Windsurf, etc.) now connect cleanly without HTTPS warnings All major agent frameworks that require HTTPS work out of the box Updated in the official MCP Registry: io.github.babyblueviper1/invinoveritas Python SDK continues to work — just update the base_url if you had it hardcoded Everything else remains the same: Lightning L402 pay-per-insight 5 free calls on registration Persistent agent memory Trading bot support New endpoint: https://lnkd.in/dx99Rc5A
To view or add a comment, sign in
-
💡 Day 61 of LeetCode Problem Solved! 🔧 🌟 482. Find Maximum Consecutive Ones 🌟 🔗 Solution Code: https://lnkd.in/gf5DPq4E 🧠 Approach: • Traverse the binary array once using one pointer. • Keep counting consecutive 1s and update the maximum value at each step. • When a 0 appears, reset the count to 0. ⚡ Key Learning: • This is a simple sliding window idea. No need for nested loops or extra memory. Tracking current count and maximum value is a useful pattern for many array problems. ⏱️ Complexity: • Time: O(N) • Space: O(1) #LeetCode #Java #DSA #ProblemSolving #Consistency #CodingJourney #Algorithms #Arrays
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
So in previous comment you tested which fits you needs better - FastAPI or Nodejs. You found that Nodejs is faster. Then you got slower solution (fastAPI) and deployed it on production (?) and now you make another post about FastAPI optimizations after you saw it’s slow in production? Jokes aside, I glade my comment help you to generate another post using LLM and to add details about db pool :) next time ask it to check the contradiction with previous posts, also add all comments from previous posts to LLM context, this way it will give you the best results 😁 also I recommend other people read my posts better as I don’t post LLM slop, but only real-world cases