Optional learning is still learning – memcache

by Security Dude

http://www.udacity.com/wiki/CS253

http://www.youtube.com/watch?v=7vaamtu0Whc

https://www.facebook.com/note.php?note_id=39391378919

Round Robin

In [1]: n = -1
In [2]: servers = ['s1','s2','s3','s4','s5']
In [3]: def get_server():
            global n
            n += 1
            return servers[n% len(servers)]
In [4]: for i in range (100):
            # round robin request 100 times
            print get_server()

s1
s2
s3
s4
s5
Advertisements