Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

The Resurgence of Static

DZone's Guide to

The Resurgence of Static

The combination of the speed, performance, and security of static sites, mixed with the functionalities of dynamic sites, has started a new trend in web development.

· Web Dev Zone
Free Resource

Tips, tricks and tools for creating your own data-driven app, brought to you in partnership with Qlik.

Static sites have been around as long as the web, but today’s static sites serve a very different purpose than the unsophisticated HTML and image files that you used to FTP to your web server. Making your site (or portions of your site) static can have a tremendous upside and can guarantee speed, scalability, and security. Combine these benefits with the power of modern JavaScript app frameworks, REST endpoints, and Content-as-a-Service capabilities, and you have a refreshing choice for developers who want full control of their web frameworks and are fighting to minimize every last millisecond of loading time.

The Move From Static to Dynamic

We saw the emergence of dynamic when the constraints of static failed to meet the new demands of the web. They were hard to update and did not allow for dynamic navigation and user interactivity. In order to maintain timely and relevant websites, companies started to store their content in databases and dynamically deliver it to their site visitors. This spurred the growth of content management systems (CMS), which allowed for the managing of content and files that could be dynamically displayed on different pages and areas of a website. A CMS meant that a content editor could update the content of a page or site and their changes would be reflected instantly, without having to use FTP or know HTML. These dynamic publishing platforms unleashed the tidal wave of online publishing that has changed our world and how we consume information.

And Back to Static Again

However, due to constraints, such as the amount of server horsepower needed to dynamically publish, the amount of system admins needed to run a large scale production site, security issues and more, we’ve seen static start to make a comeback.

This doesn’t mean we’ve gone back to plain HTML sites and gotten rid of the CMS completely, but as a development community, we’ve come to a happy medium that brings together the database needs of dynamic with the advantages of static - speed, scalability, security, and performance.

Benefits of Static

Caching and Performance

Dynamic sites began to show an impact on performance due to the complexity of dynamic code running on a server for every request, which slowed down the site speed. To combat performance issues, developers depend on the caching of a site. Caching tends to be tricky and even when done well, a cached, dynamic site is almost always significantly slower than a static site. This is because, in a dynamic site, changes to a comment, global website setting, tag, category, or other content need to constantly be updated in the cache. However, with static, a URL will show the same HTML to any site visitor until the corresponding file is updated. This is why static sites almost always show an increase in performance and uptime vs. dynamic sites.

Static Sites and Modern Browsers

When static sites first made their debut, the web browser was also in its infancy. Today’s browser, however, is much more mature and is capable of running full-fledged web applications on its own. That’s a huge benefit to static sites as it makes it easier to utilize web apps for comments on articles, social sharing of content, site search, and more.

Static Sites and CDNs

Unlike dynamic sites which may require some workarounds, static sites can easily be deployed directly to a CDN, like Amazon S3. This is an area where dotCMS shines, as it allows users to get a static representation of their site and push publish it to Amazon S3 - speeding up the delivery of content for websites with high traffic and global reach.

Finding the Happy Medium

Before you jump straight into a static site, consider the business advantages and disadvantages of going static and what technology is best to use to generate your site.

Speed

As mentioned above, static sites are fast. There are no database queries to run, no templating, and no processing on every request, which speeds the site up significantly.

Security

When you run a static site, there are no software patch releases or version updates to worry about. While there are ways to “attack” a static site, they have nothing to do with your CMS software - everything is as safe as you can architect it!

Optimized Version Control - Hello Retention and Backups!

Whether it’s for disaster recovery or file management, version control within a static site is simple and effective.

Unlimited Scalability

A huge influx of traffic to a website can bog down the site, and can even render it almost useless. Static is better prepared to handle large amounts of web traffic as it consumes a very small amount of server resources.

Real-time Content Can Be Tricky

While static is great for speed and performance, it can make real-time content a tricky task. While some sites have found workarounds with JavaScript and other plugins, if your site depends heavily on real-time content, static may not be the right solution.

Static in Today’s World

In the end, static sites are not right for every business. Some still rely on the real-time aspect of dynamic and its ability to immediately show template and other content changes. For these businesses, static doesn’t make sense. For others, however, static has come a long way from the beginning of the web and improves the speed, security, scalability, and performance of a website.

Explore data-driven apps with less coding and query writing, brought to you in partnership with Qlik.

Topics:
static site ,cms ,web dev ,web security ,web performance

Published at DZone with permission of Alexandra Barcelona. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}