Answer the question
In order to leave comments, you need to log in
Why does it sometimes take too long for a model to be added to the database (Laravel)?
Periodically, the following requests appear in the server logs:
I.e. periodically, the server response speed starts to increase from 0.2 s to 3 or even 8 seconds. This happens randomly and does not depend on server load or time of day.
In the php-fpm slow request logs, these moments look like this:
[30-Oct-2020 09:13:46] [pool www] pid 5494
script_filename = /public/index.php
[0x00007f53c441f0a0] execute() /vendor/laravel/framework/src/Illuminate/Database/Connection.php:459
[0x00007f53c441f010] Illuminate\Database\{closure}() /vendor/laravel/framework/src/Illuminate/Database/Connection.php:658
[0x00007f53c441ef50] runQueryCallback() /vendor/laravel/framework/src/Illuminate/Database/Connection.php:625
[0x00007f53c441ee90] run() /vendor/laravel/framework/src/Illuminate/Database/Connection.php:460
[0x00007f53c441ee10] statement() /vendor/laravel/framework/src/Illuminate/Database/Connection.php:412
[0x00007f53c441ed90] insert() /vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php:32
[0x00007f53c441ece0] processInsertGetId() /vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2658
[0x00007f53c441ec30] insertGetId() /vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:1317
[0x00007f53c441eb60] __call() /vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:839
[0x00007f53c441eab0] insertAndSetId() /vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:804
[0x00007f53c441ea20] performInsert() /vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:667
[0x00007f53c441e970] save() /vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:749
[0x00007f53c441e910] Illuminate\Database\Eloquent\{closure}() /vendor/laravel/framework/src/Illuminate/Support/helpers.php:424
[0x00007f53c441e890] tap() /vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:750
[0x00007f53c441e810] create() /vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:23
[0x00007f53c441e730] forwardCallTo() /vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1618
[0x00007f53c441e6a0] __call() /vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1630
[0x00007f53c441e610] __callStatic() /app/Models/SkillRequest.php:102
[0x00007f53c441e540] send() /app/Http/Controllers/Skills/GameSearchController.php:294
[0x00007f53c441e400] index() /vendor/laravel/framework/src/Illuminate/Routing/Controller.php:54
SkillRequest::create($skill_request);
protected $fillable = [
'skill_id',
'user_id',
'type',
'request_content',
'response_content',
];
protected $casts = [
'request_content' => 'array',
'response_content' => 'array',
];
Schema::create('skill_requests', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('skill_id', 255);
$table->string('user_id', 255);
$table->string('type')->default(NULL);
$table->json('request_content')->default(NULL);
$table->json('response_content')->default(NULL);
$table->timestamps();
});
Answer the question
In order to leave comments, you need to log in
because the code does not work in a spherical vacuum, but in parallel with other tasks
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question