예제 #1
0
        key_hash = hash(key_str)
        if cmd == 'set':
            hash_upsert(key_str, key_hash, self.bins, self.nbins)
        elif cmd == 'delete':
            hash_delete(key_str, key_hash, self.bins, self.nbins)


if __name__ == "__main__":
    # usage: mcsoda_sim_micro_lru sim-micro-lru

    argv = (' '.join(sys.argv) +
            ' doc-gen=0 doc-cache=0 exit-after-creates=1').split(' ')

    store = StoreSimMicroLRU()

    mcsoda.main(argv, protocol="sim-micro-lru", stores=[store])

    tot = 0
    max_bin_length = 0
    for bin in store.bins.values():
        n = bin_length(bin)
        if max_bin_length < n:
            max_bin_length = n
        tot += n
        print bin
        # print(n)

    print(max_bin_length)
    print(tot)

    print('done')
예제 #2
0
            m.append(prefix + message + suffix)

            return 0, 0, 0, 0, 1

        return mcsoda.StoreMembaseBinary.cmd_append(self, cmd, key_num, key_str,
                                                    data, expiration, grp)


if __name__ == "__main__":
    extra_examples=["          %s couchbase://127.0.0.1:8092 ratio-queries=0.2",
                    "          %s couchbase://127.0.0.1:8092 ratio-queries=0.2 \\",
                    "               queries=/default/_design/DDOC/_view/by_email?startkey={email}",
                    "",
                    "Available keys for queries templates:",
                    "    key, name, email, city, country, realm, coins, category,",
                    "    cmds (the number of commands sent so far),",
                    "    int10, int100, int1000 (various sized integers)"
                    ]

    if len(sys.argv) >= 2 and \
       (sys.argv[1].find("couchbase") == 0 or \
        sys.argv[1].find("cb") == 0):
        mcsoda.main(sys.argv,
                    protocol="couchbase",
                    stores=[StoreCouchbase()],
                    extra_examples=extra_examples)
    else:
        mcsoda.main(sys.argv,
                    extra_examples=extra_examples)
예제 #3
0
        d = copy.deepcopy(d)
        d['body'] = self.cfg['body'][min_value_size]
        return d

    def command(self, c):
        cmd, key_num, key_str, data, expiration = c
        cmd_start = time.time()
        if cmd[0] == 'g' or cmd[0] == 'q':
            self.coll.find_one(key_str)
        elif cmd[0] == 's':
            self.coll.save(data)
        elif cmd[0] == 'd':
            self.coll.remove(key_str)
        else:
            raise Exception("StoreMongo saw an unsupported cmd: " + cmd)
        cmd_end = time.time()

        histo = self.add_timing_sample(cmd, cmd_end - cmd_start)
        if self.sc:
            p = self.histo_percentile(histo, [0.90, 0.95, 0.99])
            self.sc.latency_stats(cmd, p)


if __name__ == "__main__":
    if sys.argv[1].find("mongo") != 0:
        raise Exception("usage: mcsoda_mongo mongo://HOST:27017 ...")

    argv = (' '.join(sys.argv) + ' doc-gen=0').split(' ')

    mcsoda.main(argv, protocol="mongo", stores=[StoreMongo()])
예제 #4
0
        if cmd == 'set':
            hash_upsert(key_str, key_hash, self.bins, self.nbins)
        elif cmd == 'delete':
            hash_delete(key_str, key_hash, self.bins, self.nbins)


if __name__ == "__main__":
    # usage: mcsoda_sim_micro_lru sim-micro-lru

    argv = (' '.join(sys.argv) +
            ' doc-gen=0 doc-cache=0 exit-after-creates=1').split(' ')

    store = StoreSimMicroLRU()

    mcsoda.main(argv,
                protocol="sim-micro-lru",
                stores=[store])

    tot = 0
    max_bin_length = 0
    for bin in store.bins.values():
        n = bin_length(bin)
        if max_bin_length < n:
            max_bin_length = n
        tot += n
        print bin
        # print(n)

    print(max_bin_length)
    print(tot)
예제 #5
0
        d = copy.deepcopy(d)
        d['body'] = self.cfg['body'][min_value_size]
        return d

    def command(self, c):
        cmd, key_num, key_str, data, expiration = c
        cmd_start = time.time()
        if cmd[0] == 'g':
            self.coll.find_one(key_str)
        elif cmd[0] == 's':
            self.coll.save(data)
        elif cmd[0] == 'd':
            self.coll.remove(key_str)
        else:
            raise Exception("StoreMongo saw an unsupported cmd: " + cmd)
        cmd_end = time.time()

        histo = self.add_timing_sample(cmd, cmd_end - cmd_start)
        if self.sc:
            p = self.histo_percentile(histo, [0.90, 0.95, 0.99])
            self.sc.latency_stats(cmd, p)


if __name__ == "__main__":
    if sys.argv[1].find("mongo") != 0:
        raise Exception("usage: mcsoda_mongo mongo://HOST:27017 ...")

    argv = (' '.join(sys.argv) + ' doc-gen=0').split(' ')

    mcsoda.main(argv, protocol="mongo", stores=[StoreMongo()])
예제 #6
0
            m.append(prefix + message + suffix)

            return 0, 0, 0, 0, 1

        return mcsoda.StoreMembaseBinary.cmd_append(self, cmd, key_num, key_str,
                                                    data, expiration, grp)


if __name__ == "__main__":
    extra_examples=["          %s couchbase://127.0.0.1:8092 ratio-queries=0.2",
                    "          %s couchbase://127.0.0.1:8092 ratio-queries=0.2 \\",
                    "               queries=/default/_design/DDOC/_view/by_email?startkey={email}",
                    "",
                    "Available keys for queries templates:",
                    "    key, name, email, city, country, realm, coins, category,",
                    "    cmds (the number of commands sent so far),",
                    "    int10, int100, int1000 (various sized integers)"
                    ]

    if len(sys.argv) >= 2 and \
       (sys.argv[1].find("couchbase") == 0 or \
        sys.argv[1].find("cb") == 0):
        mcsoda.main(sys.argv,
                    protocol="couchbase",
                    stores=[StoreCouchbase()],
                    extra_examples=extra_examples)
    else:
        mcsoda.main(sys.argv,
                    extra_examples=extra_examples)
예제 #7
0
            if True:
                # Use separate sends()'s for revs_diff and bulk_docs.
                to_send = [(''.join(revs_diff_arr), 1), (''.join(bulk_docs_arr), 1)]
            else:
                # Send revs_diffs + bulk_docs in one send().
                to_send = [(''.join(revs_diff_arr) + ''.join(bulk_docs_arr), 2)]

            for m, num_posts in to_send:
                self.reader.inflight += num_posts
                self.skt.send(m)
                self.xfer_sent += len(m)

                r = self.reader.received
                self.reader_go.set()
                self.reader_done.wait()
                self.reader_done.clear()
                self.xfer_recv += self.reader.received - r

        self.ops += len(self.queue)
        self.queue = []


if __name__ == "__main__":
    if sys.argv[1].find("http") != 0:
        raise Exception("usage: %s http://HOST:5984 ..." % (sys.argv[0],))

    argv = (' '.join(sys.argv) + ' doc-gen=0').split(' ')

    mcsoda.main(argv, protocol="http", stores=[StoreCouch()])