Hello Justin

In real world, this issue also happen.

basically you have that some systems try to be nice and resolv the
reverse IP for log files.

That is you will get an gethostbyname 192.168.56.10 to see what's the
reverse of that ip.

if you do netstat -ap

and you see IP instead of names, or some TIME_WAIT it may be like this.


I have seen that in many application servers and other boxes.

The first thing to check is, change that.

1. put both servers as  in /etc/hosts

ip longname shortname

make sure the output of

echo $HOSTNAME
hostname
hostname -s

is on the /etc/hosts

its good practice to put hostnames as FQDN, but not 100% required.. if
you want use .localdomain

server1.localdomain


2. edit /etc/resolv.conf to do a time out quickly

Something like this helps

mv /etc/resolv.conf /etc/resolv.conf.ori
grep -v options /etc/resolv.conf.ori > /etc/resolv.conf
echo "options timeout:1" >> /etc/resolv.conf
echo "options attempts:2" >> /etc/resolv.conf

3. Edit  /etc/nsswitch.conf

change from:

hosts:      files dns

to:

hosts:      files


Take note that number 3 will disable DNS resolution always but will
make things go faster.


Let me know if this make anything better .

Alvaro.


On Tue, Apr 21, 2015 at 8:48 AM, Justin Dodge <[email protected]> wrote:
> Hey all,
>
> I'm doing some web development (specifically with scotch box) and I noticed
> if I try run my site by connecting to a mysql database that's running on the
> machine which is hosting the VM, it works - but the performance goes way
> down the toilet.
> If I use a DB via localhost (i.e. within the virtual machine), everything is
> just fine.
>
> There's plenty of reasons why using a remote mysql DB would be slow
> especially for DB intensive stuff (Drupal, in this case) - but not only is
> this "remote" DB on the same private network, it's actually on the same
> machine - so it seems to me that it should perform comparably.
> Some googling led me to suggestions of configuring mysql with
> "skip_name_resolve" (https://groups.drupal.org/node/393578), but I'm
> connecting to a local private IP directly so I don't think there's anything
> for DNS to resolve.
>
> This is probably more of a mysql config question, but I thought others might
> have run into this using Vagrant/VMs.  Are DB connections between the host
> and VM just going to be inherently slow?
> Is there some MySQL config that's a must-have for setups like this?
> Any other advice?
>
> Thanks in advance...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Vagrant" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to