Load Balancer Function

Introduction

LoadBalancer can spin up new hidden service replicas and direct client requests to (or away from) replicas to distrib- ute load and improve performance. LoadBalancer receives periodic messages from replicas describing their load, and uses high- and low-watermark thresholds for determining when to create or remove a replica. Replica creation is transparent to clients: there is but one In- troduction Point (that the LoadBalancer establishes), and, naturally, the clients never learn the identities of the hid- den service nodes. To ensure that replica teardown is also transparent, we do not terminate any replicas that have on- going connections. Our current selection process randomly chooses a replica from all active middlebox nodes, but this could be more sophisticated, taking into consideration prop- erties like geography, latency, etc. With Bento’s design, such a change involves only a few lines of code. In order to create a replica, all files (including the host- name and private key) are copied to the new instance. This motivates deploying LoadBalancer within conclaves.

Setup Replicas

  • Setup the replicas for the Load Balancer: All the replicas should host the same onion service. This can be achieved this by letting the replicas share the same private key. Start by choosing a desired number of replicas for your Onion Service and also selecting a platform for them. For instance, you can use Amazon AWS to spin up your replicas. Next, install Tor and create your Onion Service on any one of the replicas. Now copy the same private key, hostname and torrc of your Onion Service, to the other replicas (after installing Tor on them as well).
  • Navigate to the directory /bento/experiments/LoadBalancer in the Github source code.
  • mkdir bento
    cd bento
    nano run_tor.py (paste run_tor.py code from the directory)
    nano replica.py (paste replica.py code from the directory)
    cp /usr/local/var/lib/tor/hidden_service/hs_ed25519_secret_key /bento (copy the Onion Service private key)
    cp /usr/local/var/lib/tor/hidden_service/hs_ed25519_secret_key /bento (copy the Onion Service hostname)

Run Load Balancer with Bento

  • Connect to the Bento Server and Store/Execute your function. Specify the number of replicas and number of connections desired per replica in the function. Code in /bento/experiments/LoadBalancer/load_balancer.func
  • python3 driver.py [IP of bento server] [port of bento server]
  • Connect all replicas to the LoadBalancer.
  • python3 replica.py [IP of loadbalancer]
  • You are all set!
  • Refer to the ReadMe.md to run experiments.
Download the source code from Github
Checkout the Bento Poster!