The invention provides a multi block chain transaction buffer queue limiting method, which comprises the steps of: 1) the client sends out the transaction to block chain request; 2) the transaction into the first level cache queue, each transaction ID hash; 3) will get the hash value modulo processing according to the second level cache queue number, according to the remainder modulo the transaction into the second level cache queue corresponding; 4) in the second level cache queue insert third cache queue on the number of transactions to limit the current, current limiting strategy is through the third level buffer queue size to adjust the limit the flow rate through the processing ability of the thread scheduler according to the timely adjustment of the buffer queue size, meet the request for handling bursty traffic. The invention makes full use of the parallel processing ability of block chain system, satisfy certain emergency peak of the request, with load balancing technology, concurrent ability to maximize the system, can improve the stability of the system effectively block chain.
【技术实现步骤摘要】
一种基于多级缓冲队列的区块链交易限流方法
本专利技术属于区块链
,特别是涉及区块链处理突发交易流量高峰的场景。
技术介绍
近年来,区块链技术得到了长足的发展,在交易处理速度上也有了极大的提升,其中以天德链为代表的第三代区块链实测性能可以到达万笔每秒,但是在为商业应用服务时,极有可能面临突发的交易高峰场景,如双11秒杀活动支付峰值达到12万笔/秒,区块链交易处理的速度仍然满足不了这种突发流量,瞬时的大量交易可能导致整个区块链系统宕机,造成不可挽回的损失。为了解决上述问题,在传统高并发系统中,通常会利用缓存、降级和限流来提升系统的交易处理容量,暂时屏蔽掉突发流量,对系统进行负载均衡,对并发访问、请求进行限速等措施来保护系统,传统高并发系统基本是主从式系统架构,而区块链系统则采用完全对等的技术架构,所以传统的解决方案并不能有效满足区块链系统的技术需求。为了让区块链技术平台更好地应对处理高峰交易的场景,我们在传统高并发系统的基础上,专利技术了一种基于多级缓冲队列的区块链交易限流方法,将高并发系统的特点和区块链多节点共识的特点相结合,能有效满足区块链系统高效处理交易的 ...
【技术保护点】
一种基于多级缓冲队列的区块链交易限流方法,其特征在于:(1)区块链交易流入多级缓冲队列系统,压入第一级缓冲队列;(2)区块链交易从第一级缓冲队列弹出,分流进入通道,将交易压入第二级缓冲队列;(3)区块链交易从第二级缓冲队列弹出,进行限流将交易压入第三级缓冲队列;(4)区块链交易流出多级缓冲队列系统,BC共识线程获取交易。
【技术特征摘要】
1.一种基于多级缓冲队列的区块链交易限流方法,其特征在于:(1)区块链交易流入多级缓冲队列系统,压入第一级缓冲队列;(2)区块链交易从第一级缓冲队列弹出,分流进入通道,将交易压入第二级缓冲队列;(3)区块链交易从第二级缓冲队列弹出,进行限流将交易压入第三级缓冲队列;(4)区块链交易流出多级缓冲队列系统,BC共识线程获取交易。2.根据权利要求1所述的一种基于多级缓冲队列的区块链交易限流方法,其特征在于:所述步骤(1)包括客户端系统将区块链交易发送给区块链多级缓冲队列子系统,将交易数据压入第一级缓冲队列。3.根据权利要求1所述的一种基于多级缓冲队列的区块链交易限流方法,其特征在于:所述步骤(2)包括区块链交易从第一级缓冲队列弹出,对交易ID进行哈希运算,用哈希值对缓冲队列数进行取模运算,按余数结果将交易分配到对应的通道,将交易压入第二级缓冲队列。4.根据权利要求1所述的一种基于多级缓冲队列的区块链交易限流方法,其...
【专利技术属性】
技术研发人员:邓恩艳,
申请(专利权)人:北京天德科技有限公司,
类型:发明
国别省市:北京,11
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。