FLUXparticle Text Logo

Software you can enjoy

FLUXparticle > StaticForm

How I made my Webseite 10 times faster

I like to use the Google AppEngine for my websites. It supports Java, GoLang and Python. So I can use whatever web framework I am in the mood for and I can program whatever fancy functionality I need. Also with the Google Datastore it was one of the most powerful databases on the planet. And the best of it… It has a free tier. So I don't have to spend a dime until my business takes off.

But when Google AppEngine switched to Java 8 there was a big problem. Suddenly it would take up to 7 seconds to spin up an instance. 7 seconds that visitors of my website would need to wait until they would even see the server responded. Most people are gone after 1 second of load time. I didn't even want to send traffic to my page because I knew people wouldn't reach it. In theory the free tier is designed so that I could run one instance 24/7 and avoid this problem. But in practice this doesn't work and the tier would be no longer free.

This is a pie chart of the response times of my website with Java 8:

pie chart before

The blue and violet requests were not successful and the one with 50 seconds is the one that created this chart. Then there are many requests between 3 and 7 seconds. Those are the ones where the instance had to be started. But even the requests below that are taking up to 700 milliseconds because the page was to be rendered by Java.

But this is mostly a static web page. There is actually no need to render the same page on every request. That's why I pre-rendered the page and used static file hosting which doesn't need to spin up an instance to deliver a file. And this is how the same diagram looks after the change:

pie chart after

As you can see, not only are the several seconds long spin up requests gone but also none of the successful requests took longer than 100 milliseconds. That's the same time the previous setup took on average if you don't count the long spin up requests.

If you calculate the average response time of the static variant, it is only 10 milliseconds which is not only 10 times faster but the page opens in an instance as you may have noticed when loading this page.

The only interactive things on my website are the feedback forms. So I outsourced those and built a service in GoLang to process them. It uses jQuery to load the form which is also a simple but effective spam protection that doesn't require a captcha. So normal users don't even see a difference.

I made this service available through RapidAPI so if this sounds interesting for you and you want to speed up your website to improve your user experience and your Google ranking, contact me through the feedback form and we will talk about how this could work for you. Don't forget to enter your email address so I can contact you.