By Afzaal Ahmad Zeeshan, Alibaba Cloud Community Blog author.
Regardless of the size and complexities of a distributed application, the task of maintaining the configuration settings seems one of the most crucial steps. This requires an insightful analysis and tracking, planning, and deployment. Furthermore, you must need to be keen-eyed for the system requirements and integrity of your configuration files. Reading variables such as parameterized variables either from the global or environment specific variables during system development is the fundamental part of any application, there are conditions based on these values which you need to cover programmatically and manage them in a separate configuration file.
As mentioned, these configuration settings can be static or dynamic. In the static configuration, we do need to rebuild and deploy the whole application even when there is a slight change in our configuration file. On the contrary, with the dynamic configuration, we can have changes updated at any point in time during the execution of our application. Dynamic configuration settings require more advanced and complex software development designs, and they also require some mechanism to control how the configurations are managed. I will discuss those points later in this article as we explore how Alibaba Cloud lets you manage these and modify the configurations for your applications in a distributed topology.
Therefore, throughout the application life-cycle, the main idea of managing configurations revolves around separating application configurations from the applications state, meaning that we must architect our application in such a way that it can read configurations dynamically from an external service. This can be done via a secondary method or function that loads the configurations and applies them to the state of application.
I will emphasize on the term "reading configurations dynamically using an external resource" because the traditional way of accessing environment settings (global variables, region, and instance specific setting, etc.) sounds cumbersome especially in the distributed environment. Because managing different file sections for individual settings and configurations becomes overly complex as our applications scale so as the size of the configuration file. And as your application becomes a distributed solution, it gets difficult to manage and apply patches.
Moreover, the default way of using these files is to load them at startup; that means, you need to redeploy your application to reflect the changes-redeployment requires a rebuild and a complete CI pipeline must be triggered. Now coming to the solution, as I have already mentioned that decoupling the process of reading configuration seems an optimal and recommended way, and this is where Alibaba Cloud's Application Configuration Management Service comes in to the play, which undoubtedly provides the most appropriate and a centralized approach to manage our configurations set.
When you use Alibaba Cloud Application Configuration Management Service, then all the required steps from setup to management take place in the Alibaba Cloud's datacenter. The overall management cycle primarily involves the following steps:
Once there is a change in the configuration your application can take necessary steps to apply the patches or your orchestrator can redeploy the application.
Thinking of any other plausible workaround for separating this file reading from your application code base is to host your configuration file somewhere either on the cloud service which you are already paying off for, or you can use any free storage to place your configurations there and then use the connection string to coordinate from that service. However, in turn, you will compromise many features such as; versioning and backup mechanism of your configuration files, quick rolling back to any configuration state that was suitable for users, and security etc.
To enable your application to fetch configurational settings from external ACM, you will be using HTTP protocol to send the request and then reading the response back, in a very simple RESTful manner. Furthermore, using ACM provided authentication, you will enable data integrity and security as it supports encryption as configurations cater to the most crucial information for our applications.
First, you create the configuration for your application; then you can use native API of ACM to send the request to your configuration and listens to changes pushed in your configuration files. Note that, from the other end, once you will push any change to your configuration console, respective server receives change in the configuration, consequently, it changes the application status accordingly. For example, Alibaba Cloud provides you with preconfigured samples for your SDK or runtime,
Python code is the shortest of these, that is why I am using that, and you can select any of the code samples that your application is written in. Once we receive response from our HTTP service in any of the supported languages; JSON, XML, YAML, HTML, and Text, then we parse it to an object according to our underlying application logic. Depending upon the application values, we can check on different conditions programmatically to reflect the respective behavior in our application, such as changing discount offer, background colors as per any specific occasion, etc.
As I have already mentioned, you need to start your ACM service only once at the startup time of your application, and then throughout the execution whenever any change will be pushed in your configuration files, your application will be able to fetch and mirror those changes dynamically at the run time. Even if you do not use the dynamically adoption of the changes in your application, you can try to use RESTful API and request the updates from the servers. This can help you lower the overall complexity of the application when the configurations are to be changed every day or every pre-known time.
Now that, we have discussed all the major points that why and how we need to use Alibaba cloud Application configuration manager, I can walk you through some of the core advantageous functionalities that we get while using ACM.
At this stage, it would be suitable to mention that you can also explore other options like Redis caching, SQL Server databases to store the configurations and utilize their options and services in the applications. But the problem is that most of the benefits that Application Configuration Management provides are not available on those services, plus they are expensive to maintain and manage-Redis cache, for instance, works purely in memory thus requiring memory-intensive hardware to function properly.
Some other necessary elements such as security and roll back of the configurations are also made available as a built-in service in the Alibaba Cloud ACM, where in other solutions you might have to manage the availability of these services yourself. Alibaba Cloud Application Configuration Management is a complete Software-as-a-Service solution, that you can get started with by just a click-as you might have seen above. There are no difficult configurations or formalities necessary to deploy the service. You just need to provide the service and you are done; and this happens to be another benefit of the ACM.
ACM provides you an easy option to import and export your configuration files.
This enables the uniformity and synchronization among different configuration files which are hosted in different regions. Moreover, performing CRUD operations such as creating, editing, deleting, and replacing and fetching your settings from these configuration files becomes a lot easier.
You can add descriptive labels and tags to explain which setting is for what purpose. Also, you can use online editing tools for editing your file, which offers syntax highlighting for different ACM supported languages such as Java, Python, Shell, etc. which makes validation and visualization a lot handy, as you can see already posted in the image above.
With ACM, we get the support of different tools such as to monitor your files changes and to maintain the history for the changes you have made. Other than this, troubleshooting, backing up and one-click rollback of your settings to any previous version is also supported as one of the most highlighted features of ACM. For example, now if we update the configuration file to add more settings or configurations as needed, portal will show us all the changes that we are making like,
We can select to go ahead with the changes or make more changes as needed. Remember that this will apply the change to the overall configuration that we have created, and your applications might receive an update for this change or they will read these settings next time they try to fetch the settings. In cases where your settings are corrupt or are starting to cause problems in the overall solution, you can always check the history and rollback to a state where things were smooth.
Moreover, we get the support of some other advanced functionalities, for instance, when you must segregate different environments using namespaces such as for staging while following the DevOps principles or maintaining distributions in your microservices. You can create namespaces, and then create the configurations inside the namespaces-as you like.
Complexities increase depending upon your application size; for instance, to manage region-specific settings, ACM provides capacity and resource management. In cases such as disaster, threats, and data misuse, it provides cluster-level as well as centralized node quick recovery. You can manage all this using the namespaces to control a grouping between the configurations and manage them efficiently.
Moreover, in the peak business hours, ACM can push and fetch a massive amount of concurrent changes in a few seconds. These benefits allow you to work on the business logic, instead of having to maintain and manage a repository for the configurations.
Xi Ning Wang - August 23, 2018
Xi Ning Wang - August 21, 2018
Xi Ning Wang - August 17, 2018
Xi Ning Wang - August 30, 2018
Xi Ning Wang - August 21, 2018
Alibaba Clouder - September 23, 2019
Centralizes the management of application configurations and performs real time configuration push in a distributed environment.Learn More
Simplify the Operations and Management (O&M) of your computing resourcesLearn More
API Gateway provides you with high-performance and high-availability API hosting services to deploy and release your APIs on Alibaba Cloud products.Learn More
More Posts by Alibaba Clouder