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
Zero Dependency Python Rate Limiter with 6 Algorithms and 3 Backends
More Relevant Posts
-
Most developers think clean code is enough. It’s not. You can have beautiful code... And still crash under real traffic. Because production doesn’t care about readability alone. It cares about: • Concurrency • Timeouts • Memory usage • Database locks • Retry storms • Load spikes Clean code matters. But resilient systems require more than clean code. Software that reads well is useful. Software that survives is valuable. #BackendDevelopment #SoftwareEngineering #SystemDesign #Python #Scalability
To view or add a comment, sign in
-
-
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
-
"Code is cheap, but performance is expensive." I built this CDN Audit Tool to solve a specific problem: Analyzing asset delivery at scale without the "GUI lag" or slow execution typical of many Python automation scripts. Check out the video below to see it in action! 👇 What's happening under the hood? Concurrency: Managed via ThreadPoolExecutor, allowing the tool to check dozens of assets simultaneously while the main thread stays 100% responsive. Thread-Safe UI: Implemented a queue.Queue "drain" system to pump background scan data into the Tkinter interface every 180ms without crashing the main loop. Architecture: Used a custom "Glow" widget system I built from scratch using the Tkinter Canvas API for a modern, dark-mode aesthetic. Efficiency: A global deduplication cache ensures we never ping the same asset twice, even if it appears on every page of a site. For me, being a developer isn't just about making things work—it's about making them fast, scalable, and user-friendly. #Python #SoftwareDevelopment #WebPerformance #GUIManagement #SoftwareEngineer #CodingProject
To view or add a comment, sign in
-
I used to think async def = concurrency. Turns out it's a promise I have to keep. Here's what clicked for me about FastAPI performance 👇 First, the mental model I had wrong: I thought async def meant "spread 40 requests across 40 threads and run them in parallel." Nope. Async doesn't use threads at all. The event loop runs everything on one thread and rapidly switches between requests at every await point. The actual waiting (DB, network) happens outside Python , so thousands of requests can be "in-flight" on a single thread. ❌ Wrong: 40 requests → 40 threads in parallel ✅ Right: 40 requests → 1 thread juggling them at every await Now the trap I almost fell into: If your endpoint has a blocking call (like requests.get() or a sync DB query), using async def is actually worse than plain def. 🔹 Plain def: FastAPI offloads to a threadpool (~40 threads). Slow requests run on separate threads. Event loop stays free. Free concurrency. ✅ 🔹 async def with blocking code inside: No await to pause at → the one thread freezes → entire event loop dies. Every other request waits. ❌ My decision guide now: 🔸 No I/O? → def 🔸 I/O with async libraries (httpx, asyncpg)? → async def + await 🔸 I/O but only blocking libraries (requests, psycopg2)? → def 🔸 Heavy CPU work? → neither. Use multiple workers or a task queue. The golden rule: async def is a promise to the event loop that you'll only do non-blocking work. If you can't keep that promise, don't make it. The trap: devs see "async = fast" and slap async def everywhere. But async without real await, is just a slower version of sync. Write async only when you can actually be async. 😀 #Python #FastAPI #WebDevelopment #BackendEngineering
To view or add a comment, sign in
-
JSON wasn't built for LLMs. TOON was. 🧵 TOON = Token-Oriented Object Notation ✅ Same data model as JSON ✅ ~40% fewer tokens ✅ 74% accuracy vs JSON's 70% (across 4 models) ✅ No curly braces — indentation does the work ✅ Tabular arrays — field names declared once ✅ Minimal quoting — cleaner for models to parse When you're pumping structured data into LLM prompts — user records, API responses, product tables — format efficiency matters. TOON is MIT licensed, spec-driven, and supports TypeScript, Python, Go, Rust, .NET and more. Playground + docs at toonformat.dev #iamabhinav30 #LLM #JSON #TOON #AIEngineering #GenerativeAI #TokenEfficiency #MachineLearning #JavaScript #TypeScript
To view or add a comment, sign in
-
-
I’ve just wrapped up a major milestone in my backend journey — implementing asynchronous processing in my Task Manager project, and the results are What I built: Sync vs Async API comparison endpoints Concurrent request handling using async routes External API integration with parallel calls Clean UI dashboard to visualize performance differences Results: Sync execution: 2160 ms Async execution: 1586 ms ~574 ms faster with async! This clearly shows how asynchronous programming can significantly improve performance when dealing with multiple I/O operations. Key Takeaways: Async = better scalability & responsiveness Perfect for external API calls & high-load systems Clean architecture makes debugging & scaling easier Tech Stack: FastAPI | Python | Async/Await | HTTPX | SQLite | Custom UI This phase really helped me understand how modern backend systems handle concurrency efficiently. #BackendDevelopment #Python #FastAPI #AsyncProgramming #WebDevelopment #SoftwareEngineering #LearningInPublic #100DaysOfCode
To view or add a comment, sign in
-
𝗨𝗡𝗟𝗘𝗔𝗦𝗛𝗜𝗡𝗚 𝗧𝗛𝗘 𝗨𝗟𝗧𝗜𝗠𝗔𝗧𝗘 𝗣𝗬𝗧𝗛𝗢𝗡 𝗣𝗢𝗪𝗘𝗥𝗛𝗢𝗨𝗦𝗘: 𝗧𝗛𝗘 𝗦𝗘𝗖𝗥𝗘𝗧 𝗧𝗢 𝗕𝗨𝗜𝗟𝗗𝗜𝗡𝗚 𝗟𝗜𝗚𝗛𝗧𝗡𝗜𝗡𝗚 𝗙𝗔𝗦𝗧 𝗔𝗣𝗜𝗦 𝗥𝗘𝗩𝗘𝗔𝗟𝗘𝗗 As we head into 2026, building scalable microservices requires a rock-solid understanding of how your code is organized from the first line. This guide demystifies the structural foundations of FastAPI to ensure your backend remains maintainable as your codebase grows. THE FASTAPI INSTANCE The core of every application begins with initializing the FastAPI class. This instance acts as the central router and configuration hub, serving as the bridge between your incoming HTTP requests and your internal application logic. Understanding how to instantiate this object correctly is the first step toward managing middleware, dependencies, and route decorators effectively. ROUTING AND PATH OPERATIONS Path operations are the fundamental building blocks of your API. By using decorators linked to your FastAPI instance, you define how the server responds to specific HTTP methods like GET or POST. This video breaks down how these functions map directly to URL paths, allowing for clean, readable code that handles client communication without unnecessary complexity. PARAMETER HANDLING AND TYPE HINTS FastAPI leverages Python type hints to perform automatic data validation and documentation. By defining expected types for path parameters, query parameters, and request bodies, you enable the framework to enforce data integrity before your logic even executes. This approach significantly reduces the surface area for bugs while providing built-in Swagger UI documentation for your endpoints. As a Senior Engineer, I cannot overstate that the structure of your application in 2026 is just as important as the logic inside it. FastAPI enforces good habits early by requiring explicit type definitions and clear route mapping, which saves hundreds of hours in debugging and refactoring down the line. Treat your project structure as your primary documentation. Tags: #FastAPI #Python #API #BackendDevelopment 📺 Watch the full breakdown here: https://lnkd.in/d7YeSp75
⚡2. FastAPI Explained: Beginner’s Guide to Program Structure | Beginner-Friendly Python API Tutorial
https://www.youtube.com/
To view or add a comment, sign in
-
Most AppSec programs have a blind spot. Python and npm dependencies? Tracked and patched. The C and C++ (C/C++) code powering your OS, firmware, and real-time systems? A blank space where the risk assessment should be. The problem isn't complexity. It's that most tools were built around the assumption that dependencies are declared somewhere machine-readable. In C/C++, that assumption fails. Alexandra Selldorff wrote about why and what getting it right actually looks like. https://lnkd.in/gDPd-KPQ
To view or add a comment, sign in
-
Recent work has been focused on handling edge cases in large scale web analysis Cloudflare protection layers forced deeper exploration into request patterns header consistency and session behavior Simple request libraries are not enough when endpoints validate beyond basic parameters Tested Tor based routing to understand how IP level variations impact accessibility and response behavior A major part of the challenge has been handling failures SSL verification issues DNS resolution failures Malformed or empty responses The real goal is not just extraction but building systems that remain stable under unpredictable conditions Optimization is ongoing #WebScraping #Python #Automation #Cloudflare #Tor #Backend
To view or add a comment, sign in
-
I spent a few weeks migrating 5 microservices from C# + gRPC to F# + gRPC. Personal project, no deadlines, no pressure.... only fun!! I have a background in functional programming. But I had not touched anything in that paradigm for years. Day-to-day Python, C/C++, C# is imperative by default, and that default goes deep. The good part first: some things in F# are genuinely simpler. Discriminated unions for domain modeling, function composition with |>, pattern matching that covers every case and the compiler holds you accountable. Things that exist in C# too, but cost more code to express. The beginning was harder than I expected, precisely because of that background.... I knew what a pure function was. I knew what immutability meant. The problem is that knowing something conceptually does not mean your brain will reach for it first when a problem shows up. Years of writing loops and mutations build a reflex. My first instinct was still: create a variable, iterate, mutate. In F#, that path exists, but you are swimming against the current. The language pushes you to think about what the function receives, what it returns, how to compose that with the next step. It took me a while to stop mentally translating C# into F# and start formulating the problem in F# directly. Another real point: the compiler is strict, which is good, but error messages can be cryptic when you are still reactivating that way of thinking. You know something is wrong, but the message does not always point directly at it. In the end, it worked. The services are running, gRPC integrated without major surprises, and the code got leaner in several places. The most useful thing I learned was not technical. It was realizing that knowledge rusts when left untouched, and that years on the imperative autopilot leave a deeper mark than it seems. And on that note: AI is making this worse. Every time you let it write the code, debug the problem, or think through the design for you, you are not just saving time. You are letting your own knowledge rust a little more. It does not matter if it is functional programming, system design, algorithms, or anything else in tech. The muscle atrophies when it stops being used. #fsharp #dotnet #grpc #functionalprogramming
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