Thursday, April 19, 2012

how to speed up website loading for opposite side of planet


I am currently running a small piece of PHP software which is being accessed by two groups of people, one group in China, the other in Ireland. The server is hosted in Ireland, and no doubt pages load between 0.3 and 0.8 seconds.



The Chinese people are recording times of between 3.0 seconds and 10 seconds.



I have run speed tests and the Chinese have an internet connection of 1.5 mbit (testing server in Ireland) and a ping of 750ms.



So far, to improve load time I have redone a lot of the MySQL database interaction to maximize efficiency, but this did not help. I presume this only slightly reduces server process time but has little effect on page download time.



I was thinking, could I get hosting in China, and use this as a gateway for the system in Ireland. Surely the latency and download speed between this Chinese server would be better than the average person.. And the average persons requests would've re-routed through here.



Does this sound at all feasible? Or does anyone else have suggestions in relation to this?


Source: Tips4all

6 comments:

  1. Your biggest problem is the latency. If you can minimize the http requests, you should see large gains.

    But, it's probably easier to just the buy services of a content delivery network and move all your static files to them, making sure they have well connected servers in china and ireland. I think this is easier than redesigning your website.

    The cheapest bang for the buck would come from sending suitable http headers to indicate to the web browsers that they don't need to constantly check with your servers for freshness validation(don't do conditional http requests). If you can do this for all external webpage objects(images, css, js etc...) then the first page load will still take 10 seconds or whatever, but subsequent page loads should be very close to your irish visitors. THis is just a matter of webserver configuration. Heres a tutorial if needed. To be honest, sending cache friendly headers is always a good idea, this is how you get those snappy responsive websites we all love.

    ReplyDelete
  2. First of Follow best practices to speed up you website.Then also check YSlow to measure your site's speed and check what you can do to improve performance.
    I think that changing servers won't give you better responce time.
    I think you should worry first for optimization and then check for a good and powerful hosting company and hosting plan.

    Cheers

    ReplyDelete
  3. Hosting/mirroring in China is definitely the way to go. It'll be faster for the people there and more reliable. Ideally you would also have it hosted in Ireland too, and have some kind of load balancing in place.

    ReplyDelete
  4. I would definitely mirror your site to a server somewhere in asia. You already did some performance improvements that didn't result in much better results from China so I assume the network latency is causing most of the load times.

    You can deploy your website to one of the cloud services. Amazon EC2 instances are available in Singapore and Tokyo for example. Or you can deploy to a "regular" web hoster in China.

    If you have to deliver mostly static files, check for a Content Distribution Network (CDN) service.

    ReplyDelete
  5. To speed up the load time, you may consider hosting your static files (images, css, javascript, documents) to a CDN (Content Delivery Network). CDNs work by hosting your files in multiple nodes around the world. Once it receives a request, the closest server to the visitor will serve the file - thus reducing latency.

    You may want to try CloudFlare (http://cloudflare.com), it's a free product that serves as a reverse proxy and CDN of your website. Instead of the user accessing the site directly, CloudFlare will be the one to access your site and optimize it for delivery to the visitor.

    ReplyDelete
  6. Move to the cloud.

    http://en.wikipedia.org/wiki/Cloud_computing

    ReplyDelete