Integrate Traffic Distributor with Running Application
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 with 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.
Add Application Copy to Routing
For this example, we run 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 backends.
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 Entrypoint 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 distributor), we need to move the appropriate entrypoint to TD environment. In such a way, it will be placed in front of the chosen pair of backends 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:
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.
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 of 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 entrypoint 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 according to the set traffic ratio between application backends.