echo "\nexec first time:";
$currentTime = microtime(true);
$users->paginate($request->length, ['*'], 'page', $request->start/$request->length + 1);
echo microtime(true) - $currentTime;
echo "\nexec second time:";
$currentTime = microtime(true);
$users->paginate($request->length, ['*'], 'page', $request->start/$request->length + 1);
echo microtime(true) - $currentTime;
The above is the code in my controller for testing the latency when query the mysql. As you can see I execute the same command twice. The execute latency is different.
exec first time: 2.7011959552765
exec second time: 0.78873896598816
The above is the output of the performance. During the Laravel document, the server provider contains the DI pattern to share the DB connection. If we are not recreate the connection then what happened is this result? If the result is belongs to recreation, then how can I share the connection pool?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire