SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jun 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Speeding up loading of file from another site

    Hi,
    I have a JS file on site A which reads a few parameters from a short text file on site B.
    The call is made through:
    Code:
    var theFile	= getFile("http://www.mySiteB.com/theTextFile.txt");
    var lines	= theFile.split("\n");
    var var1  	= lines[1];
    var var2  	= lines[2];
    var var3  	= lines[3];
    The problem is that this takes a long time. I would really like to speed this up. For example - I thought of using a direct IP address, so that there won't be any need a DNS server (using
    Code:
    var theFile	= getFile("http://123.45.67.89/~myUsername/mySiteB/theTextFile.txt");
    ) but this would expose me to hackers as it would make my Hostgator username visible. According to HG support the above format is the only way to access my subsite via direct IP.

    Any ideas on how to speed this up, either by bypassing DNS (but without exposing username) or by offering another way of reading data across sites?

    This is really important for me!
    THANK YOU!!!

  2. #2
    SitePoint Addict Phidev's Avatar
    Join Date
    Oct 2008
    Location
    Texas
    Posts
    204
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you cache the contents of the file into your own server? or are the values created dynamically every time?

    If you can cache it then save a copy locally and read that copy instead, and just refresh as you think necessary, that way the load will only be painful for one user and not all of them

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2010
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Who says you'd get any speedup if you bypassed DNS lookup? Have you even tried it so you can safely assume it's the DNS lookup that makes it slow?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •