2021年11月17日 星期三

RabbitMQ (1):RabbitMQ基本介紹


什麼是 RabbitMQ? 


RabbitMQ 是 message broker (消息代理) 軟體

當中傳輸消息的協定是使用 AMQP (Advanced Message Queuing Protocol,高級消息隊列協議)

RabbitMQ (2):使用Docker建立RabbitMQ測試環境

 
使用 Docker 建立 RabbitMQ 測試環境吧!

2021年11月16日 星期二

[Python] Threading (5):concurrent.futures.ThreadPoolExecutor 介紹

concurrent.futures module提供python異步執行的高階interface

https://docs.python.org/3/library/concurrent.futures.html


這裡介紹當中的 ThreadPoolExecutor,當你有一個工作可以切分成多塊重複執行時,可以透過使用 ThreadPoolExecutor 建立多個 thread 併發跑。

[Python] Threading (4):threading.local() 介紹

 

什麼是 threading.local()

透過創建 threading.local() 我們可以建立 thread 的 local storage

local 物件為 thread-specific,每個 thread 的值各自獨立,不會互影響

[Python] Threading (3):Race Condition與Thread-Safe


上章學會了 Python Thread 的基本寫法

這章要講的是當你的程式用到 multi-thread ,有個一定要小心的問題,那就是:Race Condition

 

[Python] Threading (2):Hello Thread 建立第一個 Multithread 程式


承接上一章,我們大概了解了 Python Multithreading 的一點概念,接下來就是實際實作。

基本上在 Python 實作 multithread 程式一定會用到 Python 內建的 threading 模組
threading module 官方文件:https://docs.python.org/zh-tw/3/library/threading.html

[Python] Threading (1):什麼是多執行緒Multithreading

 

多執行緒(multithreading)技術能讓程序(process)運行多個執行緒(thread)達到平行執行,透過平行執行我們能更快得到計算結果。