Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Impact of name resolution on mysql_connect perfomance |
|
Author |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3094 Location: Hilversum, NL, EU
|
Posted: Thu 04 Aug '11 20:45 Post subject: Impact of name resolution on mysql_connect perfomance |
|
|
Found the following:
I spend lot of time profiling popular PHP applications finding where exactly processing time is spent during PHP execution. Few months ago, one thing which caught my attention was performance of mysql_connect API. On my windows test bench, xdebug output showed that one call to mysql_connect was taking 0.31 seconds which is huge. While playing with the API, I noticed that when IP address of the MySQL machine is used instead of the hostname, performance of mysql_connect API is much better.
Read more ... http://www.ksingla.net/2010/06/impact-of-name-resolution-on-mysql_connect-perfomance/
Steffen |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Thu 04 Aug '11 21:42 Post subject: |
|
|
Well that tutorial doesn't tell everything. If mysql is on the same machine localhost is better than 127.0.0.1 cause on the same machine mysql_connect can use named pipes which is often (not always) faster than a TCP connect. Of cause DNS / name resolution takes a lot of time (same for apache ) If you using mysql over the network LAN or WAN you should try a peristent connection which can be reused. |
|
Back to top |
|
|
|
|
|
|