Azure Traffic Manager | Overview of Azure Traffic Manager


Azure Traffic Manager – Table of Content

What is Azure Traffic Manager?

Azure Traffic Manager distributes traffic to services across the Azure regions. It is a DNS-based traffic load balancer that provides responsiveness and high availability of the services. The Traffic Manager considers the health of all the endpoints and uses DNS to route client requests to a service endpoint based on a traffic-routing method.

A service endpoint might be an application hosted on Azure or an internet-facing application outside of Azure. To suit the needs of different applications, the Azure Traffic Manager offers several endpoint monitoring options and traffic routing methods. It balances the traffic load on services according to set policies. 

Features of Traffic Manager

Here are the features that the Traffic Manager offers.

  • The Traffic Manager continuously monitors endpoints. If, in any case, an endpoint goes down, then it provides automatic failover, which results in increased application availability.
  • The services hosted on Azure run in data centres located around the world. The traffic manager routes traffic to the endpoint with the lowest latency. This improves application responsiveness.
  • If you plan for service maintenance of your applications, then the traffic at the time of service maintenance will be routed to the next best locations, which are alternative endpoints. So, users can perform operations without downtime.
  • The Traffic Manager also supports non-Azure endpoints, which might be on-premise or on hybrid cloud scenarios. These scenarios include burst-to-cloud, migrate-to-cloud, and failover-to-cloud scenarios.
  • It provides various traffic routing methods. We can combine the routing methods to create a nested Traffic Manager profile for more complex deployments.
  • Based on user traffic volumes and patterns, it provides actionable insights. You can get a view of where the users are interacting with the application and the quality of their digital experience.
  • It adheres to the applications of data sovereignty regulations by using geographic fencing.

How does Traffic Manager work?

The key benefits of the Traffic Manager are,

  • The traffic distribution is based on one of the traffic-routing methods provided by Azure.
  • It continuously monitors the health of the endpoints and implements automatic failover.

A client connects to a service using a DNS name. The Traffic Manager will first resolve the DNS name of the service to the IP address. The client is then connected to the IP address of the service to access it. The Traffic Manager works at the DNS level, where it routes traffic to a specific endpoint based on a selected traffic routing method. It is neither a proxy nor a gateway. Clients will directly connect to the selected endpoint. The Traffic Manager will not see the data passing between the client and the service.

Become a Microsoft Azure Certified professional by learning Microsoft Azure certification course from hkrtrainings! 

How does a client connect to the Traffic Manager?

When a client wants to connect to a service, a DNS query will be sent to the configured recursive DNS service. A recursive DNS service, which is also known as local DNS, does not host the domains directly. It rather encompasses the process of contacting authoritative DNS services to resolve the DNS name. The recursive DNS finds the name server across the internet for the domain in the DNS query sent by the client.

It then contacts the name server to request the DNS record. It then returns the record that points to the traffic manager of the server. The DNS then sends a request for the traffic manager. Upon receiving the request, the traffic manager chooses an endpoint. The chosen endpoint is sent back as a DNS name record. The recursive DNS service finds the domain name server. The IP address of the service endpoint will be returned. The recursive DSN consolidates and gives a single DNS response. The client then connects to the IP address. 

Microsoft Azure Certification Training

  • Master Your Craft
  • Lifetime LMS & Faculty Access
  • 24/7 online expert support
  • Real-world & Project Based Learning

Routing methods in Traffic Manager

To route traffic to different endpoints, Azure Traffic Manager supports six types of traffic-routing methods. The routing method specifies which endpoint is returned through DNS.

  • Priority – When you want to send primary service endpoints for all traffic, you can use the priority method. It provides backup if the primary endpoint is unavailable.
  • Weighted – When you want to distribute traffic across endpoints based on some pre-defined weights or evenly, use the weighted method.
  • Performance – When you want the users to interact with the lowest latency endpoint, then you can use the performance method. In this scenario, the endpoints are located in different geographic locations.
  • Geographic – When you want to route users to a specific endpoint based on the geographic location of the user, use the geographic methods. It employs data sovereignty based on different regions.
  • Multivalue – You can use multivalue when you only have IPv4/IPv6 addresses as endpoints. When a query is received, all the healthy endpoints are returned.
  • Subnet – If you want to map a set of user IP addresses to a specific endpoint, use the subnet method. When a request is received, the endpoint mapped to the source IP address will be returned.

