BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Microsoft Migrates a Real-Time Service to .NET Core for Performance Gains

Microsoft Migrates a Real-Time Service to .NET Core for Performance Gains

Bookmarks

Microsoft migrated the real-time co-authoring service in the Microsoft Office suite of applications from .NET Framework 4.7.2 to .NET 7 last year. They achieved 30% CPU reduction, 60% memory reduction, and 50% API latency reduction compared to the original service.

The service, known as Real-Time Channel (RTC) in Office, powers the simultaneous editing and collaboration inside Office documents, whether in desktop or web Office clients. It is worth mentioning that on social media, the most frequent comment about this feature is complaining that it’s not working correctly.

According to Microsoft, the service serves hundreds of millions of document sessions daily. The service is built on top of the SignalR web sockets library with added functionality for session management, notifications and routing. It is written in .NET Framework version 4.7.2, a supported version of the legacy .NET application development framework.

Gilad Oren, principal software engineering manager for Office Collab Services in Microsoft, explains the reason for undertaking the migration of the service:

In April 2021, the service team made the decision to start the migration from .NET Framework to modern .NET (at this time, it was .NET 5). The main motivation for the migration was improving performance, reliability, cost (or COGS), and modernizing the platform and code base to reduce technical debt and increase engineering satisfaction.

The engineering team discarded a complete rewrite of the service as it would require all the client libraries for the service to be changed (for all Office client and web applications), which was out of the scope of the team maintaining the Office Collab Services. They decided instead to modify the service code to compile against modern .NET Core, using compiler conditional directives to inject custom code when necessary.

They faced two main problems during the migration. First, the RTC service used deprecated ASP.NET features such as HTTP modules and handlers. Finally, the SignalR server library’s .NET Core and .NET Framework versions use incompatible messaging protocols. The team wrote a custom ASP.NET Core middleware that listens to the old protocol HTTP calls and translates them accordingly for the SignalR Core version. It allows all the legacy clients to still use the old version of the library while freeing the team from the maintenance burden.

After the migration, Microsoft discovered some scaling issues with the IIS server and the SignalR Core libraries. They were fixed by overriding the default behaviour. The team used event counters (the cross-platform version of Windows performance counters) to monitor for performance issues while deploying the migrated service. After the service's rollout with .NET 6, the team migrated to .NET 7 to benefit from the performance improvements in the garbage collector feature. It required some refactoring around the web sockets connection management.

The roadmap for future improvements includes migrating the service to .NET 8, moving from IIS to the Kestrel lightweight server, migrating the Office clients to use ASP.NET Core SignalR communication protocol and removing the custom translation middleware in the service.

About the Author

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT