Start Free Trial Book a Demo
Webinar on Documentation Insights: Role of Context in Technical Communication - Jan 22, 2025 | 02:30PM UTC - Register Now!
View all
windows to Linux on Azure

How Document360 Shifted from Windows to Linux on Azure 

As Windows users, by default, our first choice for setting up the infrastructure is often (or most of the time) a Windows-compatible environment. This preference or decision is mainly due to familiarity, knowledge, and, of course, time factor. However, as our application or product grows, we’ll end up with a magic word, cost optimization, that too not compromise the quality of the service. So, we need to start thinking about the strategies that can contribute to cost optimization. One of the significant optimizations that you can consider is migrating from Windows to a Linux environment.  

Did you know that migrating from Windows to a Linux environment in Azure can result in up to 60% savings on operational costs and enhanced performance? The application could start up faster, scale-out more effectively, and utilize system resources more efficiently. If these benefits sound interesting to you, Let’s deep dive into the details and discover how this migration helped Document360 to both application performance and cost optimization. etc.  

What are the key factors to consider before migration?

When you migrate from Windows to Linux environments, in most cases, it sounds “like a lift and shift” approach in terms of environment and deployment cases. However, the preparation will vary based on the services that you have, such as infrastructure as a service or platform as a service. In either case, planning for a no-downtime deployment and switching your services from Windows to Linux is essential.  Prerequisites:  

  1. Basic Linux knowledge: it’s required to learn at least the basics of the Linux system for seamless migration and debugging/diagnostics. Also, it’s important to get expertise on Linux commands and concepts to ease this migration.  
  2. Load balancing (nice to have): It’s nice to have a reverse proxy (Load balancer) which will ease your migration deployment by just switching your backend pool service, this will switch the traffic from Windows to Linux environments with minimal or no disruption.  

Migration preparation

Before diving into migration work, it’s important to create a detailed plan on what are the different types of services you are planning to migrate from Windows to Linux. Let’s document the services and their dependencies, such as Database, Search system, Managed Identity, Networking, etc to track the service and migration status. And conduct a detailed analysis to identify any limitations based on application configuration or requirements.  

For example, auto-swap feature we in our non-production environment to swap the slots as part CI/CD process, but Linux does not support this feature. In such cases, we need to plan for an alternate way to achieve the same.  

Also, it is important to make sure all the services that you’re planning to consume are production-ready, and not in the preview or beta phase. For instance, when we worked on the migration plan, Application insights were in preview mode, so we had to delay our production deployment.   

Next, in the coding part, don’t forget to revisit your code to remove any Windows-specific dependent code, such as file operation using the system.io namespace or any other third-party libraries that run only on the Windows platform.  If your application is built on dotnet core then any code written in the web config file should be converted as a middleware component.  

Finally, database drivers and connectivity settings are compatible with Linux systems to ensure a smooth transition. 

Challenges

Migrating from Windows to a Linux environment comes with a set of challenges.  

One of the primary challenges for every Windows developer/DevOps team while migrating to Linux is debugging or identifying the issues and acting on them in a short period. For instance, one issue that we encountered was a container crash due to application errors. This can be new to Windows platform experts since it is not a known case in Windows environments. When there are a certain number of 500+ errors due to application code then the Linux container may crash. So, to mitigate this issue, it is crucial to analyze the application code-related issues and alert the corresponding development team to address the errors.  

Code dependencies – We faced a few challenges in Windows-specific code or library dependencies, which required code fixes to address errors or functional breakage.  

Driver incompatibility – When we connected our database system with a Linux-compatible driver, we encountered an unexpected slowness in database connection and execution. After thorough analysis, we identified there were mismatches between the database version and application package version to seamlessly work with the Linux platform.  

Case sensitivity – Linux systems are case sensitive, unlike Windows. So, we had to make a few changes in file handling process-related code and URL mapping/routing-related code.  

Deployment