Endpoints in Traffic Manager

An endpoint is referred to as application deployment. When the Traffic Manager receives a DNS request, it checks for all the endpoints and chooses an available one, and returns it as a DNS response. Traffic Manager supports the below 3 types of endpoints.

  • Azure endpoints – These are the services hosted in the Azure cloud.
  • External endpoints – These are the services hosted outside of the Azure cloud like on-premise or a different hosting cloud. These are used for IPv4/IPv6 addresses.
  • Nested endpoints – When you want to create more flexible routing schemes, you can use nested endpoints to combine Traffic Manager profiles for complex deployments. A single Traffic Manager profile can have any type of endpoints in it.
HKR Trainings Logo

Subscribe to our YouTube channel to get new updates..!

Creating a Traffic Manager for an application

Let us create a Traffic Manager profile that provides high availability for your application. Navigate to https://portal.azure.com/ and log in to your Azure account. You have to deploy your web application in two different Azure regions. So, one will act as a primary endpoint and the other acts as a failover endpoint.

Learn more about AWS vs Azure from this Article Difference between Azure and AWS!

Deploy the web application

Click on the ‘Create a resource’ button on the top-left corner. Click on ‘Web’ and click on ‘Web App’. You will get a Basics tab where you can fill in the web application details. Create a resource group and give a name for it. Give a name for your web application. Select ‘Code’ for the ‘Publish’ field. Give ‘ASP.NET V4.7’ for ‘Runtime stack’, select Windows for ‘Operating System’, select ‘East US’ for the ‘Region’ field. Create a new service plan and give a name for it. Select ‘Standard S1’ for the ‘SKU and size’ field.

Go to the Monitoring tab, select no for the ‘Enable application insight’s option. Click on ‘Review and create’. You will get a review page where you can view all the settings. Click on ‘Create’ to create a website. Follow the same steps to deploy the web application in a different Azure region.

Creating a Traffic Manager profile

Click on ‘Create a resource on the top-left corner. Click on ‘Networking’ and then click on the ‘Traffic Manager profile’. Click on ‘Create Traffic Manager profile’ and a settings page appear. Give a name for the Traffic Manager profile, Select ‘Priority’ for the ‘Routing method’ field, select a subscription method, select your existing resource group, and give the location of the resource group for the ‘Location’ field. Click on ‘Create’ to complete the process.

Add endpoints to Traffic Manager

Give the Traffic Manager profile name in the search bar and select your profile from the results. Click on ‘Settings’ in the Traffic Manager profile. Click on ‘Endpoints’ and then click on ‘Add’. Select ‘Azure endpoint’ for the ‘Type’ field. For the ‘Name’ field, enter the endpoint that you want to set as the primary one. Select ‘App Service’ for ‘Target resource type’, select ‘Choose an app service > East US’ for ‘Target resource’, choose 1 for ‘Priority’ field, and click on ‘OK’. Repeat the same steps for the other endpoint and set the priority as 2.

Testing the Traffic Manager profile

You can find the DNS name of your web application in the overview of your Traffic Manager profile. Enter the DNS name in a browser, and you will get the default website of your web application. Now, disable your primary site in the Traffic Manager profile. Select your primary endpoint in the overview section. Click on ‘Disabled’, and then click on ‘Save’. You can observe the status as disabled when you close the primary endpoint. Check the same DNS name in a different browser, you can see that your web application is still available. You are routed to the failover endpoint.

Microsoft Azure Certification Training

Weekday / Weekend Batches

Conclusion

Now that you know how to create a Traffic Manager profile, deploy your web application, create multiple endpoints, and try setting up a Traffic Manager profile. It widely improves website response. To reference an Azure Traffic Manager profile, you can also create an alias record name. You can create a Traffic Manager profile through the Azure portal, Azure CLI, and Azure PowerShell. It follows a pay per use pricing plan.

Other related articles:



Source link

Leave a Reply

Subscribe to Our Newsletter

Get our latest articles delivered straight to your inbox. No spam, we promise.

Recent Reviews


Python Variables – Table of Content

