In most cases, developers face the problem of traffic distribution between several backends when already having some running application, with a pool of existing users and constant incoming load. Thus, beside of the general traffic sharing configuration difficulties, it is additionally complicated by the necessity to apply the appropriate “on-fly” changes to the front-end application instance. In many cases, it causes a temporary app downtime. So in order to minimize such negative influence on your customers, below we’ll consider the ways to easily and painlessly integrate Jelastic Traffic Distributor (TD) solution into your running application topology.
In case you want to install Traffic Distributor manually for the newly created environments, please use the detailed walkthrough.
And to make this add-on available for already running applications follow the instructions below.
Add Application Copy to Routing
For this example, we run an application in Apache server within the primary-env environment.
1. First of all, you need to set up one more environment with the same application inside (we’ll name it second-env).
2. Now we are ready to install Traffic Distributor, specifying both these environments as endpoints.
3. That’s it! Traffic Distributor is already set and ready to handle requests to our application.
The only thing that remained to do is to redirect incoming traffic from the first environment to Traffic Distributor.
Configure App Entry Point via TD
If being run in production, most likely your application has some custom domain name already bound to our initial environment (primary-env in our case).
For the proper redirection of requests (i.e. to process them through the distributor), we need to move the appropriate entry point to TD environment. In such a way, it will be placed in front of the chosen pair of endpoints and share the incoming load among them based on specified settings.
In order to accomplish this, follow one of the next simple procedures based on the used custom domain binding method:
- if using CNAME redirect - swap domains among the initial and TD environments
- if using A Record - swap Public IPs to transfer used external IP to the TD environment
1. Hover over the environment your custom domain is bound to (e.g. primary-env) and select Settings from the set of appeared functional icons.
2. Within the opened environment settings tab, the required Custom domains section will be displayed by default, so just select your Traffic Distributor environment within drop-down list of the Swap domains suboption.
Now, click the Swap button and confirm this action within the appeared pop-up to apply the changes.
3. In a minute your application custom domain name will be moved to the environment with Traffic Distributor so that both of your backends will become available via this domain.
Swap Public IPs
The easiest way to pass Public IP from primary-env (i.e. the one your custom domain is attached to) to Traffic Distributor is using the corresponding External Addresses Swap functionality, available through Jelastic CLI.
It allows to perform the required configurations in a single command, sparing you from the manual A Record reconfiguration.
However, if you prefer to work via GUI, this operation can also be accomplished with a manual change of Public IP address your domain points to. For that:
1. Ensure that NGINX balancer instance in your Traffic Distributor environment has external IP address attached and get its value through the dashboard.
2. Then, re-configure your A record via DNS manager, so that it leads to this new IP address.
3. After the application entry point address is changed, you can detach Public IP from the initial primary-env (if it is no more required for direct access) and do not pay for the unused option.
That’s it! Now all incoming traffic for your custom domain will be processed by Jelastic Traffic Distributor solution, which, in its turn, will route it accordingly to the set traffic ratio between application endpoints. Test drive it on your own at one of Jelastic hosting partners.