Notices

  • Please reload or restart the swoole_http_server after released your code. Because the Laravel program will be kept in memory after the swoole_http_server started. That's why the swoole_http_server has high performance.
  • Never use dd(), exit() or die() function to print your debug message. It will terminate your swoole worker unexpectedly.
  • global and static variables needs to be destroyed(reset) manually.
  • Infinitely appending element into static/global variable will lead to memory leak.
  1. // Some class
  2. class Test
  3. {
  4. public static $array = [];
  5. public static $string = '';
  6. }
  7.  
  8. // Controller
  9. public function test(Request $req)
  10. {
  11. // Memory leak
  12. Test::$array[] = $req->input('param1');
  13. Test::$string .= $req->input('param2');
  14. }
  • flush()/ob_flush()/ob_end_flush()/ob_implicit_flush() are not supported in swoole response.
  • Don't use header()/setcookie()/http_response_code() in your response, only return in illuminate response.
  • Request header can not exceed 8 KB. This is restricted by Swoole.
  • By default the max size of POST data/file is 10 MB which is restricted by package_max_length in Swoole.
  • You should have basic knowledge about multi-process programming and Swoole. If you still write your code with traditional php concepts, your app might have unexpected bugs.