Multai Load Balancer and Packet Tutorial

Learn how to create a new MLB deployment on Packet.net bare metal hosting

Aharon Twizer
Spotinst, Co-Founder and CTO

We recently announced the launch of our new service our new Multai Load Balancer service. Our new load balancer supports multi-cloud deployments and with this tutorial we will show you how to deploy and load balance your applications on the Packet.net bare metal cloud service. We’ll first create a new MLB deployment, install the runtime on the MLB nodes, then create a new load balancer in the MLB console and load balance our test application. Let’s get started!

  1. Log into the MLB console and browse to “Projects” from the menu bar and click “Create”. Add name and description as you can see below.
  2. Click on “</>” (API Keys) on the menu bar. Click on the “Generate” button to generate a new API key. Enter a descriptive name for this key then click “Generate”
  3. Click on “Deployments” on the left menu and then click on the “Create” button. Add a descriptive name for your deployment like “PACKET_EWR” (Cloud Provider _ Region) then click “Create”.
    The API key will be displayed on the screen. Please copy this key and keep it somewhere safe. This key will not be available to you again from the console.
  4. Click on the name of the deployment you just created.
  5. Click on “Add New Host” and a new text box will appear with the install script for the MLB node runtime. Copy this script and place it into a text editor. Replace the <TOKEN> string with the token string that was generated in step 3. above. The finished script should look similar to what you see below.
    MLB Runtime install script
  6. Open your Packet.net console and click on “Deploy” to launch a new server. Choose your project, select “servers” and click “Proceed”.
    Packet Deploy server
  7. Enter a descriptive hostname, select your type, os (Centos 7 is recommended), and location. We do recommend launching more than one server for the best availability.
    MLB Packet Deploy Server
  8. Click on “Manage” and then add the userdata script from step 5 above then click “Save & Continue”.
    MLB Packet Userdata mlb runtime
  9. Once the new MLB Runtime Nodes are launched they will appear under the deployment that you created in step 3 above. The nodes should appear as “Healthy”, the “Leader” node will be in charge of performing the health check of your target endpoints.
  10. Now that we have our MLB Runtime nodes up and running we can create a new Balancer. On the left menu click on “Balancers” then click “Create”.
  11. Enter a descriptive name for your Balancer.
  12. Set the “Draining Timeout” section as you see fit or leave it at the default as you can see below. Idle duration is the number of seconds to elapse before a connection is closed by the MLB.
  13. Enter the Listener ports that will be used for your application. In my case I have a simple Apache test site on port 80. You can have multiple virtual hosts with Apache on different ports per Apache server so enter all in use here. Press the “+ Add Listener” button to add them to the list.
  14. You can add advanced routing rules for your application servers. In my case I have just one site running on port 80. You can configure multiple sites here (shown below) or configure Header based routing by entering a Header Key and Header Value
  15. A Target Set is a logical group of targets that share the same routing rule. In our case we are creating a set of http endpoints on port 80 to the root of the server “/”. Select the deployment that you created in step 3 above.
  16. Next, add add the target name, address, port and weight as you can see below. You can add additional targets by clicking the “+ Add Target” button.
    You can set the “Weight” for the target here. For example if you added a new target with a weight of 2 it would have double the connections than a Target with a weight of 1. You can use this setting if you have servers with different performance specs like additional CPU cores or Memory.
  17. Now we can configure the “Health Check” for our MLB. In my case I am using the default port 80 and the same path as the application “index.html”. You can change the default health check intervals and timeout settings here as well. According to the settings below a health check will occur every 10 seconds and will wait up to 5 seconds for a timeout. Targets will be marked as “Healthy” after 2 consecutive passing health checks and “Unhealthy” after failing 3 consecutive health checks.
  18. Lastly we can click the “Create Load Balancer” button at the bottom of the page to create the Load Balancer.
  19. You will now see your new Balancer from the Balancer list. Notice that a new DNS record was created specifically for your Balancer. Click on the name of your Balancer.9_9-01
  20. You will see the Target Sets that you created back in step 14. Click on the name of your Target Set.
  21. You will see the status of the targets that you created in step 15 above. If the targets are not reporting as “Healthy” make sure that you have access rules allowing connectivity from your MLB Runtime Nodes to your Target servers. Test by connecting the lead Runtime server and connect to the Apache server using curl. If you are not receiving an http 200 response then you may need to change security rules or the configuration of your web server. If you need to perform maintenance on your servers you can temporarily remove them from the balancer by changing the “Readiness” from “Ready” to “Maintenance”. Switch the target back to healthy when finished.
  22. Now that we have verified the Targets are healthy go back to the “Balancers” page. Open the DNS name that was created as shown in step 17 above. You should now be able to access your newly MLB balanced application from the DNS record. Once you have verified everything is working you can create a cname in your own DNS management.


Aharon Twizer
Spotinst, Co-Founder and CTO

Stay current

Sign up for our newsletter, and we'll send you the latest updates on Spotinst, tips, tutorials and more cool stuff!