Python Driver Write Times

Daniel Lindsley daniel at pragmaticbadger.com
Sun Nov 28 13:27:21 EST 2010


You're using the HTTP interface, which is slower than the Protocal
Buffers interface. You should change your code from:

    riak_conn = RiakClient()
      bucket = riak_conn.bucket("peopledb")
      for i in range(1,1000000):
          try:
              new_obj = bucket.new("p" + str(i),MakePerson())
              new_obj.store(return_body=False)
          except Exception as e:
              print e

To:

    from riak import RiakPbcTransport

    riak_conn = RiakClient(port=8087, transport_class=riak.RiakPbcTransport)
      bucket = riak_conn.bucket("peopledb")
      for i in range(1,1000000):
          try:
              new_obj = bucket.new("p" + str(i),MakePerson())
              new_obj.store(return_body=False)
          except Exception as e:
              print e

In my testing, I saw a 200-300% speedup when switching to PB. As
previously suggested, you should also spin up two more Riak nodes
(making a cluster size of 3). See
https://wiki.basho.com/display/RIAK/Basic+Cluster+Setup, specifically
the "Add a Second Node to Your Cluster" section.


Daniel




More information about the riak-users mailing list