Top Nav

Slow DNS Lookups For Web Requests

Ran into a strange problem recently … web server behind a firewall was able to resolve names with “dig” sucessfully but attempts to fetch web pages with “wget” or “curl” was very slow … seemed to hang on name resolution.  So this would work fine:

but this would hang for several seconds:

This problem extended to curl requests from with in PHP … in this case a Magento website … various plugins in the site were “calling home” when loading admin pages which resulted in making the admin painfully slow.

After much debugging we concluded that the problem was due to the fact that certain versions of glibc run IPv4 and IPv6 requests in parallel which breaks some firewalls and/or DNS servers. The work around was to add this option in /etc/resolv.conf:

This forces the requests to be made sequentially instead of in parallel. Hope this helps other struggling with these weird symptoms.


Plesk – Bulk Reset Subscription Expire Date

Here’s a one liner to set the expire date on all subscriptions to unlimited:



Install New Relic With Plesk 12.5

Plesk 12.5 allow for multiple PHP versions and integration methods. This is a great feature but it makes installing New Relic more difficult. New Relic by default installs to the Linux distribution’s version of PHP. With Plesk 12.5, there are multiple PHP versions in different locations. Also New Relic uses a unix socket to facilitate communication between the newrelic-daemon and the PHP component. When running PHP under php-fpm there are permission problems with multiple sites using New Relic. Here are the steps to get New Relic working on CentOS or RedHat. Other Linux distributions will be similar.

1. Install New Relic for the operating system following the standard instructions:

2. Set the newrelic-daemon to run independently by copying the config file template:

3. Configure the newrelic-daemon to listen on a TCP port instead of a UNIX socket:

4. Start the newrelic-daemon:

5. Configure distribution provided PHP to use newrelic-daemon:

6. Restart Apache

7. Install New Relic on Plesk provided PHP installations using the instructions here:

We’ll start with PHP 5.6:

8. Set the TCP port

9. Restart cooresponding php-fpm process:

10. Repeat steps 7, 8 and 9 for each additional PHP version installed on the server.


MySQL InnoDB File Per Table

By default MySQL 5.5 and prior store all InnoDB tables in a single table space or file. Improved performance and managability can be accheived by using the innodb_file_per_table option to cause MySQL to use a separate file for each table. This option is enabled by default on MySQL 5.6 and later.

To implement:
1. Add option to my.cnf:

2. Change table to use single file:

If you want to covert all databases then dump the entire database and import back into the server.