?
Solved

PHP latency when connecting to remote database

Posted on 2014-04-06
4
Medium Priority
?
479 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
bigeven2002 earned 501 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 501 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 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 498 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 111

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This video teaches users how to migrate an existing Wordpress website to a new domain.
Suggested Courses

771 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