Dynamic website vs Static website
Hadija Ausi
MSc Information Systems Management | Aspiring ICT Professional | Passionate About Data Protection, System Development, and Enhancing Organizational Efficiency
If you are trying to speed up your website, it's important to first know the difference between a dynamic website, and a static website. These are the two types of websites that currently exist on the Internet.
A quick break down would be that dynamic websites require more server resources, but provide more flexibility when it comes to updating them. While static websites are fast in nature, because they don't ask the server to do extra work, other than just handing off already completed files to the visitor.
Each one has its own advantages and disadvantages, and in this guide I'll discuss why you might want to use one over the other in your specific case.
Dynamic websites
Probably the most frequently used type of website today would be a dynamic website. In order to be dynamic, the website runs a server-side scripting language to dynamically create the page being requested by each visitor.
Pretty much any CMS (Content Management System) that you run on a server, such as WordPress, Joomla, or Drupal and many others, will create a dynamic website.
This type of software uses scripts to connect to databases that pull in info to piece together a complete website. This gives the user a front-end to easily adjust some of the dynamic variables of the site.
Static websites save on resources
While there are seemingly a lot of benefits to having a dynamic website, it can also cause your website to load slowly if you're trying to dynamically load up too much at once.
Also if you have one particular page getting requested again and again, and nothing is changing on the page itself, all that dynamic creation of that page over and over can lead to resource usage problems on the server.
Let's say for instance my page1.php page from the dynamic website examples above is getting requested 1,000 times an hour because it got really popular all of the sudden.
Each time that page is requested, a PHP script has to dynamically fill in the variables for $title and $body, and if the average CPU time, or time that the server has to run that script for, is equal to 0.2 CPU seconds then that means that for 1,000 requests it would take about 200 CPU seconds of computing time to handle all the requests.
If that page keeps getting hit steadily with that level of traffic, it kinda seems like a waste of computing power to just keep creating the same page again and again. This is where a static website can easily take the advantage over a dynamic website.
With a static website, you simply have the raw HTML that creates your page in a file. A visitor's web-browser will just directly request that page, and all the server has to due is hand it off as is.
Dynamic vs Static website
Depending on your needs, either a dynamic website or a static website could do just fine. The best of both worlds would be accomplished by using a cache or caching plugin for your dynamic site, so that frequently accessed dynamic pages can be automatically turned into static pages.
A great example of this flexibility would be using a WordPress cache plugin. These can easily turn your WordPress dynamic website, into a site that still handles dynamic requests, but at the same time saves on resources by still serving up static pages when dynamic ones aren't needed.
More from the source: https://www.inmotionhosting.com/support/website/slow-websites/dynamic-website-vs-static-website
Software Implementation Consultant | Operational Support Specialist | Data Quality Improvement | Training & Development Enthusiast
7 年good to see this initiatives, contact me as you read.