Closed FlyToper closed 3 months ago
Your software version (Screenshot of your startup)
Detail description about this issue(error/log)
Allowed memory size of 134217728 bytes exhausted (tried to allocate 40960 bytes)
Some reproducible code blocks and steps
reproducible
steps
//伪代码:主要是静态变量查询缓存、Redis,然后就写入log日志,逻辑很简单 GameService::getInstance()->get($arr['game_id']) Log::channel($table)->info(json_encode($arr, JSON_UNESCAPED_UNICODE));
worker_num = 1 //在一个laravel controller 下只有如下代码
worker_num = 1
//在一个laravel controller 下只有如下代码
public function test(Request $request) { global $previous; $current = memory_get_usage(); $stats = [ 'prev_mem' => $previous, 'curr_mem' => $current, 'diff_mem' => $current - $previous, ]; $previous = $current; dump($stats);
return 0; }
ab 测试 > ab -n 200 -c 1 http://127.0.0.1:5200/test 结果如下(curr_mem 一直在增长,每次 +3624):
array:3 [ "prev_mem" => 25381224 "curr_mem" => 25384848 "diff_mem" => 3624 ]
Laravel LogRecorder组件有问题
嗯,一般这种情况是中间件不支持常驻内存的运行模式。
Your software version (Screenshot of your startup)
Detail description about this issue(error/log)
Allowed memory size of 134217728 bytes exhausted (tried to allocate 40960 bytes)
Some
reproducible
code blocks andsteps
public function test(Request $request) { global $previous; $current = memory_get_usage(); $stats = [ 'prev_mem' => $previous, 'curr_mem' => $current, 'diff_mem' => $current - $previous, ]; $previous = $current; dump($stats);
return 0; }
array:3 [ "prev_mem" => 25381224 "curr_mem" => 25384848 "diff_mem" => 3624 ]