Significant Difference in Loading Time Between Original URL and Redirect

30 views Asked by At

I'm new to web development and have encountered an issue with the loading times of my web app, which I'm hoping to get some help with.

Background: I developed a web app accessible at https://solo-fsw.shinyapps.io/lavaangui/. I wanted a simpler URL, so I purchased http://lavaangui.org/ from Namecheap and pointed this to https://solo-fsw.shinyapps.io/lavaangui/.

Issue: I've noticed a significant difference in loading times between the two URLs:

  • The original URL (https://solo-fsw.shinyapps.io/lavaangui/) loads in about 1 second.
  • The new URL (http://lavaangui.org/) takes approximately 5 seconds to load, with a lot of variance. Sometimes it loads much faster and sometimes it takes > 10 seconds.

Attempts to Resolve: Initially, I thought the issue might be with Namecheap's DNS servers, so I switched the nameservers to Cloudflare. However, the problem persists even after this change.

Any insights or suggestions on how to diagnose and fix this issue would be greatly appreciated!


Tags: web-hosting, dns, performance, cloudflare, namecheap

2

There are 2 answers

0
nmishin On

This is hard to answer without knowledge of internal, but looks like your address https://solo-fsw.shinyapps.io/lavaangui/ pointing to some IP addresses, and you create a new one DNS record http://lavaangui.org/ and pointing to the same Ip addresses, I'm right?

if so, I think the issue can be in some internal logic, which check your HTTP header, in that case you can override it via Cloudflare "Transform Rules" option, how described here https://developers.cloudflare.com/rules/transform/request-header-modification/create-dashboard/

Also, as a second option you can try to create a CNAME record with Name lavaangui.org and Target solo-fsw.shinyapps.io, maybe it will be sutable for you.

0
John Hanley On

The problem is not with DNS, name lookup, or redirects. The Shinyapps service varies in response time by a large amount. My guess is the startup (cold start) time varies by a large amount.

I used the CLI tool curl to test both URLs. First I created a file to display various times including DNS name lookup:

curl-format.txt:

     time_namelookup:  %{time_namelookup}s\n
        time_connect:  %{time_connect}s\n
     time_appconnect:  %{time_appconnect}s\n
    time_pretransfer:  %{time_pretransfer}s\n
       time_redirect:  %{time_redirect}s\n
  time_starttransfer:  %{time_starttransfer}s\n
          time_total:  %{time_total}s\n

I used this command to test the first URL:

curl -w @curl-format.txt -s -o output.html https://solo-fsw.shinyapps.io/lavaangui/

I ran the command twice. Notice the variation in time:

      time_namelookup:  0.087324s
         time_connect:  0.194781s
      time_appconnect:  0.414386s
     time_pretransfer:  0.414526s
        time_redirect:  0.000000s
   time_starttransfer:  4.321403s
           time_total:  4.323718s

      time_namelookup:  0.005384s
         time_connect:  0.084560s
      time_appconnect:  0.246017s
     time_pretransfer:  0.246136s
        time_redirect:  0.000000s
   time_starttransfer:  0.340210s
           time_total:  0.340989s

Then I tested the second URL:

curl -w @curl-format.txt -s -o output.html http://lavaangui.org/

The variation this time is not so severe:

     time_namelookup:  0.123519s
        time_connect:  0.187978s
     time_appconnect:  0.000000s
    time_pretransfer:  0.188123s
       time_redirect:  0.000000s
  time_starttransfer:  0.250556s
          time_total:  0.250624s

     time_namelookup:  0.005591s
        time_connect:  0.064566s
     time_appconnect:  0.000000s
    time_pretransfer:  0.064699s
       time_redirect:  0.000000s
  time_starttransfer:  0.135981s
          time_total:  0.136040s

There is about a 100ms difference in DNS name resolution, but that is normal. The time_starttransfer is the issue and that is your cold start time. Curl has connected to the service and is waiting for the first by of data.