用 Go 語言實作 Job Queue 機制

golang logo


很高興可以在 Mopcon 分享『用 Go 語言實現 Job Queue 機制』,透過簡單的 goroutinechannel 就可以實現簡單 Queue 機制,並且限制同時可以執行多少個 Job,才不會讓系統超載。最後透過編譯放進 Docker 容器內,就可以跑在各種環境上,加速客戶安裝及部署。



議程大綱


本次大致上整理底下幾個重點:



  1. What is the different unbuffered and buffered channel?

  2. How to implement a job queue in golang?

  3. How to stop the worker in a container?

  4. Shutdown with Sigterm Handling.

  5. Canceling Workers without Context.

  6. Graceful shutdown with worker.

  7. How to auto-scaling build agent?

  8. How to cancel the current Job?


由於在投影片內也許寫得不夠詳細,所以我打算錄製一份影片放在 Udemy 教學影片上,如果有興趣可以參考底下影片連結:



之前的教學影片也可以直接參考底下連結:



投影片


Job Queue in Golang from Bo-Yi Wu


comments powered by Disqus