0

At my office, we have a php server and also a postgresql server. The php server querying local postgresql server is fast, but recently we are migrating the db to AWS RDS.

And now we run a simple query from the php server to AWS RDS can take like 30 seconds or more. But when using psql and connect to the RDS the query is fine.

I clone the php server and provision a EC2 on amazon then the PHP query RDS is fast. I was leaning toward a network bandwidth issue but when running psql the performance is fine. Then I thought it could be the code/illuminate/pdoconnector/php, but exact same code run fine on ec2.

anyone have any idea where I should investigate?

  • It's not bandwidth, it's latency. Hosting a database server in a different datacenter isn't ideal. – ceejayoz Dec 23 '20 at 23:21
  • I understand, but can the latency be so bad that it a simple query that take less then 1 second can take up to 30 second from local server? local php server is in Vancouver Canada and AWS RDS is in canada central region(only 1 region for canada) – Richard Dec 23 '20 at 23:53
  • That depends quite a bit on how many queries you're making on the average page. I've seen sites making thousands of queries on a page; going from 1-2ms to 30-60ms round trip on each one would have an impact. – ceejayoz Dec 24 '20 at 00:37
  • the php code is making roughly 5 query running a simple login validation on id / password /permission/role/rolepermission. According to the rds log each query duration is like no more then 20ms. Using postman to test this php code, the logain validation takes about 60 seconds, compare to testing off ec2 that take like less then 1.5 second – Richard Dec 24 '20 at 01:37

0 Answers0