91精产品自偷自偷综合官网版下载-91精产品自偷自偷综合下-91精品-91精品91久久久-91精品成人-91精品成人www

網(wǎng)站建設(shè)資訊

NEWS

網(wǎng)站建設(shè)資訊

Disruptor-06中有哪些等待策略

Disruptor-06 中有哪些等待策略 ,相信很多沒有經(jīng)驗(yàn)的人對(duì)此束手無策,為此本文總結(jié)了問題出現(xiàn)的原因和解決方法,通過這篇文章希望你能解決這個(gè)問題。

創(chuàng)新互聯(lián)建站專業(yè)為企業(yè)提供晉州網(wǎng)站建設(shè)、晉州做網(wǎng)站、晉州網(wǎng)站設(shè)計(jì)、晉州網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、晉州企業(yè)網(wǎng)站模板建站服務(wù),10年晉州做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。

//.....
        // Construct the Disruptor with a SingleProducerSequencer
        Disruptor disruptor = new Disruptor(
            factory, bufferSize, DaemonThreadFactory.INSTANCE, ProducerType.SINGLE, new BlockingWaitStrategy());
        //.....

BlockingWaitStrategy

The default wait strategy used by the Disruptor is the BlockingWaitStrategy. Internally the BlockingWaitStrategy uses a typical lock and condition variable to handle thread wake-up. The BlockingWaitStrategy is the slowest of the available wait strategies, but is the most conservative with the respect to CPU usage and will give the most consistent behaviour across the widest variety of deployment options. However, again knowledge of the deployed system can allow for additional performance.

BlockingWaitStrategy使用一個(gè)典型的鎖和條件變量來處理線程喚醒。BlockingWaitStrategy是可用的等待策略中最慢的策略,但在CPU使用方面是最保守的策略,可以在各種部署環(huán)境中提供最一致的行為表現(xiàn)。據(jù)了解,已部署的系統(tǒng)仍帶來額外的性能提升。

SleepingWaitStrategy

Like the BlockingWaitStrategy the SleepingWaitStrategy it attempts to be conservative with CPU usage, by using a simple busy wait loop, but uses a call to LockSupport.parkNanos(1) in the middle of the loop. On a typical Linux system this will pause the thread for around 60μs. However it has the benefit that the producing thread does not need to take any action other increment the appropriate counter and does not require the cost of signalling a condition variable. However, the mean latency of moving the event between the producer and consumer threads will be higher. It works best in situations where low latency is not required, but a low impact on the producing thread is desired. A common use case is for asynchronous logging.

與BlockingWaitStrategy類似,SleepingWaitStrategy通過使用一個(gè)簡(jiǎn)單的繁忙等待循環(huán),試圖在CPU使用方面保持保守,但是在循環(huán)的中間使用一個(gè)LockSupport.parkNanos(1)調(diào)用。在一個(gè)典型的Linux系統(tǒng)將為約60μs暫停的線程。但是,它的好處是,產(chǎn)生線程不需要采取任何其他操作來增加適當(dāng)?shù)挠?jì)數(shù)器,也不需要發(fā)送條件變量的代價(jià)。但是,在生產(chǎn)者線程和消費(fèi)者線程之間移動(dòng)事件的平均延遲會(huì)更高。它在不需要低延遲,但希望對(duì)生成線程有低影響的情況下工作得最好。一個(gè)常見的用例是異步日志記錄。

YieldingWaitStrategy

The YieldingWaitStrategy is one of 2 Wait Strategies that can be use in low latency systems, where there is the option to burn CPU cycles with the goal of improving latency. The YieldingWaitStrategy will busy spin waiting for the sequence to increment to the appropriate value. Inside the body of the loop Thread.yield() will be called allowing other queued threads to run. This is the recommended wait strategy when need very high performance and the number of Event Handler threads is less than the total number of logical cores, e.g. you have hyper-threading enabled.

YieldingWaitStrategy是可以在低延遲系統(tǒng)中使用的兩種等待策略之一,在低延遲系統(tǒng)中可以選擇消耗CPU周期,以改善延遲。YieldingWaitStrategy將忙于旋轉(zhuǎn),等待序列增加到適當(dāng)?shù)闹怠T谘h(huán)體內(nèi)部調(diào)用Thread.yield(),以允許其他排隊(duì)的線程運(yùn)行。當(dāng)需要非常高的性能和事件處理,程序線程數(shù)小于邏輯內(nèi)核總數(shù)時(shí),這是推薦的等待策略,例如啟用了超線程。

BusySpinWaitStrategy

The BusySpinWaitStrategy is the highest performing Wait Strategy, but puts the highest constraints on the deployment environment. This wait strategy should only be used if the number of Event Handler threads is smaller than the number of physicalcores on the box. E.g. hyper-threading should be disabled.

BusySpinWaitStrategy是執(zhí)行效率最高的等待策略,但是對(duì)部署環(huán)境的限制也最高。只有當(dāng)事件處理程序線程的數(shù)量小于機(jī)器上物理內(nèi)核的數(shù)量時(shí),才應(yīng)該使用此等待策略。例如,應(yīng)該禁用超線程。

看完上述內(nèi)容,你們掌握Disruptor-06 中有哪些等待策略 的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!


新聞標(biāo)題:Disruptor-06中有哪些等待策略
文章出自:http://www.yuzhuanjia.cn/article/jhoiej.html
主站蜘蛛池模板: 囯产自拍亚洲精品yt166 | 午夜精品一区二区三区av | 国产av剧情超级爽闺蜜 | 日韩av无码中文一区二区 | 91嫩草欧美久久久九九九 | 成人夜间视频 | 东京道一本 | 午夜免费啪视 | 国产91精品一区二区 | 国产超级va在线观看视频 | 91精品午夜福利在线观看入口 | 99re6在线精品免费观看 | 成人中文字幕电影 | 波多野结衣电影一区二区 | 2025中文字幕在线 | 午夜神器免费观看黄 | 91黄色视频免费在线观看 | 午夜福利理论片高清在线观 | 成av人片一区 | 成人国产在线视频 | 一区精品视频一区二区 | 91av在线免费观看 | 国产3p露脸福利在线视频 | 99久久天天躁狠狠躁夜夜躁 | 午夜毛片视频播放 | 91久久精品国产免费一区 | 午夜免费无码福利视频 | 911精品国产自产在线观看 | 97无码免费人妻超 | 91制片厂制作果冻传 | 1区1区3区4区不卡乱码在 | 波多野结衣蓝光中文字幕 | 国产哺乳奶水91在线播放 | 97伦伦午夜电影理伦片 | 911精品国产 | 91久久久精品无码一区一一区 | 午夜香吻免费观看视频在线播放 | 午夜无码成人3d动漫在线 | 99久久国产综合精品麻豆导演 | 91免费网址在线观看 | 波多野结衣办公室在线观看 |