Thursday, January 13, 2011

Database connection (mysql_connect) taking a long time

After setting up a new database, the connection from the web servers was really slow. We had enough combined traffic to slow down the response of the PHP function mysql_connect() to between 5 and 20 seconds. But the current load on the MySQL server wasn't that high... something fishy was going on.

What I found was that the database server was trying to do a reverse look-up on every connection using the IP. It was slowing down every connection for this. You can disable this by using the following option, as explained here.


"Do not resolve host names when checking client connections. Use only IP addresses. If you use this option, all Host column values in the grant tables must be IP addresses or localhost. See Section 7.9.8, "How MySQL Uses DNS"." -->

Anyway, you can make this change in the configuration file to be loaded at start-up (it doesn't have to be a command-line option). Simply add "skip-name-resolve" on a new line in the /etc/my.cnf file and restart your DB server. VoilĂ !

Friday, January 7, 2011

Good Design

I've been thinking about good design for the past few months. Apple always seems like the best example of good design because of the simplicity, ease of use and rugged product designs.

I came across this article today about Dieter Rams, a product designer that has influenced many, including Apple.

Here are 10 principles of good design attributed to him:
  • Good design is innovative.

  • Good design makes a product useful.

  • Good design is aesthetic.

  • Good design helps us to understand a product.

  • Good design is unobtrusive.

  • Good design is honest.

  • Good design is durable.

  • Good design is consequent to the last detail.

  • Good design is concerned with the environment.

  • Good design is as little design as possible.

Saturday, January 1, 2011

Happy New Year!

It is here: 2011. To begin this new year my wife and I will be moving to Seattle. We are excited and are looking forward to the change in seasons, again. It has also been over one year since I began web development full-time (I had done it part-time for many years prior). Things have gone very well for a first year, a blessing for sure. So many adventures.

Happy New Year!