• Resolved simonmott

    (@simonmott)


    Hi Guys

    I’ve been looking into occasional slow loading of my WordPress (self hosted) homepage. Occasionally it’d take 4-5 seconds to load for no apparent reason.

    With the help of NewRelic, it shows that Jetpack is the cause of this suggests its Jetpack’s external call to stats.wordpress.com.

    If I add an iptables rule that drops outgoing connections (Drop, not reject) to the IP that stats.wordpress.com resolves to then my website can easily take over a minute to load because of a lack of decent timeout ??

    Incidentally, if I add a “REJECT” then it takes 10 seconds instead of 4 to load…)

    I have confirmed this by disabling WordPress Stats in jetpack and my issue went away.

    What exactly does this plugin do that can cause such high increase in loading time? It appears to store some serliazed data in wp_options in my database…

    If you need some more specific information, just let me know – Interestingly a different wordpress site on the same server takes 1.5s to 2s to load instead of 4s to 5s, but still seems like a long time.

    https://www.ads-software.com/plugins/jetpack/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    That seems weird indeed. Could you let me know if the same thing happens when you’re logged out of your admin account on the site?

    Thread Starter simonmott

    (@simonmott)

    Hi Jeremy

    Unfortunately I was seeing this behaviour when logged out ??

    If I had to take an educated guess it’d be when wp-cron kicks in and it downloads stats to generate “Top Posts and Pages”, but even so, 4s is still a long time to load

    Ping time to stats.wordpress.com for the server running my website is only 6-7ms

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    Can you locate any of those slow calls in your server logs, by any chance?

    Could you also try running a traceroute to stats.wordpress.com from your server? Do you notice anything wrong?

    Thread Starter simonmott

    (@simonmott)

    Hi Jeremey,

    Nothing in my logs that indicates a problem – everything works fine and doesnt seem to generate any errors other than the slow loading. The only way I found this was via newrelic ??

    All I can tell you from the server POV is that I see a connection to 192.0.76.2:80

    I’m going to do a packet capture to see what its doing and see if I can replicate the problem but for now, have some traceroutes ??
    They dont complete (I assume because of firewall configurations) but my rtt on ping is about 6-7ms

    simon@www1:~$ traceroute stats.wordpress.com
    traceroute to stats.wordpress.com (192.0.76.2), 30 hops max, 60 byte packets
     1  46-20-234-190.rdns.melbourne.co.uk (46.20.234.190)  0.158 ms  0.138 ms  0.124 ms
     2  border1.tshr.melbourne.co.uk (77.240.7.133)  0.213 ms  0.263 ms  0.249 ms
     3  no-ptr.as20860.net (62.128.207.177)  1.126 ms  1.315 ms  1.385 ms
     4  2990.core2.ld5.as20860.net (185.19.16.153)  5.713 ms  5.766 ms  5.831 ms
     5  be97.asr01.ld5.as20860.net (62.128.215.13)  6.325 ms  6.427 ms  6.513 ms
     6  195.66.226.127 (195.66.226.127)  6.528 ms  6.639 ms  6.618 ms
     7  * * *
     8  * * *
     9  * *^C
    simon@www1:~$
    simon@www1:~$
    simon@www1:~$ sudo traceroute -U stats.wordpress.com
    [sudo] password for simon:
    traceroute to stats.wordpress.com (192.0.76.2), 30 hops max, 60 byte packets
     1  46-20-234-190.rdns.melbourne.co.uk (46.20.234.190)  0.144 ms  0.126 ms  0.111 ms
     2  border1.tshr.melbourne.co.uk (77.240.7.133)  0.247 ms  0.233 ms  0.288 ms
     3  no-ptr.as20860.net (62.128.207.177)  0.782 ms  0.965 ms  1.098 ms
     4  2990.core2.ld5.as20860.net (185.19.16.153)  5.859 ms  5.844 ms  5.828 ms
     5  be97.asr01.ld5.as20860.net (62.128.215.13)  6.251 ms  6.327 ms  6.368 ms
     6  195.66.226.127 (195.66.226.127)  6.677 ms  6.632 ms  6.615 ms
     7  * * *
     8  * * *
     9  *^Csimon@www1:~$

    I’ll let yo know if i find anything in the traceroute

    Thread Starter simonmott

    (@simonmott)

    Hi Jeremey

    Yeah, So I see 11 requests in total for csv.php.

    10 of the requests seem to pull in view stats for individual pages and then final 1 as a summary (I’ve not really delved into the requests too much as you’ve got tokens in the headers and I dont want to risk blacklisting myself on your servers :))

    Each request takes about 0.28s from my server sending the GET request to a response coming back which equates to about 3s (0.28s x 11 requests) of wait time just for the stats info to come back from your server which is where the bulk of the loading time comes from – If I disable stats for Jetpack my native page loading is 0.6s (I’ve still not tracked down where the extra 0.5s to make it 4s loading time is spent yet…

    I have my top posts widget set to show 5 posts, and I have more than 10 – Its possibly using the number of posts I have showing on my homepage?

    Is there any way that the requests to stats.wordpress.com could be made concurrent or can I trigger them on a server level (cron?) so that the delay isn’t visible to visitors?

    Thanks
    Simon

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    Thanks for the extra details!

    Could you try to remove the Top Posts widget from your site, and see if the queries disappear? If so, we’ll have to see about implementing better caching for those requests, to avoid so many queries.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    I’ve been trying to reproduce the issue, but no luck.

    Would you mind sending me the requests via this contact form? It could help me understand.

    Could you also give me more details about your setup, and whether you use plugins to customize the way options are stored and cached in the database?

    Thanks!

    Thread Starter simonmott

    (@simonmott)

    Hi Jeremey

    Thank you for your assistance (And thank Brandon for me too!)

    It turns out the delay I was seeing is in relation to how my theme is using the Jetpack stats API to generate a “View” counter for each post and it’s requesting stats for “all time” which is the source of the delay

    I’ve removed this from the theme and it seems to be working fine now ??

    Kind Regards,
    Simon

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘stats.wordpress.com causing long loading times’ is closed to new replies.