Posts

10 ASP.NET Core Performance Tweaks Every Dev Should Know

  10 ASP.NET Core Performance Tweaks Every Dev Should Know A.Radhakrishnan  Most ASP.NET Core apps don’t need a full rewrite, They need these ๐Ÿ”Ÿ micro-tweaks: 1. Use Minimal APIs for Lightweight Endpoints Ditch MVC where it’s overkill. Less overhead, faster routing. 2. Avoid .ToList() Too Early  Let EF Core compose the query — don’t force it prematurely. 3. Enable Response Caching  Static content? Cache it and save the CPU for real work. 4. Use AsNoTracking() for Read-Only Queries  Need blazing read speed? Stop EF from tracking changes you don't need. 5. Trim Middleware  Each middleware = overhead. Audit your pipeline. 6. Compress Responses (Gzip/Brotli)  Small payload = faster load. Your API will thank you. 7. Benchmark with BenchmarkDotNet  Guessing is for gamblers. Profile your bottlenecks. 8. Pool DbContext in High-Load Apps  DbContext pooling = fewer allocations = faster throughput. 9. Tune Kestrel Server Settings  Thread count, lim...

Recall ai reduced AWS bill by >$1,000,000 / year

 Recall ai reduced AWS bill by >$1,000,000 / year  Reducing bots CPU usage by up to 50% doing ๐Ÿ‘‡ Problem They identified majority of CPU time was spent in two "copy memory" functions 1. __memmove_avx_unaligned_erms  2. __memcpy_avx_unaligned_erms Biggest callers of these functions are, 1. Python WebSocket that was receiving the data 2. Chromium's WebSocket that was sending the data Expensive sockets - Single 1080p 30fps video stream, in uncompressed I420 format = 93.312 MB/s - Monitoring showed that at scale, the p99 bot receives 150MB/s of video data Solution - Shared Memory was implemented simultaneously accessed by multiple processes at a time  - Chromium writes to a block of memory, which is read directly by video encoder with no copying - Ring buffer was chosen as high level transport design Ring Buffer implementation Three pointers on Ring buffer - Write pointer: the next address to write to - Peek pointer: the address of the next frame to read - Read pointe...

๐—ฆ๐˜†๐˜€๐˜๐—ฒ๐—บ ๐——๐—ฒ๐˜€๐—ถ๐—ด๐—ป - ๐—ฅ๐—˜๐—ฆ๐—ง ๐—”๐—ฃ๐—œ ๐—•๐—ฒ๐˜€๐˜ ๐—ฃ๐—ฟ๐—ฎ๐—ฐ๐˜๐—ถ๐—ฐ๐—ฒ๐˜€

Image
       ๐—ฆ๐˜†๐˜€๐˜๐—ฒ๐—บ ๐——๐—ฒ๐˜€๐—ถ๐—ด๐—ป - ๐—ฅ๐—˜๐—ฆ๐—ง ๐—”๐—ฃ๐—œ ๐—•๐—ฒ๐˜€๐˜ ๐—ฃ๐—ฟ๐—ฎ๐—ฐ๐˜๐—ถ๐—ฐ๐—ฒ๐˜€             Article By: Radhakrishnan A Perumal   A REST API defines a set of rules that developers should follow when creating APIs. While designing REST APIs seems straightforward, there are some common mistakes you should avoid in interviews๐Ÿ‘‡ ๐Ÿญ) ๐—จ๐˜€๐—ถ๐—ป๐—ด ๐˜ƒ๐—ฒ๐—ฟ๐—ฏ๐˜€ ๐—ถ๐—ป ๐—จ๐—ฅ๐—Ÿ๐˜€ The endpoint URL should represent a resource (a noun), not an action (a verb). The HTTP method already indicates the action to be performed. ❌ GET /getAllBooks ❌ POST /createNewBook ✅ GET /books ✅ POST /books ๐Ÿฎ) ๐—ก๐—ผ๐˜ ๐—จ๐˜€๐—ถ๐—ป๐—ด ๐—”๐—ฝ๐—ฝ๐—ฟ๐—ผ๐—ฝ๐—ฟ๐—ถ๐—ฎ๐˜๐—ฒ ๐—›๐—ง๐—ง๐—ฃ ๐— ๐—ฒ๐˜๐—ต๐—ผ๐—ฑ๐˜€ Using the appropriate HTTP method makes your API intuitive. ↳ GET = retrieve data ↳ POST = create new resources ↳ PUT = replace the entire resource with a new representation provided in the request body. ↳ PATCH = Used to apply partial modifications to a resource ...

๐—™๐—ฟ๐—ผ๐—บ ๐—–๐—น๐—ฎ๐˜€๐˜€๐—ถ๐—ฐ "๐—ฆ๐˜„๐—ถ๐˜๐—ฐ๐—ต" in C# ๐˜๐—ผ ๐—ฆ๐˜„๐—ถ๐˜๐—ฐ๐—ต ๐—˜๐˜…๐—ฝ๐—ฟ๐—ฒ๐˜€๐˜€๐—ถ๐—ผ๐—ป

Image
  ๐—™๐—ฟ๐—ผ๐—บ ๐—–๐—น๐—ฎ๐˜€๐˜€๐—ถ๐—ฐ ๐—ฆ๐˜„๐—ถ๐˜๐—ฐ๐—ต ๐˜๐—ผ ๐—ฆ๐˜„๐—ถ๐˜๐—ฐ๐—ต ๐—˜๐˜…๐—ฝ๐—ฟ๐—ฒ๐˜€๐˜€๐—ถ๐—ผ๐—ป   Article By: Radhakrishnan A Perumal                                                                              Clean up old code with modern C# If you're still using old-style switch statements with repetitive case blocks and breaks, it's time for an upgrade. C# 8.0 introduced switch expressions, a modern, concise, and more readable alternative. They eliminate boilerplate and make your logic feel more declarative and elegant. ๐—ก๐—ผ ๐—บ๐—ผ๐—ฟ๐—ฒ: • Long chains of case blocks • Repeating return statements • Manual break management ๐—œ๐—ป๐˜€๐˜๐—ฒ๐—ฎ๐—ฑ, ๐˜†๐—ผ๐˜‚ ๐—ด๐—ฒ๐˜: • Compact syntax • Built-in pattern matching • Better type inference • Improved readability Whether you’re ret...