Help: 30sec request time from local apache to mysql on linode

Hi everyone - my first post :D

Im now trying to configure a local development environment.

A simple OSX computer editing wordpress sites, which I upload to Linode.

I've set up a Linode with multiple virtual hosts, and everything is humming along nicely. Simple LAMP stack, as per Linode 'getting started' instructions. An example production URL on my linode: http://motorcave.com

My local machine

Everything does function correctly: Im able to set up multiple wordpress sites locally and interface with a development MySQL server hosted on Linode.

However, every web request sees a 25-30sec timeout or delay that's happening on the Linode end.

No matter what I've tried, I just cant get that domain or IP resolution happening fast. This problem only happens locally, my production sites on the Linode are rock solid.

Local development specs

Pretty straight forward local mac setup:

Macbook 2.7ghz, fresh install OSX 10.11

VirtualHostX to handle apache, virtual hosts.

A basic HTML site on this setup resolves instantly.

Sites edited in Atom editor, files hosted on BitBucket.

Home IP: 110.22.196.250

Linode IP: 45.118.134.69

On the linode end, the IP tables has my home and word IP address allowed. The reason I host the database on Linode is so I can develop 'locally' between my work and home computer, without having to sync databases every 5 mins. Makes my workflow much faster.

This exact setup worked well on my previous host (Ventra IP). I moved to Linode in October 2015.

When I use a Mac SQL program 'Sequel', the interface with the database is quick and snappy. No delays. 1-2sec connection time.

