Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Best Practice

scil edited this page Oct 4, 2018 · 13 revisions
  1. Edit server conf file fly.conf.php.
  • Try to keep const LARAVELFLY_COROUTINE = true;

    • edit php.ini, disable ini_set and setlocale (to use coroutine, both would better only be used on worker, before any requests. Disabling them is a radical mean)
      disable_functions="header, setcookie, session_start, session_create_id, http_response_code, set_include_path, ini_set, setlocale"
  • Try your best to make as many of the items in LARAVELFLY_SERVICES to be true as possible. ( Exception: 'redis' 'filesystem.cloud' and 'broadcast' to be 'use' when they are used.)

  1. All of wildcard event listeners , are registered on worker (before any requests), then event listeners cache are helpful. Debugbar would disable the cache because it uses "*".

  2. Swoole workers run in different process, vars are not shared by different workers. Methods to share vars between workers:

  • Swoole tools like Table, Channel, ...

  • Yac, Redis, Memcached, ...