Python Variable 

A name that is used to refer to the memory location in a programming language is called a variable. Python Variables are also termed storage containers in other words. Variables in python are ‘statically typed’ meaning a user does not need to create variables while coding. The variables get declared themselves whenever a value is assigned to them. There are 4 main types of variables: integer, long integer, string, and float. Hence, we cannot have any type of command which can create a variable.

The main use of variables in python is to store values as a reserved memory container. In this article, we will understand what variables actually are, how identifier naming is done while working with the variables, declaration of a variable in python, identifying objects using variables, different types of variable names and their types such as local variable, global variable, object reference and how to finally delete a variable once created.

Become a Python Certified professional by learning this HKR Python Training!

Identifier Naming

Variables in python are just an example of an identifier that will recognize the literals which are being used in the program. They work according to a set of rules which are mentioned below:

  • The name of an identifier is always case-sensitive. For example, ‘WelcomeToHKR’ and ‘WelcometoHKR’ are not the same.
  • The identifier’s initial character should either be an alphabet or an underscore(_)
  • The alphabet following the initial alphabet
  • The identifiers cannot have special characters in them including white spaces.
  • The name of the identifier need not be the same as the keyword defined in the programming language.
  • Some examples to correct identifiers are: x301, _x, x_0, etc.
  • Some examples of incorrect identifiers are 2y, 1%r, =34, etc.

Declaring a Variable in Python

As we have discussed, there is no need to create a variable unless there needs to be a value assigned to it. One more thing which is very important to note is that variables need not be declared in a specific type. The type of variable can even be changed after the user declares them. We use the equals (=) operator to assign a value to the variable.

Let us take an example of python code below to understand how we can declare variables in python:

a = 10

b = "HKR"

print(a)

print(b)

Output:

10

HKR

The user can also re-declare the variable after creating it. Check out the python code below:

Number = 10

print("Before declaring the variable: ", Number)

Number = 12

 
print("After re-declaring the variable:", Number)

Output:

Before declaring the variable:  10

After re-declaring the variable: 12

Object Identification Using Variables

Every variable created in python is unique. It is not possible to have two same variables for 2 different objects. There is a built-in function in python id() which identifies the id of the variable meaning whether it’s defined already or it’s new.

Let us take an example of python code below and understand how object identification is done in Python using variables:

x = 10 

y = x  

print(id(x))  

print(id(y))  

x = 50  

print(id(x))

Output:

9756512

9756512

9757792

Here in the code above, the user has assigned y = x, where both x and y are pointing to the same object. With the use of id() function, it will also return the same number.

Hence, we will re-assign x to 50; then it is termed as a new object identifier and will have a new changed output.

Variable Names

We have already discussed how variables work with programming languages and how we can declare them along with assigning value to them. The names of variables may be of any length having a lowercase (a to z), an uppercase (A to Z), any digits from 0 to 9, or an underscore (_).

Let us take an example below and see how variable names can work in python.

Name = "Y" 

name = "X"  

naMe = "Z"  

NAME = "M"  

n_a_m_e = "L"  

_name = "N"  

n_a_m_e = "L"

name_ = "O"  

_name_ = "P"  

na56me = "R"  

  

print(Name,name,naMe,NAME,n_a_m_e, NAME, _name, n_a_m_e, name_,_name, na56me)  

Output:

Y X Z M L M N L O N R

As we can see in the example above, the user has declared some valid variable names such as naMe, _name, etc. But this procedure might create confusion when one reads the code so therefore this is not mostly recommended. The user should try making the variable name a little descriptive hence making the code more readable.

The multi-keywords can be created as:

Pascal Case – In this, the first word is capitalized along with the word or abbreviation in the middle of the word. For example: WelcomeToHKR, HowAreYou, etc.

Snake Case – The words are separated using underscore(_) in the snake case. For example Welcome_To_HKR, How_Are_You, etc.

Camel Case – Mostly like the pascal case, each word in the middle will begin with a capital letter. For example: welcomeToHKR, howAreYou, etc.

Acquire Apache NIFI certification by enrolling in the HKR Apache NIFI Training program in Hyderabad!

Python Training Certification

  • Master Your Craft
  • Lifetime LMS & Faculty Access
  • 24/7 online expert support
  • Real-world & Project Based Learning

Python Variable Types

There are two types of variables in python: Local variable and Global variable.

Let us understand more about these and understand them in depth.

1. Local Variables: These types of variables are always defined inside the function. Their scope is also limited to the function only. Check out the example below of how we can make use of local variables in a python code:

def add():  

    x = 10  

    y = 20  

    z = x + y  

    print("The sum of numbers is:", z)  

add()

Output:

The sum of numbers is: 30

As we can clearly see in the code above, the user declared a function as add() to assign it to variables within the function. The variables will be called local variables as they will have scope inside the function only. If the user tries to declare them outside of the function, he will get a code error called NameError: name ‘x’ is not defined

2. Global Variables: These types of variables can be used both inside as well as outside the function. Their scope lies in the complete program. In case it is not mentioned in the code, the global variables are by default declared outside the function. In case the user forgets to mention the variable type, it will be local by default. Check out the example below of how we can make use of global variables in a python code:

a = 10  

  

def mainFunction():  

    global a  

    print(a)  

    a="Welcome To HKR Training"  

    print(a)    

mainFunction()  

print(a) 

Output:

10

Welcome To HKR Training

Welcome To HKR Training

As we can see in the code above, the user has declared a global variable a and a value is assigned to it. Then the user defines a function and it accesses the pre-declared variable inside the function by making use of the global keyword.

Variable type in Python

The data types in a programming language basically states the operations that are to be performed on the given data.  As we know that python works for objects in the programming, variables work as the objects only for the data types.

Here is a list of few data types that work with python variables:

  • Numeric
  • Sequence
  • Boolean
  • Set
  • Dictionary

assigned to different values.

Let us consider an example below and see how we can use various data types with variables:

var1 = 12345

print("Numeric data is : ", var1)

String = 'Welcome to HKR'

print("Topic is Python Variables")

print(String)

print(type(True))

print(type(False))

set = set("HKR Trainings")

print("\nSet with the use of String: ")

print(set)  

Dict1 = {1: 'HKR', 2: 'Welcomes', 3: 'You'}

print("\nDictionary with the use of Integer Keys: ")

print(Dict1)

 

Output:

Numeric data is :  12345

Topic is Python Variables

Welcome to HKR

<class 'bool'>

<class 'bool'>

Set with the use of String: 

{'g', 'a', 'r', 'R', 'i', 'n', 'T', ' ', 's', 'X', 'H'}

Dictionary with the use of Integer Keys: 

{1: 'HKR', 2: 'Welcomes', 3: 'You'}

Top 30 frequently asked Python Interview Questions!

HKR Trainings Logo

Subscribe to our YouTube channel to get new updates..!

Object Reference

a=10

b=a

If we take the example above, we understand that the code creates an object to represent the value 10. Then, it is creating the variable in case it does not exist. It is made as a reference to this new object having a value of 10. In the second line, there is a creation of another variable b however it isn’t assigned with a but is made in reference to that object that an actually does.

Multiple Assignment

In python, a user is allowed to assign a single value to multiple variables. The user can perform multiple assignments in two different ways. It is done either by assigning one value to different variables or can also be done by having different variables assigned to different values.

Let us see an example below of how we can assign single value to multiple variables:

a=b=c=10    

print(a)    

print(b)    

print(c)

Output:

10

10

10

Now let us see another example of how we can assign multiple values to multiple variables:

a, b, c = 10, 20, "WelcomeToHKR"

print(a)

print(b)

print(c)

Output:

10

20

WelcomeToHKR

As the variables appear, the values will be assigned in the same manner only.

Deleting a Variable

A variable can be deleted using the ‘del’ keyword.  

Let us see an example of how we can delete a variable using python:

a = 10  

print(a)  

del a  

print(a)

Output:

Traceback (most recent call last):

  File "./prog.py", line 4, in

NameError: name 'a' is not defined

Python Training Certification

Weekday / Weekend Batches

Conclusion

Through this article, we have understood what a variable is, how we can declare a variable inside a function and how we can assign a value to the variable. The article will help you clear all your doubts about python variables along with the basic rules that variables come up with.

Related Articles

  1. Python Ogre



Source link