예제 #1
0
    def __init__(self, test_context):
        super(NativeVsRestProducerPerformance,
              self).__init__(test_context,
                             num_zk=1,
                             num_brokers=1,
                             num_rest=1,
                             topics={
                                 'test-rep-one': {
                                     'partitions': 6,
                                     'replication-factor': 1
                                 },
                             })

        if True:
            # Works on both aws and local
            msgs = 1000000
        else:
            # Can use locally on Vagrant VMs, but may use too much memory for aws
            msgs = 50000000

        msg_size = 100
        batch_size = 8196
        acks = 1

        self.producer_perf = ProducerPerformanceService(test_context,
                                                        1,
                                                        self.kafka,
                                                        topic="test-rep-one",
                                                        num_records=msgs,
                                                        record_size=msg_size,
                                                        throughput=-1,
                                                        settings={
                                                            'batch.size':
                                                            batch_size,
                                                            'acks': acks
                                                        })

        self.rest_producer_perf = RestProducerPerformanceService(
            test_context,
            1,
            self.rest,
            topic="test-rep-one",
            num_records=msgs,
            record_size=msg_size,
            batch_size=batch_size,
            throughput=-1)