DEV Community

๐—ฆ๐—ถ๐—ด๐—ป๐—ฎ๐—น๐—ฅ ๐˜€๐˜‚๐—ฝ๐—ฝ๐—ผ๐—ฟ๐˜๐˜€ ๐˜๐—ฟ๐—ถ๐—บ๐—บ๐—ถ๐—ป๐—ด ๐—ฎ๐—ป๐—ฑ ๐—ก๐—ฎ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—”๐—ข๐—ง

A .NET developer successfully reduced the startup time of their SignalR application to 180ms by using a 25MB AOT binary. This significant improvement was achieved by replacing the full .NET runtime with a trimmed-down SignalR-specific binary. The developer discovered that .NET 9's Native AOT compilation is no longer limited to console applications. Previously, their SignalR-based Azure Functions experienced slow startup times of 2.3 seconds, high memory usage of 150MB, and large container image sizes of 180MB. This was attributed to the misconception that SignalR required the entire .NET runtime, leading to bloated containers. The slow performance resulted in customer complaints. By implementing trimming, Native AOT, and minimal API hosting, they created a single, self-contained 25MB binary. This optimized approach also lowered memory usage to 45MB. Consequently, cold starts in their Azure Functions dramatically improved, and image sizes were reduced by 85%. The developer highlights Native AOT as a transformative technology for real-time .NET applications.
favicon
dev.to
dev.to
Image for the article: ๐—ฆ๐—ถ๐—ด๐—ป๐—ฎ๐—น๐—ฅ ๐˜€๐˜‚๐—ฝ๐—ฝ๐—ผ๐—ฟ๐˜๐˜€ ๐˜๐—ฟ๐—ถ๐—บ๐—บ๐—ถ๐—ป๐—ด ๐—ฎ๐—ป๐—ฑ ๐—ก๐—ฎ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—”๐—ข๐—ง