O
O
Oleg2021-12-13 17:08:14
PHP
Oleg, 2021-12-13 17:08:14

Laravel slow with read/write Database?

Hello! I configured Laravel to connect to the required database depending on the task - writing to the master, reading from the slave. Now each http request to the project takes about 3 - 4 seconds (there are no requests for writing to the database). If I remove read / write in the database settings and leave only host, Laravel processes requests instantly.
There are suspicions that regardless of the type of request, Lara connects to 2 servers at once, is this true? how can i fix it?

In php artisan tinker console requests are flying. How to track why http works so slowly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2021-12-14
@mayken

Found the problem following ChairfaceChippendale 's recommendations, thanks!
It turns out that the umbrellio/laravel-pg-extensions package connects to the write server, thereby creating such inconveniences. I wrote to the author, if he does not fix it, he will have to do it himself.
trace:

#1 PDO::__construct
#2 Illuminate\Database\Connectors\Connector::createPdoConnection
#3 Illuminate\Database\Connectors\Connector::createConnection
#4 Illuminate\Database\Connectors\PostgresConnector::connect
#5 Illuminate\Database\Connectors\ ConnectionFactory::Illuminate\Database\Connectors\{closure}
#6 call_user_func
#7 Illuminate\Database\Connection::getPdo
#8 Illuminate\Database\Connection::getDoctrineConnection
#9 Umbrellio\Postgres\PostgresConnection::getDoctrineConnection
#10 Illuminate\Database \Connection::getDoctrineSchemaManager
#11 Illuminate\Database\Schema\Builder::registerCustomDoctrineType
#12 Umbrellio\Postgres\PostgresConnection::Umbrellio\Postgres\{closure}
#13 Illuminate\Support\Collection::each
#14 Umbrellio\Postgres\PostgresConnection::registerExtensions
#15 Umbrellio\Postgres\PostgresConnection::useDefaultPostProcessor
#16 Illuminate\Database\Connection::__construct
#17 Umbrellio\Postgres\Connectors\ConnectionFactory: :createConnection
#18 Illuminate\Database\Connectors\ConnectionFactory::createSingleConnection
#19 Illuminate\Database\Connectors\ConnectionFactory::createReadWriteConnection
#20 Illuminate\Database\Connectors\ConnectionFactory::make

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question