Friday, April 28, 2017

What is Fat Tree and how to construct it in 4-steps ?

Fat tree network topology looks like a tree topology like below example. In tree topology, we have same terminologies like Root, parent, child etc.  This is mainly used to connect a large number of physical servers/ computers in a large data center.
Fig-1. An example of tree network topology


It is recommended that reader should go through the basics of cloud computing and data center first.

In the tree structure topology, leaf nodes are physical servers or computers. Rest other nodes are switches.

Switches are basically 3 types: Core switches, Aggregation switches, and Edge switches.
Servers can be heterogeneous in terms of their configurations.

Fat tree topology is based on the complete binary tree. Below is an example of 3 layer Fat tree topology. The top layer (level-0) of switches is called Core layer. The second layer of switches is called Aggregation layer. And the third layer of switches is called Edge layer. The number of ports in each switch is same.

Fig-2. An example of 3 layer Fat tree topology.
Now let's construct a Fat tree network.
The information we need is the number of ports present in each switch. Let k be the number of ports that each switch contains. Switches with k number of ports in a Fat tree topology is called k-ary or k-port Fat tree network topology.
From the value of k, we’ll derive the number of core switches, aggregation switches, edge switches and the maximum number of servers that can be attached.
A set of (k/2) number of aggregation switches and (k/2) number of edge switches are combined together and that is known as a Pod.

Example - 1:

Let k=4, i.e. each switch has 4 ports.

Step-1:                                          
    Number of core switches is (k/2)^2 = 4 core switches.  If the value of k=8, we need (8/2)^2=16 core switches.
    Number of pods = k = 4.
Fig-3. Step-1 of Fat tree construction

Step-2:                                          
    Each pod consists of (k/2)=(4/2)=2 aggregation switches and (k/2)=(4/2)=2 edge switches.
    The switches are organized in layer wise. First layer is aggregation layer. Second layer is edge layer.
Fig-4. Step-2 of Fat tree construction


Step-3:                                          
    Each aggregation switch within a pod is connected to (k/2)=(4/2)=2 core switches and (k/2)=(4/2)=2 edge switches.
Fig-5. Step-3 of Fat tree construction

Step-4:                                          
    Each edge switch within a pod is connected to (k/2)=(4/2)=2 servers and (k/2)=(4/2)=2 aggregation switches. That means each pod will be connected to (k/2)^2=(4/2)^2=4 servers.
    Hence the maximum number of servers that can be connected to the network is (k^3)/4=16 servers.
Fig-6. Step-4 of Fat tree construction





Example - 2:

If the value of k=8, each switch has 8-ports.
Step-1:                                           
    Number of core switches is (k/2)^2 = 16 core switches.
    Number of pods = k = 8.

Step-2:                                           
    Each pod consists of (k/2)=(8/2)=4 aggregation switches and (k/2)=(8/2)=4 edge switches.
    The switches are organized in layer wise. First layer is aggregation layer. Second layer is edge layer.
  
Step-3:                                          
    Each aggregation switch within a pod is connected to (k/2)=(8/2)=4 core switches and (k/2)=(8/2)=2 edge switches.

Step-4:                                          
    Each edge switch within a pod is connected to (k/2)=(8/2)=4 servers and (k/2)=(8/2)=4 aggregation switches. That means each pod will be connected to (k/2)^2=(8/2)^2=16 servers.
    Hence the maximum number of servers that can be connected to the network is (k^3)/4=128 servers.


Thats all for now.
Please comment if you need more information.



-Thank you

Tuesday, April 11, 2017

Creating and customizing 3D graph in MATLAB.

Unlike 2D figure, 3 variables are involved in a 3D figure. Below is an example of 3D mesh graph. For certain value of X and Y, we plot the value of Z.
Example :
        Z = (X  /  (c*Y))
3D figure can be bar, mess, surf etc...

Let's begin drawing the graph for the equation
        Z = (X  /  (c*Y))

Step-1: Prepare the data

X = [0.1000    0.1889    0.2778    0.3667    0.4556    0.5444    0.6333    0.7222    0.8111    0.9000]
Y = [-0.1000   -0.1889   -0.2778   -0.3667   -0.4556   -0.5444   -0.6333   -0.7222   -0.8111   -0.9000]
c = 0.05

Here I have used the following Matlab code to generate the data for X and Y.
X = linspace(0.1,0.9,10)
Y = linspace(-0.1,-0.9,10)

for X, 0.1 is the initial value, 0.9 is the final value, and 10 is the number of values to be generated between initial and final value. Similarly for Y also. 


Now In order to generate the data for 3D surf convert X and Y data to a meshgrid.
Step-2: 
           [mx, my] = meshgrid(X, Y);

Step-3: Generate data for Z-axis
           Z = mx ./ (c.*my);

Step-4: Get ready to plot the data onto a 3D figure.

Enter the following code


figure1 = figure();

% Create axes
axes1 = axes('Parent',figure1);
hold(axes1,'on');
% Create xlabel
xlabel('X-axis Label');

% Create ylabel
ylabel('Y-axis Label');

% Create zlabel
zlabel('Z-axis Label');

view(axes1,[152.1 22]);


% Create surf
surf(ax,ay,Z,'Parent',axes1);

grid(axes1,'on');

% Set the remaining axes properties
set(axes1,'FontName','Times New Roman','FontSize',14,'FontWeight','bold',...
    'XTick',[0.1 0.3 0.5 0.7 0.9],'XTickLabel',...
    {'0.1','0.3','0.5','0.7','0.9'});

Final Step:
The entire Matlab file will look like this

X=linspace(0.1,0.9,10);
Y=linspace(-0.1,-0.9,10);
c=0.05;

[ax, ay] = meshgrid(X,Y);
Z = ax ./(c.*ay);

figure1 = figure();

% Create axes
axes1 = axes('Parent',figure1);
hold(axes1,'on');
% Create xlabel
xlabel('X-axis Label');

% Create ylabel
ylabel('Y-axis Label');

% Create zlabel
zlabel('Z-axis Label');

view(axes1,[152.1 22]);


% Create surf
surf(ax,ay,Z,'Parent',axes1);

grid(axes1,'on');

% Set the remaining axes properties
set(axes1,'FontName','Times New Roman','FontSize',14,'FontWeight','bold',...
    'XTick',[0.1 0.3 0.5 0.7 0.9],'XTickLabel',...
    {'0.1','0.3','0.5','0.7','0.9'});


Bonus tips: Customizing the axis label with text() and annotation().

Disable xlabel(), ylabel(), and zlabel() if you are going for text() or annotation() command.

text() example:
% After running this .m file edit the position of each text box
   ty=text(0.5,0.5,'Y-axis label','Rotation',-28,'FontSize',20,...
    'FontWeight','bold','FontName','Times New Roman');

annotation() example:

  annotation(figure1,'textbox',...
     [0.528242677824266 0.789163935354498 0.0753138055985942 0.0475409826782883],...
     'String',{'? = 0.5'},...
     'FontWeight','bold',...
     'FontSize',12,...
     'FontName','Times New Roman',...
     'EdgeColor',[0.24705882370472 0.24705882370472 0.24705882370472],...
     'BackgroundColor',[1 1 1]);

Thats all for now. 
Please comment if more customization function you need.


Thank you