码迷,mamicode.com
首页 > 其他好文 > 详细

rabbtimq非持久化测试

时间:2019-03-28 00:19:26      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:fetch   timer   rds   ESS   vmware   use   action   nop   app   

send端代码

import pika,time,threading
class send():
    def __init__(self,que_nam=hello):
        self.credentials = pika.PlainCredentials(mytest, mytest)
        self.connection = pika.BlockingConnection(pika.ConnectionParameters(host=192.168.157.132,credentials=self.credentials))
        self.channel = self.connection.channel()
        self.channel.queue_declare(queue=que_nam)
    def action(self,msgj=ndyd 996):
        while True:
            self.channel.basic_publish(exchange=‘‘,
                              routing_key=hello,
                              body=msgj)
        print(" [x] Sent %s" %msgj)
        time.sleep(0.5)
    def lll(self):
        li=[]
        for i in range(1,1000):
            th=threading.Thread(target=self.action())
            th.start()
            li.append(th)
        for i in li:
            i.join()
        # connection.close()
song=send()
song.lll()

消费端代码

import pika

class send():
    def __init__(self,msg=ndyd 996,que_nam=hello):
        self.credentials = pika.PlainCredentials(mytest, mytest)
        self.connection = pika.BlockingConnection(pika.ConnectionParameters(host=192.168.157.132,credentials=self.credentials))
        self.channel = self.connection.channel()
        self.channel.queue_declare(queue=que_nam)

    def callback(self,ch, method, properties, body):
        print(" [x] Received %r" % body)

    def start(self):
        self.channel.basic_consume(self.callback,
                          queue=hello,
                          no_ack=True)

        print( [*] Waiting for messages. To exit press CTRL+C)
        self.channel.start_consuming()
song=send()
song.start()

 

rabbitmq配置

[root@localhost ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:           472M        107M        296M        1.5M         67M        326M
Swap:          2.0G         88M        1.9G
[root@localhost ~]# lscpu 
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                1
On-line CPU(s) list:   0
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 94
Model name:            Intel(R) Core(TM) i5-6300HQ CPU @ 2.30GHz
Stepping:              3
CPU MHz:               2303.139
BogoMIPS:              4608.00
Hypervisor vendor:     VMware
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              6144K
NUMA node0 CPU(s):     0
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec arat

 

稳定发送速率

技术图片

 

 停止接收端 rabbitmq 瞬间崩溃

技术图片

 

rabbtimq非持久化测试

标签:fetch   timer   rds   ESS   vmware   use   action   nop   app   

原文地址:https://www.cnblogs.com/leleyao/p/10612028.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!