2

Lets say that I want to develop a website where all pages will be dynamically generated and 'printed' into static HTML files. I will then serve these HTML files from a container (such as an Amazon EC2 instance) that has no server side languages or database running in the background.

I will make a script to have the HTML files automatically refreshed at a set period.

My reasons for doing this would be to decouple the link between traffic to my website and server load (in other words, so my website can scale without any need for additional CPU / RAM on the server).

Here are some benefits that i expect from doing it this way

  • I want a cheap way to host a high traffic website that can accommodate large spikes in traffic (from viral content)
  • I want it to load as fast as possible -- without any delay from generating content dynamically for each visitor.

My Questions are as follows:

  • What are the downsides of structuring a website this way?
  • Is this flat out a bad idea?
  • What is this type of architecture called?

My Background

I have made a few simple web apps using PHP / mySQL and am familiar with javascript, hmtl, css--- basically a new / amateur web developer.

2

What are the downsides of structuring a website this way?

The main problem is dealing with pages that change per user. For example, your website has an user system, so for each user that logs in, would you then generate a new page and cache it?

Is this flat out a bad idea?

No, it's an excellent idea. As a matter of fact, static content is often served like this.

What is this type of architecture called?

I don't think it has a specific name.


There's some things I would like to recommend to you.

I want a cheap way to host a high traffic website that can accommodate large spikes in traffic (from viral content)

First of all, what do you define as high traffic? My $10 a month VPS can serve thousands of pages per second on just a single of core, running nginx.

See if you can't get around with a caching solution first. There are plenty available or you could roll your own specific to what you need. Making a basic one is generally pretty simple and it gives you control over what pages you want cached and which you don't.

1

What are the downsides of structuring a website this way?

Obviously, the downside is inability to do typical "dynamic" stuff like CRUD with forms. Of course, you can still use some 3rd party API for contact forms and comments, like Disqus or Muut.

Is this flat out a bad idea?

No, it is an excellent solution for static sites. It is indeed very fast, yet very limited to its' use case.

Take a look at Jekyll (and sites using it) and similar static site generators. It is pretty easy to start with, there are lots of tutorials. GitHub pages is one of free hosting platforms for static sites, integrated with Jekyll. You can set up custom domain, so it should fit your needs. I'm not saying it's the best, it's just the one I use.

What is this type of architecture called?

"Static website/page generator". It is not an architectural pattern name, just the category of software. I don't think there is any specific term other than just "static website".

I will make a script to have the HTML files automatically refreshed at a set period.

Just push updated content when you change something, that is more efficient.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.