Do I really need Server Side Templating? – What is? – A little about me...



Do I really need Server Side Templating? – What is? – A little about me...

0 0


why-server-side-templating


On Github jhoguet / why-server-side-templating

Do I really need Server Side Templating?

  • Jonathan Hoguet, 2015
  • jhoguet@gmail.com
  • @jhoguet
  • Dealer.com
  • thanks
  • excited
  • journey

What is?

  • Server Side Templating?
  • Client Side Templating?
  • Modern Web App
  • Static Web App
  • define terms
  • more focused... initial html
  • runtime generation state to html on the server
  • who does..
  • transition - hard, ted talks over 9 months ago

Albert Einstein

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

Do I need Server Side Templating?

  • this isn't about which client side framework
  • this isn't going to include code samples
  • this isn't saying you can't or shouldn't use server side templating
  • not everyone is going to agree - but that likely means there is something worth talking about

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

no code - but you'll appreciate it b/c we'll cover more concepts consider adding some code samples...

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

  • point is we can

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

  • blasphmey
  • remember einstein
  • what needs protection
  • transition - we can do better

OAuth Session w/out Server Side Templating

RFC 7519 JSON Web Token

  • representing claims securely between two parties

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)
  • can't do anything until that html is in the browser

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)
  • initial html in 25ms, lots we can do sooner

akamai 25ms - http://www.quora.com/Which-is-better-Amazon-S3-or-Akamai

-Rendering 1000 list iterms

https://docs.google.com/spreadsheets/d/1AMCU14-1bGr_WFhwqNu3LQyTlJ7yWOF_qoLEvS-YweU/pubhtml?gid=0&single=true

Optimizing Either Way

  • inline critical scripts and styles
  • progressively load secondary content (async ui)
  • progressively cache bust
  • pre-fetch
  • go through slide fast
  • not relevant until we have the html in the browser

the numbers...

  • original intent / research
  • Brett Slatikin, Rant

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

see http://www.onebigfluke.com/2015/01/experimentally-verified-why-client-side.html see also http://blog.alexmaccaw.com/time-to-first-tweet

But users don't have hot caches...

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

70% do not have full cache

don't overlook the value of intermediate caching do users have hot caches (yes according to the chrome team) [source](https://plus.google.com/+WilliamChanPanda/posts/XRekvZgdnBb) - 70% of users do not have full caches (so it isn't usually overflown) [source](https://plus.google.com/+WilliamChanPanda/posts/XRekvZgdnBb)

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)
Brett Slatkin tested on mobile... couldn't find any good data ... cop out

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
Do I really need Server Side Templating? Jonathan Hoguet, 2015 jhoguet@gmail.com @jhoguet Dealer.com thanks excited journey