But when I run the Wordpress websites in-browser (in my case it's http://mc.dev), and bring up any page (public or wp-admin) I get a 25-30sec delay to first byte.

Reports and stats

Chrome browser network inspector looks like:

~~![](<URL url=)http://i.imgur.com/Yq6G0op.png" />

Linode support asked me to run a few MRT commands to get some stats:

ricky$ sudo ./mtr -rwc 100 -4 speedtest.singapore.linode.com

Start: Fri Nov 27 15:00:25 2015

HOST: VIC012131M Loss% Snt Last Avg Best Wrst StDev

1.|– 172.20.10.1 0.0% 100 3.3 19.8 1.5 348.1 54.9

2.|-- ??? 100.0 100 0.0 0.0 0.0 0.0 0.0

3.|-- ??? 100.0 100 0.0 0.0 0.0 0.0 0.0

4.|-- ??? 100.0 100 0.0 0.0 0.0 0.0 0.0

5.|-- bundle-ether11.win-edge901.melbourne.telstra.net 0.0% 100 25.7 63.0 20.4 481.3 73.3

6.|-- bundle-ether11.win-core10.melbourne.telstra.net 0.0% 100 24.1 66.9 20.7 426.1 77.9

7.|-- bundle-ether6.fli-core1.adelaide.telstra.net 0.0% 100 41.9 82.1 32.5 535.9 91.8

8.|-- bundle-ether5.wel-core3.perth.telstra.net 2.0% 100 73.8 113.1 61.2 480.5 82.0

9.|-- tengige0-8-0-5-1.pie-core1.perth.telstra.net 1.0% 100 76.0 120.1 65.1 427.3 83.8

10.|-- tengige0-0-1-0.pthp-core01.perth.net.reach.com 1.0% 100 70.5 117.0 60.2 385.0 78.2

11.|-- i-0-1-4-0.skdi-core01.bx.telstraglobal.net 1.0% 100 120.2 162.1 112.1 478.9 68.4

12.|-- 202.84.244.42 0.0% 100 172.2 183.0 143.4 433.5 58.8

13.|-- pacnet-peer.istt03.pr.telstraglobal.net 1.0% 100 151.8 186.7 141.3 503.8 62.1

14.|-- xe0-2-0.gw1.sin2.pacnet.net 0.0% 100 152.0 186.4 143.7 567.0 69.3

15.|-- gw1.sin1.sg.linode.com 0.0% 100 150.9 190.5 144.0 503.7 69.8

16.|-- 139.162.0.2 1.0% 100 164.6 191.4 141.4 613.4 71.5

17.|-- speedtest.singapore.linode.com 1.0% 100 156.9 189.2 141.7 595.2 73.3

And also some CURL commands…

1st curl command result (to itsricky.com, my own public URL hosted on Linode):

ricky$ curl -o /dev/null -w "Connect: %{timeconnect} TTFB: %{timestarttransfer} Total time: %{time_total} \n" itsricky.com

% Total % Received % Xferd Average Speed Time Time Time Current

Dload Upload Total Spent Left Speed

100 12410 0 12410 0 0 14767 0 –:--:-- --:--:-- --:--:-- 14756

Connect: 0.675 TTFB: 0.839 Total time: 0.840

2nd curl command (to local mc.dev, local hosted website on my mac):

ricky$ curl -o /dev/null -w "Connect: %{timeconnect} TTFB: %{timestarttransfer} Total time: %{time_total} \n" mc.dev

% Total % Received % Xferd Average Speed Time Time Time Current

Dload Upload Total Spent Left Speed

100 35170 0 35170 0 0 1852 0 –:--:-- 0:00:18 --:--:-- 9331

Connect: 0.005 TTFB: 18.974 Total time: 18.989

So you can see the long time there before the server responds with data.

The IPTABLES –linenumbers command on my linode returns:

Chain INPUT (policy ACCEPT)

num target prot opt source destination

1 ACCEPT tcp – 110.22.196.0/24 anywhere tcp dpt:mysql state NEW,ESTABLISHED

2 ACCEPT tcp -- 203.17.253.249 anywhere tcp dpt:mysql

3 ACCEPT tcp -- nemo.itsricky.com anywhere tcp dpt:mysql

4 fail2ban-ssh tcp -- anywhere anywhere multiport dports ssh

5 ACCEPT all -- anywhere anywhere

6 REJECT all -- 127.0.0.0/8 anywhere reject-with icmp-port-unreachable

7 ACCEPT icmp -- anywhere anywhere icmp destination-unreachable

8 ACCEPT icmp -- anywhere anywhere icmp echo-request

9 ACCEPT icmp -- anywhere anywhere icmp time-exceeded

10 ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh

11 ACCEPT tcp -- anywhere anywhere tcp dpt:http

12 ACCEPT tcp -- anywhere anywhere tcp dpt:https

13 ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED

14 LOG all -- anywhere anywhere limit: avg 5/min burst 5 LOG level debug prefix "iptablesINPUTdenied: "

15 REJECT all -- anywhere anywhere reject-with icmp-port-unreachable

Chain FORWARD (policy ACCEPT)

num target prot opt source destination

1 LOG all -- anywhere anywhere limit: avg 5/min burst 5 LOG level debug prefix "iptablesFORWARDdenied: "

2 REJECT all -- anywhere anywhere reject-with icmp-port-unreachable

Chain OUTPUT (policy ACCEPT)

num target prot opt source destination

Chain fail2ban-ssh (1 references)

num target prot opt source destination

1 RETURN all -- anywhere anywhere

Once that initial 25-30sec delayed first byte comes back, the html page and images load quite quickly.

Other attempts

I've tried setting the item 'skip-name-resolve' in my.cnf on the linode, and setting the wp-config.php file to request the database via the IPv4 address, but no luck.

I've tried all manner of local OSX /etc/hosts configurations, with no luck. But I dont think the problem is happening here. The mac is able to resolve the IPv4 and IPv6 addresses quickly.

Can you help me understand what's going on here?

How can I set up my MySQL server on Linode so that it quickly recognises my remote MySQL & PHP requests, and sends back data promptly?

Any questions of extra info that would help - please let me know.

Thanks muchly in advance

Rick~~

1 Reply

I've been seeing delays and packet loss in SG as well.

The path to SG from Oz is asymmetric, but from what I've seen so far it looks very much like insufficient capacity between Hurricane Electric & Linode DC. (Within Oz, the losses in Telstra make matters even worse too)

I was told a fault would be raised with HE re packet loss, but TBH that is a bit of a fob off, since the network staff should already be well aware of edge capacity, loss on upstream circuits, and how heavily their rate shaping is being hit (often, circuits get shaped to delay purchasing additional capacity)

I'd be happy if Linode would comment on timeframe for additional capacity (buying N+1 can get expensive - beancounters usually want justification), or migration options to DC's that aren't facing capacity constraints.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct