18

I was wondering if anyone had ever implemented multiple Django webservers pointing to a single database, essentially functioning as a single website via load balancing?

What software did you use for load balancing?

What additional setup/configuration did your Django webservers require?

Did you need to modify your Django code in any way?

bouteillebleu
  • 2,456
  • 23
  • 32
theycallmemorty
  • 12,515
  • 14
  • 51
  • 71

1 Answers1

9

On an Amazon EC2 setup, I found AWS's Elastic Load Balancer to be pretty cool (apart from only supporting a single IP address per ELB instance).

The front-end Django boxes just needed their database settings altering to point to a separate database (ie, given the database box's IP, which was an internal IP in terms of our EC2 ecosystem) and, once the database box was made to listen on that IP and the appropriate port, we were ready to rock.

Steve Jalim
  • 11,989
  • 1
  • 37
  • 54
  • 2
    How do you store session data? – theycallmemorty Sep 02 '10 at 13:26
  • 6
    database-backed sessions, rather than machine-specific ones, so it doesn't matter which frontend box gets the request – Steve Jalim Sep 02 '10 at 16:27
  • 3
    Have you used memcached? If so, where was it lcoated? on Django servers or on DB machine? – mhl666 Jun 22 '11 at 14:49
  • 6
    I've had memcached using some of the memory of the DB machine, but if you set up memcached 'right' you can use a network of memcached instances across any/all of your boxes -- see the second example at https://docs.djangoproject.com/en/dev/topics/cache/#memcached – Steve Jalim Jun 22 '11 at 20:59
  • 1
    Session data can be stored in dynamodb if you are on aws https://github.com/gtaylor/django-dynamodb-sessions – nu everest Dec 05 '16 at 16:51