An answer of definite YES or NO is highly irrelevant here, because a Microservice can be written in any programming language which supports some communication end point, such as API.
A Microservice is an application architecture style and the programming language used is just one element of it. Let us revisit Martin Fowler’s definitions from 2014,
…a particular way of designing software applications as suites of independently deployable services
…developing a single application as a suite of small services, each running in its own process
…which may be written in different programming languages and use different data storage technologies.
Not all Microservices need to follow all the characteristics defined by all the experts in the field, but at least we have to make sure it is not violating any characteristics.
There are different deployment options available such as Kubernetes, or Azure Container Service. They use a concept of removing-the-bad, and spin-up-new containers. To support this process, it is important to make sure our microservice applications are independent and stateless to avoid any application crashes or malfunction.
Coming back to our question of programming languages, while we can use any languages or technology stack for writing Microservices, it is always good to keep these points in mind while selection:
- If not necessary, try to avoid languages which requires a virtual machine to run..such as JVM for Java. Some memory resident platforms require some bootup and killing time which can delay the instance creation and destroy. Found Go handles is better.
- Smaller the better, the container size matters. Some languages require a bigger library to be accompanied to have the application work properly, but it makes the container size bigger.
- Application performance – some programming languages are faster for some operations compared to others
Well, it all boils down to the functional and technical requirements, and I do believe that the selection of programming language is not crucial for most cases. Upon Google research, it is also found that people rely/biased on their own skillset to build Microservices, than making the choice-of-language a problem in front of them, which makes this question a low priority concern.
Read about Microservices here – https://martinfowler.com/articles/microservices.html