.NET – A Viable Microservices Platform?

For the past 10+ years I have been doing full stack development on data intensive applications most of that time using the .NET stack.  For the past 18 -24 months I have been focused on building out next generation distributed data platforms using Java and Scala.  I am partial to .NET, but as of the last time I looked, 24 months ago, .NET was just not a viable platform to build highly distributed/microservices based applications on.  It was optimized for desktop or monolithic server applications and was lacking support for many of the technologies that make distributed/microservices a workable architecture (containerization, deployment management, simple configuration orchestration, distributed monitoring/logging, etc.).

I work in a primarily .NET shop architecting and developing our next generation data platform.  Due to the scale, complexity and types of data we work with we have decided to use microservices and event sourcing for the basis of our architecture.  The majority of the developers are experienced in .NET so we are trying to use .NET wherever reasonable to simplify the learning curve and provide higher maintainability.  My job is to figure out the best path to accomplish this and I was pleasantly surprised with how viable a microservices platform .NET has become since my last investigation.   

So what is it that makes .NET so much more viable now?  Well there are many different things but I am going to just touch on two of them here.

.NET Core/Standard

I am not going to go into tons of detail on .NET Core/Standard as there are tons of articles out there explaining all the details. (.NET Standard, .NET Core, am explanation of the differences)

TLDR;

.NET Core is a development platform released in June 2016 that enables cross-platform development of applications that can run on Windows, Linux and macOS.

In the old .NET, creating an application required creating a project, registering that project with IIS, then configuring IIS to properly run it.  Often times .NET versions differed between machines or web.config files worked on one machine and not another, or IIS was configured one way on machine A but not on machine B.  This process was the bane of many development teams and led to more frustration than probably anything else in the development process.

Using .NET Core to build out applications is vastly simplified, which simplifies the entire development process.  In .NET Core there is no longer the requirement to run inside IIS and each application can use a specified version of the runtime.  .NET core applications are configured by default to run in a self hosted mode which minimizes the development headaches across team members.  As an additional bonus I can build and run .NET Core applications using either Windows (Visual Studio or VS Code), Linux (VS Code), or Mac (Visual Studio for Mac or VS Code).

Docker Support

The addition of Docker support was a huge leap forward for .NET, not only from a technology standpoint but also from a mindset shift.  If you had told me 5 years ago that .NET would be open sourced, running on linux, and providing solid support for containerization such as Docker I would not have believed you, and I think you might be hard pressed to find many that would have.  Well times have changed and .NET now has solid support for containerization in Docker and Windows Containers.  Visual Studio also provides the slickest integration with Docker of any IDE I have used.  I am not sure of another IDE where adding Docker support is as easy as:

  1. Right clicking on a project
  2. Selecting “Add Docker Support”
  3. Clicking “Debug”

With those simple steps (Docker must be installed, instructions here) you can now spin up and debug your project inside a running Docker container on your system.  When you combine that with Visual Studio’s ability to start multiple projects it gives you a powerful ability to orchestrate the  debugging of multiple microservices.

Conclusion

Due to the community support and flexibility of the platform to be augmented by third parties, Java has been the go to platform of choice when building distributed/microservice systems.  While this is likely to remain true for the foreseeable future the recent changes to the .NET platform have given it the ability to start to be part of the conversation in that area.  While there are many other things to take under consideration (e.g. Drivers for 3rd party tools like Kafka tend to be behind, lacking, or non-existent) the open sourcing of the .NET framework gives me some hope that a robust ecosystem will spring up like exists for Java.