NGINX Unit – a Dynamic, Polyglot Application Server for Microservices
Sandeep K I Director and CTO, Ashnik
NGINX Unit is a new, lightweight, open source application server built to meet the demands of today’s dynamic and distributed applications. Deploy configuration changes with no service disruptions. Run code in multiple languages. Build the foundation of your service mesh. An application server – and much much more.
With Microservices architecture becoming a norm, Organizations are now deploying new features and functionalities more frequently. The NGINX Application Platform enables teams to build or modernize applications with the most efficient DevOps tools and best practices, including cloud, containers, and Microservices.
NGINX Unit is a dynamic web application server, designed to run applications in multiple languages. Unit is lightweight, polyglot, and dynamically configured via API. The design of the server allows reconfiguration of specific application parameters as needed.
And hence, with the latest addition of Unit, a web application firewall (WAF) and its centralized management tools – NGINX becomes your best bet as a complete platform in Application development, deployment and delivery.
Some of the most exciting features of Unit are:
– It is a fully dynamic application server
– Its ability to run multiple applications written in different languages and even different language versions on the same server
– It is configured through a simple API based on industry-standard JSON
So, what does a ‘dynamic configuration’ mean?
It basically means that there is no configuration file at all. You interact with the Controller process with a RESTful JSON API on a TCP socket. You can upload the whole configuration at once, or just as a part.
You can change or delete any part of the configuration and Unit will not reload the entire configuration – only the relevant part is reloaded. This means that you can change your configuration as frequently as you want.
You may also look at Unit for back end application use cases which is configured and controlled by simple APIs. As most of you may be aware, Nginx web server is controlled by a configuration file. But Unit does not have any configuration file and is controlled by API, the interfaces are also different. Nginx Unit APIs are easy – let’s try to understand through an example for PHP application:
Unit API example
A quick overview of application and listener objects
|application||name of application|
|type||type of application ( php )|
|workers||no. of application workers|
|root||Directory to search php files|
|index||Default launch file|
In the application section, you can give the name of application, type of application as language and also version of language. In the listener section, you define the IP address and ports for application. You can create many listeners and many applications, and bind them together the way you like.
Now, if you make changes then normally to make it in effect you reload the server again. But the best thing here is you do not need to do that if you don’t want to. You can send the whole JSON payload as a PUT request to the NGINX Unit control socket or you can make changes one by one, accessing each of the objects and each of the strings separately by their own URLs. This means that you can change your configuration as frequently as you want without reloading and that’s why Unit is a dynamic application server.
At the moment, Unit is in beta and we look forward for its GA. We are sure that the value proposition this will bring to enterprises will be huge in terms of a truly Dynamic, Polyglot Application Server for Microservices.
More such updates will be coming your way, going ahead. Stay tuned! Till then, feel free to reach us to discuss your needs on Nginx in detail.
Sandeep Khuperkar I Director and CTO, Ashnik
Sandeep is Director and CTO at Ashnik. He brings more than 22 years of Industry experience (most of it spans across Red Hat & IBM India), with 14+ years in building open source and Linux business. He is on the Advisory Board of JJM College of Engineering (Electronics Dept.) and visiting lecturer with few other Engineering colleges. He is an author, enthusiast and community moderator at Opensource.com. He is also a member of Open Source Initiative, Linux Foundation and Open Source Consortium Of India.