Do I really need Server Side Templating?

  • Jonathan Hoguet, 2015
  • jhoguet@gmail.com
  • @jhoguet
  • Dealer.com

What is?

  • Server Side Templating?
  • Client Side Templating?
  • Modern Web App
  • Static Web App

Albert Einstein

“The more I learn, the more I realize how much I don't know.”

Do I need Server Side Templating?

A little about me...

I love to build web apps

most passionate about

  • web app architecture
  • REST
  • agile

Experience server side templating

  • ASP.net WebForms (MCPD)
  • ASP.net MVC (early adopter)
  • Grails

Experience client side templating

  • KnockoutJS
  • AngularJS
  • a lil React / Flux

Experience with less server side templating

  • MWG eCommerce
  • Dealer.com LOB Platform (Line of Business)

lovin-cats.com

Of course I need Server Side Templating

  • I have dynamic content
  • I have to authorize my content
  • I need my app to be fast

I need Server Side Templating to serve my dynamic content

First Cats | Server Side Templating

Next Cats | Server Side Templating

First Cats | Client Side Templating

Next Cats | Client Side Templating

I need apis to serve my dynamic content

Of course I need Server Side Templating

  • I have dynamic content
  • I have to authorize my content
  • I need my app to be fast

I need server side templating to authorize users to sensitive content

Typical Cookie Session

Cookie Session w/out Server Side Templating

OAuth Session w/out Server Side Templating

RFC 7519 JSON Web Token

JWT Session w/out Server Side Templating

I need a token so that my apis can authorize users to my sensitive content

Of course I need Server Side Templating

  • I have dynamic content
  • I have to authorize my content
  • I need my app to be fast

I need Server Side Templating so that time to first cat is fast

Optimizing Server Side Templating

  • Optimize initial html down to 300ms (hard / brittle)
  • flush early (hard)
  • Make response cacheable (easy / brittle)

Optimizing Client Side Templating

  • Optimize initial html to 25ms (easy)
  • Optimize initial json to 300ms (moderate)
  • Make initial json cacheable (easy)
  • Optimize initial render to less than 100ms (moderate)
  • move expensive computation to server (new JSON) (easy)

Optimizing Either Way

  • inline critical scripts and styles
  • progressively load secondary content (async ui)
  • progressively cache bust
  • pre-fetch

the numbers...

Brett Slatkin, Google

Jan 2015

“...if your first load is less than 1,000 cats of complexity, client-side rendering is just as fast as server-side rendering on desktop and mobile...”

But what about more than 1k cats

Server: first paint is 3x faster (10K cats)

Client: last paint is 2x faster (10K cats)

in one JSON call on one call stack

But users don't have hot caches...

Chrome Team 2012: median user has a 45% cache hit rate

70% do not have full cache

But mobile...

  • how much can you possibly need to render?
  • that I can touch with my finger
  • that is more complex than minecraft
  • which works on 4+ year old phones (2011)

I can make client side fast
and I need to anyway

Of course I need Server Side Templating
  • I have dynamic content
  • I have to authorize my content
  • I need my app to be fast
Of course I need Server Side Templating
  • I have dynamic content
  • I have to authorize my content
  • I need my app to be fast

Building moderns web apps is
simpler and easier
without Server Side Templating

html that is rendered in one language, runtime, and host

is simpler than

html that is rendered by multiple languages, multiple runtimes, and multiple hosts

client side templating

is simpler than

client side templating and server side templating

This is a good thing

  • easier to host html, css, js
  • cheaper to host
  • easier to release
  • easier to hire for html, css, js devs
  • can use the right framework instead of THE framework

Now What?

  • Use less server side templating
  • Try out a SaaS
  • Come chat with me about SPAR at Dealer.com