This repository has been archived by the owner on Sep 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 390
Z1. Notices
Victor Gazotti edited this page Jan 18, 2021
·
4 revisions
- 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()
ordie()
function to print your debug message. It will terminate your swoole worker unexpectedly. Hint: you may also use Ignition'sddd()
function to reproduce the experience ofdd()
function -
global
andstatic
variables needs to be destroyed(reset) manually. - Infinitely appending element into static/global variable will lead to memory leak.
// Some class
class Test
{
public static $array = [];
public static $string = '';
}
// Controller
public function test(Request $req)
{
// Memory leak
Test::$array[] = $req->input('param1');
Test::$string .= $req->input('param2');
}
-
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 bypackage_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.