Archived from the Transloadit support forum. Originally posted on June 5, 2011; details may be outdated, see our docs for current behavior. Original thread
It seems that jquery.transloadit2.js is being served from Amazon, but not cloudfront? That means it’s being served from US servers no matter where you’re requesting it from. For me, a European customer, it’s adding about 100 ms just in latency as it has to travel across ‘the pond’. This averages out to about 200ms for every request. For a single js file of 6.4kb, that’s quite disproportionate.
Is there a particular reason for not letting Amazon’s cdn take care of it?
I think the main reason we decided to go against cloudfront for distributing our jquery plugin is that cloudfront does not let you use your own https certificate, thous ruling out using a cname for the domain, see:
The other reason was that we assumed that the upload page is not as performance critical as other areas. Or in other words, if you load the plugin in the background (by putting it at the end of your body), the user experience is not impacted unless somebody manages to select and submit a file in < 200ms.
That being said, we’d certainly love to host the plugin on a CDN. But as things look right now, we’ll probably wait for Amazon to catch up.
Let me know if that makes sense / is good enough for now.
--fg
PS: Alternatively you could self-host the plugin, but this means that you’re responsible for keeping it updated - it’s certainly not the preferred way.
Ouch, that’s quite surprising to hear, and reading up on it makes me cringe at how long it’s taken them to implement the basics.
I’ve hosted it myself in the past, but ran into issues when it got updated without me noticing it, so I’m trying to avoid that.
You’re right that in most situations, it is not really a big deal though. However, with IE not allowing multiple file uploads, some of our customers have to upload all their images one by one. So, if they upload 50 images, that comes down to an extra 10 seconds, just for the js file. And since most of the added time is pure latency, that means even a cached version doesn’t help.
That being said, I’m quite happy to hold out for a solution, I mainly wanted to know your thoughts on the matter.
It is cached, but it’s checking for modification, this means having to talk to the server in the US, adding anything between 100 to 500 ms (yes it varies a lot).
GET jquery.transloadit2.js 304 Not Modified 105ms
The problem ultimately lies with the “max-age” header I believe:
Cache-Control max-age=0
This header means it will always revalidate against the server for modification. Setting max-age to an hour would validate against the server on the first request and get the file straight from disk for the next 60 minutes. Without checking for modification.
However, if any breaking changes are introduced, you risk having some users with a non-functioning js file.