I did an experiment and installed the same application on Google Cloud Platform, with the same database, and the same buckets (for images) on 2 different locations: us-central and europe-west. However, the loading times are hugely different. I am in Spain, and surprisingly the us-central one is much faster.
Application info:
SQL (both the same):
Storage (Google Buckets):
Loading times (after some refreshes for caching purposes):
The one in europe-west is so slow it is not practical. Why this difference? Or what did I configure wrong here? Is there anything else that I should look out for in the configuration to make europe-west run as fast as us-central?
OK, so talking to Google Support, I found out that there indeed is a loading difference, but it is not due to the servers being in any way slower.
The difference came from a call to the CloudStorageTools API, namely CloudStorageTools.getImageServingUrl(). Accessing the API from Europe was ~100ms to ~200ms slower than from US servers for each call. As I was making more or less 15 calls on average, this led to a noticeable difference in loading times per page.
The solution in my case was to cache the call to CloudStorageTools.getImageServingUrl() on image creation and save the result in the database. Then on displaying the images, just load the Url from the database and avoid the call to the API each time.
Google Support confirmed the difference in the CloudStorageTools API access times between Europe and US was expected behaviour, although undocumented.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With