Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

StripeCon 2019 talk - Serverless and Silverstripe

24 views

Published on

Presentation slides from StripeCon 2019. Finding a way to shoehorn SilverStripe into a Serverless environment.

Published in: Internet
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

StripeCon 2019 talk - Serverless and Silverstripe

  1. 1. ...a lazy developer’s guide Tim Burt Presented by Dorset Digital Silverstripe in the Serverless Age
  2. 2. Today's Topics 1.What this isn’t 2. What’s the point then? 3. Right, what’s all this ‘Serverless’ nonsense? 4. ...so how can I use it? 5. Does it work? 6. What next? 7. Questions?
  3. 3. What this isn’t
  4. 4. What this isn’t •This is not a cure-all solution to your hosting needs •This is not an beautifully engineered solution! •Not a replacement for your existing hosting systems (yet) – especially on highly dynamic / interactive sites •Not a live demo ;-)
  5. 5. What’s the point then?
  6. 6. What’s the point? •Make a quicker, more resilient and scalable hosting environment •Create a Proof of Concept •Start thinking about site delivery in a different way •Take advantage of existing technologies •Do as little work as possible :-) •Don’t spend a fortune on hosting! •Make something that can be retro-fitted to an existing site
  7. 7. Right, what’s all this ‘Serverless’ nonsense?
  8. 8. Familiar models
  9. 9. Simple server model
  10. 10. Add some redundancy
  11. 11. Go big – deploy globally
  12. 12. A note about DNS •DNS is the key •More specifically, ‘anycast’ DNS is the key
  13. 13. Enough already! What’s this got to do with “Serverless”?
  14. 14. This:
  15. 15. ...so how can I use it?
  16. 16. The steps to (almost) Serverless
  17. 17. Step 1: Move your assets •With Silverstripe CMS 4, assets can be stored in a remote location •A single, common store for site content • https://github.com/silverstripe/silverstripe-s3
  18. 18. Step 2: Improve distribution •Add a CDN such as Cloudfront, StackPath, etc. •Reduces latency, improves performance • https://github.com/DorsetDigital/silverstripe-url-rewriter Simple middleware to replace S3 URLs with CDN versions, eg: https://s3.eu-west-2.amazonaws.com/stripecon.dorset-digital.net/public/image.jpg BECOMES https://d1bj1kucw3tvqr.cloudfront.net/public/image.jpg
  19. 19. Step 3: Site resources •Serve site resources (CSS, JS, etc.) from a CDN such as Cloudfront, StackPath, etc. •Reduces latency, improves performance • https://github.com/DorsetDigital/silverstripe-cdnrewrite Simple middleware to replace site asset URLs with CDN versions, eg: https://www.example.com/_resources/css/styles.css BECOMES https://cdn.example.com/_resources/css/styles.css
  20. 20. Step 4: Static publishing •Big performance gains •Fine for non-transactional pages • https://github.com/silverstripe/silverstripe-staticpublishqueue
  21. 21. Nearly there! (I promise)
  22. 22. Step 5: Living on the edge •Deal with web requests at the edge locations •Most traffic never reaches the origin server •Fast responses
  23. 23. Step 5: Workers •Cloudflare Technology for running edge code •Runs V8 engine •Use Rust, Typescript •Can respond to specific URL patterns •Low cost •Can contain conditional logic, can modify requests and responses
  24. 24. Step 5: Workers KV •Cloudflare Technology for storing data in their network •Simple Key→Value storage •Keys up to 512 Bytes •Values up to 2MB •Can be given TTL for automatic expiry
  25. 25. Step 5: Our edge worker addEventListener('fetch', event => { event.respondWith(handleRequest(event.request)) }); async function handleRequest(request) { request = new Request(request); let requestedURL = new URL(request.url); let urlPath = trimByChar(requestedURL.pathname, '/'); if (urlPath === '/') { urlPath = 'index' } const kvdata = await kvstore.get(urlPath); if (kvdata !== null) { var requestTimestamp = new Date().toUTCString(); var myHeaders = new Headers({ 'Content-Type': 'text/html; charset=utf-8', 'vary': 'X-Forwarded-Protocol,Accept-Encoding', 'server': 'Edge Hosting', 'date': requestTimestamp, 'x-worker-debug': 'KV Active' }); return new Response(kvdata, {headers: myHeaders}) } else { let originResponse = await fetch(request); let response = new Response(originResponse.body, originResponse); response.headers.set('x-worker-debug', 'Origin Active'); response.headers.set('x-path', urlPath); return response } } function trimByChar(string, character) { const first = [...string].findIndex(char => char !== character); const last = [...string].reverse().findIndex(char => char !== character); return string.substring(first, string.length - last); }
  26. 26. Step 5: Pushing the data •We need to push the page data to our KV store • https://github.com/DorsetDigital/silverstripe-edgepublisher A publishing backend for the Silverstripe staticpublishqueue module Utilises the existing processes for the selection, creation and storing of the statically generated pages. Can be used to interface with Cloudflare KV or AWS DynamoDB Deals with the creation of KV namespaces via the Cloudflare API Sends data directly to the edge data store when pages are published, deleted, etc.
  27. 27. Does it work?
  28. 28. Yes.. so far! •This is an alternative approach to distributed hosting. •Costs compared to a fully redundant, geographically distributed hosting system on Google Compute or AWS are extremely favourable! •Massively scalable, highly resilient •More controllable than relying on HTTP proxies / caching
  29. 29. In the real world.. (sort of)
  30. 30. https://stripecon.dorset-digital.net
  31. 31. https://stripecon.dorset-digital.net
  32. 32. https://stripecon.dorset-digital.net
  33. 33. Performance tests • On a domestic broadband connection, response time of the first request (TTFB) usually between 100-200ms (vs. 1-2 seconds on the shared host) • Repeat requests from same node TTFB generally under 50ms ! • Lightweight pages fully load very fast (even with browser caches disabled)
  34. 34. Performance tests •Image-heavy pages are almost as fast, once the CDN (Cloudfront) has the images in it’s edge caches
  35. 35. Performance tests •PageSpeed (mobile):
  36. 36. Performance tests •PageSpeed (Desktop):
  37. 37. What next?
  38. 38. References •Test site: https://stripecon.dorset-digital.net •V8: https://v8.dev •Cloudflare Workers: https://developers.cloudflare.com/workers/ •AWS Lambda Edge: https://aws.amazon.com/lambda/edge/
  39. 39. Questions? Thanks for listening! tim@dorset-digital.net @DorsetDigital on Slack / Community forum Contact:

×