When it comes to deployment, the end user doesn’t need to know whether the underlying system is a Windows or Linux platform, but what matters most is a seamless and uninterrupted user experience and high availability or maximum uptime.  

Document360 is leveraging Cloudflare for Load balancing simplifies our deployment process. We replicated our Windows environment in Linux with all necessary dependencies configured correctly to handle end-to-end traffic. These dependencies included the backend database, Monitoring system, configuration, secret management, search database, networking, managed identity, etc.  

We validated the Linux setup in non-production environments, and it was monitored for two months to track the application performance and address bug fixes specific to Linux migration.  

Before moving to production, it was tested with internal sites using load balancing and custom rules configuration in Cloudflare.   

After all tests passed, we successfully rolled out to the production environment, especially without downtime. This milestone was achieved by simply switching the load-balancing servers from Windows to Linux, ensuring a smooth and efficient transition.  

Monitoring and Health 

Monitoring is one of the crucial requirements in identifying and addressing the challenges that we discussed earlier with the help of monitoring rules and proper configuration. Ensure that proper monitoring is in place to determine the application’s slowness and exceptions. 

One way to narrow down the exceptions effectively is to create multiple rules for different types of exceptions. For instance, critical exceptions require immediate attention even for a single occurrence whereas other common exceptions such as null reference, and improper argument can be grouped as aggregate exceptions based on the count and time.  

To ensure high availability, maintain at least two instance or service and configure health check for load balancing. It’s essential to configure the auto-heal setup in addition to the health check configuration. AutoHealth can address the unexpected container crash issues by creating a new instance for the same. 

These configurations not only help in identifying and resolving the issues promptly but also ensure the availability and performance of the application.  

What are the advantages of this migration for Document360?

Better App Startup Time – Linux containers are known for better startup time compared to Windows applications. Since Linux is more lightweight, the boot time and our application startup time have reduced significantly.  

Quick Scale-out – Scale-out operations performed better compared to Windows since Linux container requires minimal footprint to replicate and scale in better way.  

Application Performance – Linux systems are better known for efficient resource utilization, they typically require fewer resources compared to Windows to run the same workload (Memory and CPU), thus overall getting better application performance also handling concurrent requests in a better way.  

After this migration, we were able to gain a 30% improvement in performance and handling concurrent requests. We used the Azure Load test tool to measure the performance metrics.  

Another thing we noted was using Managed Identity (MI); when you create a new app there will be up to a 15-minute delay in establishing the connectivity between your app and MI. we had some delay in scale out and app restart events as well. But we don’t find these issues with Linux, the handshake between the Linux app and MI is instant.  

Security – Also, in terms of security, windows by default allow all and deny specific settings/configuration, in contrast, Linux systems by default deny all and allow specific settings/configuration. For example, the X-Powered-by setting is enabled by default in Windows and disabled by default in Linux. So, we’ll have better control over what settings need to be enabled in terms of security and configuration.  

CI/CD improvements – Since our app changed to Linux, then, of course, we changed our build agent as well to Linux. Our build pipelines became more efficient, our build and deployment times were reduced by close to 20%. 

Cost Optimization – We achieved a 60% reduced cost in which the services migrated from Windows to Linux. With optimized cost savings we could scale up a few high-traffic services to a higher level of machines.  

Windows to Linux on Azure cost savings

configuration in Linux against Windows

The above diagram explains the cost savings when you choose the same machine and configuration in Linux against Windows with Reservation.  

Conclusion

Migrating to Linux Services can produce better performance for your applications, such as reduced startup times, efficient scaling operations, and optimized resource utilization. These improvements not only enhance application performance but also better cost savings. 

Suppose you’re considering migrating your Azure services from Windows to Linux for these benefits. In that case, it’s important to perform thorough testing and validation to confirm these advantages align with your application/product-specific use case.  

An intuitive knowledge base software to easily add your content and integrate it with any application. Give Document360 a try!

GET STARTED
Document360

Related Articles