Solved

PHP latency when connecting to remote database

Posted on 2014-04-06
4
457 Views
Last Modified: 2014-04-15
Hello,

We were wondering if latency in connecting to a remote database with PHP would slow down the user experience. For example:

1) User submits a PHP form hosted on a CDN server located close to them
2) PHP script passes the collected data from the form to a centralised database hosted in a different datacenter (approx 120 ms latency from CDN server)

Would PHP hold up the user experience because it would be waiting on a 200 response from the database server Or would the latency only exist between the CDN and Database server?
0
Comment
Question by:PlumInternet
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
bigeven2002 earned 167 total points
ID: 39982101
Hello,

PHP stays running until the script is finished so that includes waiting for the 200 OK response since it is part of the database php command.  While in most cases 120 ms will go unnoticed, technically it can slow down the experience in this 3 Tier setup.
0
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 167 total points
ID: 39982191
All the PHP methods I know of will wait for a text response.  Maybe if you're doing 'socket' programming it might know about the 200 response.  Otherwise, PHP waits for the return data.
0
 
LVL 109

Assisted Solution

by:Ray Paseur
Ray Paseur earned 166 total points
ID: 39982688
Absent some extraordinary API programming, PHP will wait.  But it is (a little bit) application-dependent.  If the PHP application was "write only" and did not need any information back from the DB server, it could, in theory, start an asynchronous process to write to the DB server and PHP could continue its operation without further reference to the DB server.  In practice this is very rare; most programmers would expect a success or fail signal back from the DB server and if such a signal is required PHP would need to wait until it was received.
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 40002020
What was wrong with the answers?  Please see the grading guidelines and tell us what you were expecting that you did not get, thanks.
http://support.experts-exchange.com/customer/portal/articles/481419
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How do I fix this UPDATE error? 7 32
check mysql insert 12 28
How to get this library to work load? 8 25
Need a modeling tool 2 19
A publishing tool, a Version Control System, or a Collaboration Platform! These can be some of the defining words for the two very famous web-hosting Git repositories: Bitbucket and Github. Git is widely used amongst the programmers and developers f…
It’s a strangely common occurrence that when you send someone their login details for a system, they can’t get in. This article will help you understand why it happens, and what you can do about it.
This video teaches users how to migrate an existing Wordpress website to a new domain.
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question