SlideShare uma empresa Scribd logo
1 de 29
AD113: Speed Up Your Applications
w/ Nginx and PageSpeed
Eric McCormick
For Starters...
Thanks for coming!
Agenda
• Who’s Talking?
• Who is this for?
• What are you selling?
• Where can I use this thingamajig?
• When can I adopt it?
• Why does this benefit me?
• How should I get on this bus to crazy town?
• Demos
Who’s Talking?
Eric McCormick
Twitter: @edm00se
Blog: edm00se.io
XPages developer since ‘11
Java developer on and off since ‘02
Experimented with WebSphere and DB2
in college
Who’s Talking?... pt.2
What Is My Goal?
1. A harmonious development environment for
myself and any development staff at my
company
2. A unified theory practice of development, for
consistent cross-platform and cross-app
development behavior
3. Making all application logic and data
consistently accessible across separate, but
organic, systems
4. Making contracted development work more
easily performed
5. Automating everything I can
For my users: applications that “work well” (respond
quickly, easy to use, don’t hang around for lunch).
I Want It All
Who’s This For?
Developers!
Who’s This For?... pt.2
Specifically, web developers.
… specifically web developers that care about / have access to / can bribe an admin
for access to the full application stack
… aka web application developers
.... web app devs that want blazing fast application speed for their users, peace and
harmony, and for dogs and cats to live together.
Who’s This For?... pt.3
What you should know already:
• fundamentals of web application and XPages “stack” development
• differences of between the runtime generated markup of HTML (created by a our JEE
environment) and static HTML assets (and CSS, JS, images)
What you should get out of this:
• an understanding of how a couple excellent freely available tools can make your applications
more performant for your users
• hand off TLS/SSL cert. handling from your app server (Domino)
• provide finer grain (and automated) control over static web resources and their:
caching (what, how long, no-cache paths)
rewrites (concatenation)
compression
What you won’t get out of this:
• how to grow a beard
• many other things that go without saying
What Are You Selling?
The same as usual...
Better Web Applications!
What Are You Selling?... pt.2
What is it all about?
• Segregated application design/development is good for my users, my company, and myself (and the
other developers that we interact with)
• I blogged about development with HttpServlets in XPages (NSF-local ones, without OSGi plugins)
• I even did a Notes in 9 video on the subject (a second one bridging the gap between back-end and
front-end development should be out soon)
What does it all mean?
• I have more (than “average” XPages application) static web assets
not just CSS and JS files, but even HTML files (who knew!)
• Just as we set an HTTP API (e.g.- RESTful API endpoint) to Cache-Control: No Cache, etc., we can
cache our static assets in the user’s browser for faster loading times
for more complex setups you can even host the static assets on a dedicated server separate from a
Domino/XPages server, for faster loading times yet (and map in an Domino/XPages API assets
as an api route, e.g.- /xsp, /api, etc.)
this is not covered here (watch my blog)
What Are You Selling?... pt.3
How can I achieve all this developer + user bliss?
3 Pieces:
1. Segregated Application Design (aka- have static assets to cache)
2. Reverse Proxy (to forward our API requests without cache, respond with cached static assets)
3. Tweak, fiddle, and “enhance”
Google PageSpeed!
Wait, What?
Google PageSpeed Tools:
https://developers.google.com/speed/pagespeed/
“The PageSpeed tools analyze and optimize your site following web best practices.”
Flavors:
• Nginx or Apache webserver modules (or IIS or Apache Traffic Server ports)
relies on the PageSpeed Optimisation Library (PSOL)
• PageSpeed Insights (online, freely available, assesses both mobile and desktop versions w/ score)
demo volunteer?
• PageSpeed Chrome Extension (great for non-public use cases, lots of the same info as Insights)
demo local
• PageSpeed Service (commercially provided by Google, all PageSpeed modules, filters, infrastructure)
PageSpeed Service deactivated 03-August-2015
DEMO: PageSpeed Insights
(online, freely available, assesses both mobile and desktop
versions w/ score)
demo volunteer?
PageSpeed Insights
DEMO: PageSpeed Chrome Extension
(great for non-public use cases, lots of the same info as
Insights; also PSI tool, installable via npm)
PageSpeed Chrome Extension
Where Can I Use This Thingamajig?
In front of your application server
(it’s a reverse proxy, that’s where they live)
preferably on the same “box” (it doesn’t have to be, but
strongly advised).
is pronounced engine X.
When Can I Adopt It?
As soon as you (or a sufficiently bribed admin) can run the
install and do the necessary config (which I outline and demo
in the “how”).
Why Does This Benefit Me?
In your well structured app (you amazing developer), you now have static assets which are
fully cacheable; or not, it’s all configurable, like a choose your own adventure app server.
Your user’s application performance will only increase due to the faster responses.
You can now manage, off of your application server (Domino):
• cache control
• Gzip compression
• HTTPS/SSL/TLS certificates
• authentication (see Jesse Gallagher’s blog posts on “arbitrary authentication”, etc. with
Nginx)
Side benefit: if you’re addicted to fast apps, you’ve now opened the door to forward the
API calls mapped to the Domino/app server and host the purely static assets off of Nginx (or
Apache) for even faster applications!
One Ticket to Crazy Town Please
How do we do this? You guessed it, with Nginx + PageSpeed module!
PageSpeed module is available for:
• Apache -binary or
source builds for Debian/Ubuntu and CentOS
• Nginx, *nix only, no Windows :’-( -source builds only for Debian/Ubuntu
and CentOS
• IISpeed (port), https://www.iispeed.com/
With Nginx, you must build Nginx from source specifically configured with PageSpeed support (aka- we’re
hooking in deep).
Crazy Train… pt.2
Follow the Google PageSpeed install and build from source instructions for Nginx
on *nix (I’m using an Ubuntu 64-bit 14.04.2 LTS distro).
What do the instructions say? The short, short version is:
• install a couple dependencies
• download the PageSpeed (and PSOL) sources
• download the Nginx source
• build PSOL, then the PageSpeed module
• configure Nginx w/ PageSpeed and build
My install put things into /usr/local/nginx/.
Crazy Train… pt.3
Once that’s all done… it’s alive!
Config Anatomy
Simple (simple) HTTP server config
/usr/local/nginx/conf/nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
Demo pt.1
Demo 1:
a Domi-faux server behind Nginx w/
reverse proxy
psst Eric, you want the nginx.conf_simpleProxy file you saved earlier
Demo pt.2
Demo 2:
a reverse proxied server w/ PageSpeed
doing all the PageSpeed things
psst Eric, you want the nginx.conf_PageSpeed-ified file you saved earlier
Demo pt.3
Demo 3:
a server w/ Nginx handling the
HTTPS/SSL cert
psst Eric, you want the nginx.conf_withSSL file you saved earlier
Note on HTTPS Certificates
Demo 3 has a self-signed TLS certificate, generated via openssl.
Want to go that route, try this tutorial from Digital Ocean, or this one for Apache.
Alternatives:
• paid for certificate (e.g.- from GoDaddy, etc.)
• no HTTPS
• letsencrypt.org
Let’s Encrypt:
• sponsored by EFF, Mozilla, and others
• free, automated, open source
• coming soon
How Soon?
• First certificate: Week of September 7, 2015
• General availability: Week of November 16, 2015
Note on HTTPS Certificates, pt.2
Using Let’s Encrypt.org:
• can automatically configure Apache 2.x
• support for Nginx 0.8.48+ mostly working (for auto config)
• can always just generate files into local directory (regardless of auto config)
• works through Let’s Encrypt’s own root and intermediate CAs
• configurable RSA key length
• can generate quickly
from a *nix (Ubuntu, Debian, Fedora, Centos 7, Mac OS X) environment
using Docker
instructions on starting use
• you can revoke a cert (one you’ve created for that server)
Once created, either drop it in place of your self-signed or (for the fearless, until general release) let it auto
configure for you.
Not a magic solution, still essentially an intermediate “self-signed” certificate, but better than having your
users click through the scary “untrusted” screens.
Some FAQs
• Why is PageSpeed not rewriting (combining) my CSS, JS, etc. files?
link because it’s not supposed to… if filters like collapse_whitespace are working, then...
“Your resources (images, css, javascript) aren't cacheable. If PageSpeed sees cache-control headers such as
nocache or private it will not rewrite the resources.”
We tell it to forget the Cache-Control and Expires headers with proxy_hide_headers.
• Why is Nginx failing to start as soon as I enable mod_pagespeed?
you most likely have forgotten to build either PageSpeed or PSOL from source, failed to
configure Nginx correctly, or malformed your conf syntax (use semi-colons at line ends!)
• What if I want the same config on a dev box, but want to see changes?
do as this SO answer suggests and use a .htaccess file with ModPageSpeed off
• But what’s it all cost?
not a thing, it’s all free (except for the infrastructure to run an Nginx instance; which isn’t much)
• Do I really need PageSpeed for this?
No! You can achieve most, if not all, that the ngx_pagespeed modules does without PageSpeed.
It just makes it easier.
Q&A
DEMO:
(time permitting)
A taste of a freely available, developer friendly way of doing a lot of this, without a DIY server.
Q&A
Questions?
Write better, faster, stronger apps! We have the ability.

Mais conteúdo relacionado

Mais procurados

High Performance JavaScript (CapitolJS 2011)
High Performance JavaScript (CapitolJS 2011)High Performance JavaScript (CapitolJS 2011)
High Performance JavaScript (CapitolJS 2011)
Nicholas Zakas
 
Browser Wars Episode 1: The Phantom Menace
Browser Wars Episode 1: The Phantom MenaceBrowser Wars Episode 1: The Phantom Menace
Browser Wars Episode 1: The Phantom Menace
Nicholas Zakas
 
Building Progressive Web Apps for Android and iOS
Building Progressive Web Apps for Android and iOSBuilding Progressive Web Apps for Android and iOS
Building Progressive Web Apps for Android and iOS
FITC
 

Mais procurados (20)

jQuery Conference Boston 2011 CouchApps
jQuery Conference Boston 2011 CouchAppsjQuery Conference Boston 2011 CouchApps
jQuery Conference Boston 2011 CouchApps
 
Hyperlight Websites - Chris Zacharias
Hyperlight Websites - Chris ZachariasHyperlight Websites - Chris Zacharias
Hyperlight Websites - Chris Zacharias
 
Don't make me wait! or Building High-Performance Web Applications
Don't make me wait! or Building High-Performance Web ApplicationsDon't make me wait! or Building High-Performance Web Applications
Don't make me wait! or Building High-Performance Web Applications
 
Node JS Express: Steps to Create Restful Web App
Node JS Express: Steps to Create Restful Web AppNode JS Express: Steps to Create Restful Web App
Node JS Express: Steps to Create Restful Web App
 
Disrupting the application eco system with progressive web applications
Disrupting the application eco system with progressive web applicationsDisrupting the application eco system with progressive web applications
Disrupting the application eco system with progressive web applications
 
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
 
jQuery 1.9 and 2.0 - Present and Future
jQuery 1.9 and 2.0 - Present and FuturejQuery 1.9 and 2.0 - Present and Future
jQuery 1.9 and 2.0 - Present and Future
 
High Performance JavaScript - jQuery Conference SF Bay Area 2010
High Performance JavaScript - jQuery Conference SF Bay Area 2010High Performance JavaScript - jQuery Conference SF Bay Area 2010
High Performance JavaScript - jQuery Conference SF Bay Area 2010
 
High Performance JavaScript (CapitolJS 2011)
High Performance JavaScript (CapitolJS 2011)High Performance JavaScript (CapitolJS 2011)
High Performance JavaScript (CapitolJS 2011)
 
Selenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web ApplicationsSelenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web Applications
 
Drupal, Android and iPhone
Drupal, Android and iPhoneDrupal, Android and iPhone
Drupal, Android and iPhone
 
High Performance JavaScript - WebDirections USA 2010
High Performance JavaScript - WebDirections USA 2010High Performance JavaScript - WebDirections USA 2010
High Performance JavaScript - WebDirections USA 2010
 
State of jQuery June 2013 - Portland
State of jQuery June 2013 - PortlandState of jQuery June 2013 - Portland
State of jQuery June 2013 - Portland
 
JavaScript front end performance optimizations
JavaScript front end performance optimizationsJavaScript front end performance optimizations
JavaScript front end performance optimizations
 
Browser Wars Episode 1: The Phantom Menace
Browser Wars Episode 1: The Phantom MenaceBrowser Wars Episode 1: The Phantom Menace
Browser Wars Episode 1: The Phantom Menace
 
High Performance JavaScript (YUIConf 2010)
High Performance JavaScript (YUIConf 2010)High Performance JavaScript (YUIConf 2010)
High Performance JavaScript (YUIConf 2010)
 
Building Progressive Web Apps for Android and iOS
Building Progressive Web Apps for Android and iOSBuilding Progressive Web Apps for Android and iOS
Building Progressive Web Apps for Android and iOS
 
Performance on the Yahoo! Homepage
Performance on the Yahoo! HomepagePerformance on the Yahoo! Homepage
Performance on the Yahoo! Homepage
 
14 Things You Must Do Before Launching a Website
14 Things You Must Do Before Launching a Website14 Things You Must Do Before Launching a Website
14 Things You Must Do Before Launching a Website
 
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQLHTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
 

Destaque

Presentation2 manipulation
Presentation2 manipulationPresentation2 manipulation
Presentation2 manipulation
brogan95
 
How does your media product represent particular social
How does your media product represent particular socialHow does your media product represent particular social
How does your media product represent particular social
afaman1
 
20140705 - V2020 Annual Conf - Community Outreach_Manish
20140705 - V2020 Annual Conf - Community Outreach_Manish20140705 - V2020 Annual Conf - Community Outreach_Manish
20140705 - V2020 Annual Conf - Community Outreach_Manish
Manish Kumar
 
Pagespeed what, why, and how it works
Pagespeed   what, why, and how it worksPagespeed   what, why, and how it works
Pagespeed what, why, and how it works
Ilya Grigorik
 

Destaque (19)

PageSpeed Optimization
PageSpeed OptimizationPageSpeed Optimization
PageSpeed Optimization
 
What is SEO? Grand Rapids HUG
What is SEO? Grand Rapids HUGWhat is SEO? Grand Rapids HUG
What is SEO? Grand Rapids HUG
 
A web perf dashboard up & running in 90 minutes presentation
A web perf dashboard up & running in 90 minutes presentationA web perf dashboard up & running in 90 minutes presentation
A web perf dashboard up & running in 90 minutes presentation
 
Who Says Data is Boring? Digital in Kent Speed Session 12th November 2015
Who Says Data is Boring? Digital in Kent Speed Session 12th November 2015Who Says Data is Boring? Digital in Kent Speed Session 12th November 2015
Who Says Data is Boring? Digital in Kent Speed Session 12th November 2015
 
Jimenez uscanga celica. evidencias ética. ige 2°a
Jimenez uscanga celica. evidencias ética. ige 2°aJimenez uscanga celica. evidencias ética. ige 2°a
Jimenez uscanga celica. evidencias ética. ige 2°a
 
Presentation2 manipulation
Presentation2 manipulationPresentation2 manipulation
Presentation2 manipulation
 
Tema. Valores éticos fundamentales
Tema. Valores éticos fundamentalesTema. Valores éticos fundamentales
Tema. Valores éticos fundamentales
 
Seminario 3
Seminario 3Seminario 3
Seminario 3
 
How does your media product represent particular social
How does your media product represent particular socialHow does your media product represent particular social
How does your media product represent particular social
 
Vo ip tu empresa de telefonia
Vo ip tu empresa de telefoniaVo ip tu empresa de telefonia
Vo ip tu empresa de telefonia
 
1.1.3 valores eticos fundamentales, verdad, responsabilidad, justicia y libertad
1.1.3 valores eticos fundamentales, verdad, responsabilidad, justicia y libertad1.1.3 valores eticos fundamentales, verdad, responsabilidad, justicia y libertad
1.1.3 valores eticos fundamentales, verdad, responsabilidad, justicia y libertad
 
Miniclase karinis
Miniclase karinisMiniclase karinis
Miniclase karinis
 
Novedades Microsoft Azure
Novedades Microsoft AzureNovedades Microsoft Azure
Novedades Microsoft Azure
 
La importancia de google docs
La importancia de google docsLa importancia de google docs
La importancia de google docs
 
20140705 - V2020 Annual Conf - Community Outreach_Manish
20140705 - V2020 Annual Conf - Community Outreach_Manish20140705 - V2020 Annual Conf - Community Outreach_Manish
20140705 - V2020 Annual Conf - Community Outreach_Manish
 
Cómo posicionar mi web. SEO
Cómo posicionar mi web. SEOCómo posicionar mi web. SEO
Cómo posicionar mi web. SEO
 
Crea a tu página web y ecommerce
Crea a tu página web y ecommerceCrea a tu página web y ecommerce
Crea a tu página web y ecommerce
 
Pagespeed what, why, and how it works
Pagespeed   what, why, and how it worksPagespeed   what, why, and how it works
Pagespeed what, why, and how it works
 
Mapa mental
Mapa mentalMapa mental
Mapa mental
 

Semelhante a AD113 Speed Up Your Applications w/ Nginx and PageSpeed

In Act Developers Platform
In Act Developers PlatformIn Act Developers Platform
In Act Developers Platform
Eris Ristemena
 
UKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basicsUKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basics
Ulrich Krause
 

Semelhante a AD113 Speed Up Your Applications w/ Nginx and PageSpeed (20)

JS digest. Decemebr 2017
JS digest. Decemebr 2017JS digest. Decemebr 2017
JS digest. Decemebr 2017
 
Drupal performance and scalability
Drupal performance and scalabilityDrupal performance and scalability
Drupal performance and scalability
 
Intro to advanced web development
Intro to advanced web developmentIntro to advanced web development
Intro to advanced web development
 
Normalizing x pages web development
Normalizing x pages web development Normalizing x pages web development
Normalizing x pages web development
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL
 
System design for Web Application
System design for Web ApplicationSystem design for Web Application
System design for Web Application
 
Joomla! Performance on Steroids
Joomla! Performance on SteroidsJoomla! Performance on Steroids
Joomla! Performance on Steroids
 
SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem.
SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem. SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem.
SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem.
 
Profiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty DetailsProfiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty Details
 
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
 
Scaling Django Apps using AWS Elastic Beanstalk
Scaling Django Apps using AWS Elastic BeanstalkScaling Django Apps using AWS Elastic Beanstalk
Scaling Django Apps using AWS Elastic Beanstalk
 
Experiences using CouchDB inside Microsoft's Azure team
Experiences using CouchDB inside Microsoft's Azure teamExperiences using CouchDB inside Microsoft's Azure team
Experiences using CouchDB inside Microsoft's Azure team
 
Sahi Principles and Architecture
Sahi Principles and ArchitectureSahi Principles and Architecture
Sahi Principles and Architecture
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakaya
 
Extension Library - Viagra for XPages
Extension Library - Viagra for XPagesExtension Library - Viagra for XPages
Extension Library - Viagra for XPages
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
 
In Act Developers Platform
In Act Developers PlatformIn Act Developers Platform
In Act Developers Platform
 
Improving Drupal Performances
Improving Drupal PerformancesImproving Drupal Performances
Improving Drupal Performances
 
Making Of PHP Based Web Application
Making Of PHP Based Web ApplicationMaking Of PHP Based Web Application
Making Of PHP Based Web Application
 
UKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basicsUKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basics
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

AD113 Speed Up Your Applications w/ Nginx and PageSpeed

  • 1. AD113: Speed Up Your Applications w/ Nginx and PageSpeed Eric McCormick
  • 3. Agenda • Who’s Talking? • Who is this for? • What are you selling? • Where can I use this thingamajig? • When can I adopt it? • Why does this benefit me? • How should I get on this bus to crazy town? • Demos
  • 4. Who’s Talking? Eric McCormick Twitter: @edm00se Blog: edm00se.io XPages developer since ‘11 Java developer on and off since ‘02 Experimented with WebSphere and DB2 in college
  • 5. Who’s Talking?... pt.2 What Is My Goal? 1. A harmonious development environment for myself and any development staff at my company 2. A unified theory practice of development, for consistent cross-platform and cross-app development behavior 3. Making all application logic and data consistently accessible across separate, but organic, systems 4. Making contracted development work more easily performed 5. Automating everything I can For my users: applications that “work well” (respond quickly, easy to use, don’t hang around for lunch). I Want It All
  • 7. Who’s This For?... pt.2 Specifically, web developers. … specifically web developers that care about / have access to / can bribe an admin for access to the full application stack … aka web application developers .... web app devs that want blazing fast application speed for their users, peace and harmony, and for dogs and cats to live together.
  • 8. Who’s This For?... pt.3 What you should know already: • fundamentals of web application and XPages “stack” development • differences of between the runtime generated markup of HTML (created by a our JEE environment) and static HTML assets (and CSS, JS, images) What you should get out of this: • an understanding of how a couple excellent freely available tools can make your applications more performant for your users • hand off TLS/SSL cert. handling from your app server (Domino) • provide finer grain (and automated) control over static web resources and their: caching (what, how long, no-cache paths) rewrites (concatenation) compression What you won’t get out of this: • how to grow a beard • many other things that go without saying
  • 9. What Are You Selling? The same as usual... Better Web Applications!
  • 10. What Are You Selling?... pt.2 What is it all about? • Segregated application design/development is good for my users, my company, and myself (and the other developers that we interact with) • I blogged about development with HttpServlets in XPages (NSF-local ones, without OSGi plugins) • I even did a Notes in 9 video on the subject (a second one bridging the gap between back-end and front-end development should be out soon) What does it all mean? • I have more (than “average” XPages application) static web assets not just CSS and JS files, but even HTML files (who knew!) • Just as we set an HTTP API (e.g.- RESTful API endpoint) to Cache-Control: No Cache, etc., we can cache our static assets in the user’s browser for faster loading times for more complex setups you can even host the static assets on a dedicated server separate from a Domino/XPages server, for faster loading times yet (and map in an Domino/XPages API assets as an api route, e.g.- /xsp, /api, etc.) this is not covered here (watch my blog)
  • 11. What Are You Selling?... pt.3 How can I achieve all this developer + user bliss? 3 Pieces: 1. Segregated Application Design (aka- have static assets to cache) 2. Reverse Proxy (to forward our API requests without cache, respond with cached static assets) 3. Tweak, fiddle, and “enhance” Google PageSpeed!
  • 12. Wait, What? Google PageSpeed Tools: https://developers.google.com/speed/pagespeed/ “The PageSpeed tools analyze and optimize your site following web best practices.” Flavors: • Nginx or Apache webserver modules (or IIS or Apache Traffic Server ports) relies on the PageSpeed Optimisation Library (PSOL) • PageSpeed Insights (online, freely available, assesses both mobile and desktop versions w/ score) demo volunteer? • PageSpeed Chrome Extension (great for non-public use cases, lots of the same info as Insights) demo local • PageSpeed Service (commercially provided by Google, all PageSpeed modules, filters, infrastructure) PageSpeed Service deactivated 03-August-2015
  • 13. DEMO: PageSpeed Insights (online, freely available, assesses both mobile and desktop versions w/ score) demo volunteer? PageSpeed Insights
  • 14. DEMO: PageSpeed Chrome Extension (great for non-public use cases, lots of the same info as Insights; also PSI tool, installable via npm) PageSpeed Chrome Extension
  • 15. Where Can I Use This Thingamajig? In front of your application server (it’s a reverse proxy, that’s where they live) preferably on the same “box” (it doesn’t have to be, but strongly advised). is pronounced engine X.
  • 16. When Can I Adopt It? As soon as you (or a sufficiently bribed admin) can run the install and do the necessary config (which I outline and demo in the “how”).
  • 17. Why Does This Benefit Me? In your well structured app (you amazing developer), you now have static assets which are fully cacheable; or not, it’s all configurable, like a choose your own adventure app server. Your user’s application performance will only increase due to the faster responses. You can now manage, off of your application server (Domino): • cache control • Gzip compression • HTTPS/SSL/TLS certificates • authentication (see Jesse Gallagher’s blog posts on “arbitrary authentication”, etc. with Nginx) Side benefit: if you’re addicted to fast apps, you’ve now opened the door to forward the API calls mapped to the Domino/app server and host the purely static assets off of Nginx (or Apache) for even faster applications!
  • 18. One Ticket to Crazy Town Please How do we do this? You guessed it, with Nginx + PageSpeed module! PageSpeed module is available for: • Apache -binary or source builds for Debian/Ubuntu and CentOS • Nginx, *nix only, no Windows :’-( -source builds only for Debian/Ubuntu and CentOS • IISpeed (port), https://www.iispeed.com/ With Nginx, you must build Nginx from source specifically configured with PageSpeed support (aka- we’re hooking in deep).
  • 19. Crazy Train… pt.2 Follow the Google PageSpeed install and build from source instructions for Nginx on *nix (I’m using an Ubuntu 64-bit 14.04.2 LTS distro). What do the instructions say? The short, short version is: • install a couple dependencies • download the PageSpeed (and PSOL) sources • download the Nginx source • build PSOL, then the PageSpeed module • configure Nginx w/ PageSpeed and build My install put things into /usr/local/nginx/.
  • 20. Crazy Train… pt.3 Once that’s all done… it’s alive!
  • 21. Config Anatomy Simple (simple) HTTP server config /usr/local/nginx/conf/nginx.conf worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; location / { root html; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
  • 22. Demo pt.1 Demo 1: a Domi-faux server behind Nginx w/ reverse proxy psst Eric, you want the nginx.conf_simpleProxy file you saved earlier
  • 23. Demo pt.2 Demo 2: a reverse proxied server w/ PageSpeed doing all the PageSpeed things psst Eric, you want the nginx.conf_PageSpeed-ified file you saved earlier
  • 24. Demo pt.3 Demo 3: a server w/ Nginx handling the HTTPS/SSL cert psst Eric, you want the nginx.conf_withSSL file you saved earlier
  • 25. Note on HTTPS Certificates Demo 3 has a self-signed TLS certificate, generated via openssl. Want to go that route, try this tutorial from Digital Ocean, or this one for Apache. Alternatives: • paid for certificate (e.g.- from GoDaddy, etc.) • no HTTPS • letsencrypt.org Let’s Encrypt: • sponsored by EFF, Mozilla, and others • free, automated, open source • coming soon How Soon? • First certificate: Week of September 7, 2015 • General availability: Week of November 16, 2015
  • 26. Note on HTTPS Certificates, pt.2 Using Let’s Encrypt.org: • can automatically configure Apache 2.x • support for Nginx 0.8.48+ mostly working (for auto config) • can always just generate files into local directory (regardless of auto config) • works through Let’s Encrypt’s own root and intermediate CAs • configurable RSA key length • can generate quickly from a *nix (Ubuntu, Debian, Fedora, Centos 7, Mac OS X) environment using Docker instructions on starting use • you can revoke a cert (one you’ve created for that server) Once created, either drop it in place of your self-signed or (for the fearless, until general release) let it auto configure for you. Not a magic solution, still essentially an intermediate “self-signed” certificate, but better than having your users click through the scary “untrusted” screens.
  • 27. Some FAQs • Why is PageSpeed not rewriting (combining) my CSS, JS, etc. files? link because it’s not supposed to… if filters like collapse_whitespace are working, then... “Your resources (images, css, javascript) aren't cacheable. If PageSpeed sees cache-control headers such as nocache or private it will not rewrite the resources.” We tell it to forget the Cache-Control and Expires headers with proxy_hide_headers. • Why is Nginx failing to start as soon as I enable mod_pagespeed? you most likely have forgotten to build either PageSpeed or PSOL from source, failed to configure Nginx correctly, or malformed your conf syntax (use semi-colons at line ends!) • What if I want the same config on a dev box, but want to see changes? do as this SO answer suggests and use a .htaccess file with ModPageSpeed off • But what’s it all cost? not a thing, it’s all free (except for the infrastructure to run an Nginx instance; which isn’t much) • Do I really need PageSpeed for this? No! You can achieve most, if not all, that the ngx_pagespeed modules does without PageSpeed. It just makes it easier.
  • 28. Q&A DEMO: (time permitting) A taste of a freely available, developer friendly way of doing a lot of this, without a DIY server.
  • 29. Q&A Questions? Write better, faster, stronger apps! We have the ability.