Laravel Octane Note

Laravel Octane

  • 瓶頸

    • I/O 效能瓶頸,Laravel 本身由多個 components 組成,載入的檔案相當多,造成 I/O 的消耗,所以有些人會選擇輕量化的 lumen
    • PHP 原生不支援以常駐在系統記憶體的方式執行,每次執行都需要新的生命週期
  • Octane 透過 Swoole or RoadRunner 提高程式啟動效率,並與 PHP OPcache 結合使用,啟動後,會常駐 memory 加速,減少重複的 import 及編譯,另外可以 fork 多個 worker 處理

    • 等於 Nginx + php-fpm 的角色
  • swoole

  • openswoole

    • It’s more than NGINX
    • it doesn’t need any RPC buses
    • it’s written in C
    • gives you access to low level API, such as shared memory tables..etc ( RoadRunner can only dream of this )
    • 相關 lib 可能不支援,需要進行盤點
  • RoadRunner

    • Go
    • NGNIX replacement,
    • RPC bus and KV system,
    • doesn’t touches PHP code, extensions, or the runtime.
    • 既有專案導入較快

Warning