fenilgmehta / CS695-Assignment-2

CS 695 - Assignment 2 - Autoscaler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CS695-Assignment-2

Solution Details and Results

  • Features:

    • Real time CPU utilization graph
    • Increase the number of server VM's in case of overload
    • Decrease the number of server VM's in case of low load
    • Inform the client program (which plays the role of load balancer) in case of VM failures
  • CPU utilization graph plotted in real time by the autoscaler

    • The part to the right of 0 on the x-axis is the deciding factor for the action taken by the autoscaler

    Working of autoscaler program

  • To run/test the program

    1. Create a VM in Virtual Machine Manager and put the server.py code in it.
    2. Configure the VM to autostart the server.py program as soon as the OS boots.
    3. Create multiple clones of the same VM and follow a proper naming convention. The numbering should start from 0
      • Example: AnyPrefix-0000, AnyPrefix-0001, AnyPrefix-0002
      • Write about this naming convention inside the client.conf file
    4. Launch the first VM - AnyPrefix-0000
    5. Open terminal and run client.py, client_communicator.py, auto_scaler.py
    6. Use client_communicator.py to configure the client.py at runtime. Supported functionalities:
      • Add server syntax = + <IP_ADDRESS> <PORT>
        • Here, IP Address and Port Number are of the server program.
      • Remove server syntax = - <IP_ADDRESS> <PORT>
        • Here, IP Address and Port Number are of the server program.
      • Remove all servers = clear_servers
      • Refresh the servers list = refresh
        • libvirt API is used for checking the list of online VM's and those VM's whose name prefix does not match with the one mentioned in the client.conf are removed from the list.
      • Change client's request/query generation speed:
        • low
        • mid
        • high
        • custom 0.3 <--- here, 0.3 can be replaced with any floating point value
    7. View the realtime graph plotted by the auto_scaler.py to get an insight into the working of the autoscaler

Standard things use in programming

  • All configuration files are stored in JSON format
  • server.py configuration is stored in server.conf
  • client.py configuration is stored in client.conf
    • This same file is used by auto_scaler.py as well because, the client.py in this assignment is equivalent to a load balancer in real life
    • client_communicator.py also uses the same configuration file
  • The client-server communication message configuration is stored in message.conf
  • big-endian format in used for numbers when converted to bytes
  • 4 bytes - unsigned int is used to represent client request integers
  • 8 bytes - unsigned long long is used to represent server response integers

Useful Commands

# virsh is the main interface for managing virsh guest domains.
virsh -V
virsh -c qemu:///system list   # connect locally as root to the daemon supervising QEMU and KVM domains
virsh -c qemu:///session list  # connect locally as a normal user to his own set of QEMU and KVM domains

# ---

# libvirt internals
cd /var/lib/libvirt
ls -l images
ls -l /etc/libvirt/libvirt.conf
cp /etc/libvirt/libvirt.conf ~/.config/libvirt/

# ---

# Network commands
virsh dumpxml ubuntu18.04
virsh net-list
virsh net-dhcp-leases default
virsh domifaddr ubuntu18.04-1
route

References

About

CS 695 - Assignment 2 - Autoscaler

License:GNU General Public License v3.0


Languages

Language:Python 100.0%