Solved

PHP latency when connecting to remote database

Posted on 2014-04-06
4
449 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 82

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 108

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 108

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
PHP and Soap 3 28
how to resize preview image 4 30
lastpass auto fill login form 5 24
Page showing diff display 4 20
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
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.

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now