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.

APIDays Australia - Openresty for scale

308 views

Published on

As CTO of a rapid growth FinTech one of my biggest challenges is rebuilding the platform to scale elastically plus still allowing for the rapid development and integration of core platform functionality. Even for fast prototyping and design Openresty allows for the quick integration for mobile and web services that can integrate with almost any database or stateless program logic allowing for faster than normal deployment and event geo based load balancing. Utilising NGINX ill show some of the ways i am overcoming some of the challenges by building a developer focused api platform that will allow the quick and easy deployment of new services while still maintaining the functionality needed by modern REST API design techniques. Also we will be looking at some of the additional functionality available to the Openresty suite including Machine Learning (which can be used for API error handling), QR code handling and API tempting and authentication. http://au.apidays.io/abstracts.html#2747a1f1

Published in: Technology
  • Be the first to comment

APIDays Australia - Openresty for scale

  1. 1. @developersteve #APIDaysAU OpenResty Building APIs for scale with
  2. 2. @developersteve #APIDaysAU
  3. 3. @developersteve #APIDaysAU Steven Cooper Sniip CTO Developersteve.com As Chief Technology Officer for Sniip Steven is working closely to help scale the platform and creating new innovative ways for consumers to pay. With Sniip’s frictionless and easy to use application he is working with government agencies, councils and utility companies to implement the technology.
  4. 4. @developersteve #APIDaysAU About US Sniip is a disruptive force in the payment space It is the first of its kind in Australia as it is a mobile payment application built not around a bank or payment brand, but rather, around the consumer. About Sniip Where it started
  5. 5. @developersteve #APIDaysAU SCAN CHECKOUT How it Works The easy way to pay PIN
  6. 6. @developersteve #APIDaysAU Other “solutions” Such advanced technology
  7. 7. @developersteve #APIDaysAU
  8. 8. @developersteve #APIDaysAU Our Legacy Stack It has to start somewhere
  9. 9. @developersteve #APIDaysAU
  10. 10. @developersteve #APIDaysAU <3 AWS
  11. 11. @developersteve #APIDaysAU Laravel API’s Php framework
  12. 12. @developersteve #APIDaysAU PHP is a framework http://phpthewrongway.com
  13. 13. @developersteve #APIDaysAU Mysql Schema Mysql architecture
  14. 14. @developersteve #APIDaysAU Our Strategy Rebuilding for scale, elasticity and futureproofing UX/UI Create a user experience that futureproofs the UX Functionality Building relevant functionality that allows for scale Developer Portal API’s and Documentation built for internal and external User Engagement Ensuring we build how users want to use our platform
  15. 15. @developersteve #APIDaysAU
  16. 16. @developersteve #APIDaysAU The Stack Openresty
  17. 17. @developersteve #APIDaysAU OpenResty A fusion between Nginx and Lua
  18. 18. @developersteve #APIDaysAU OpenResty Market Share Used by nearly half a million websites https://wappalyzer.com/categories/web-servers
  19. 19. @developersteve #APIDaysAU Powering Tumblr Used by high traffic sites https://news.netcraft.com/archives/2016/09/19/september-2016-web-server-survey.html
  20. 20. @developersteve #APIDaysAU OpenResty Libs https://devstev.es/orlibs
  21. 21. @developersteve #APIDaysAU OpenResty Machine Learning http://torch.ch/
  22. 22. @developersteve #APIDaysAU <3 Nginx Nginx is awesome
  23. 23. @developersteve #APIDaysAU Lua is back … again Cant beat a classic
  24. 24. @developersteve #APIDaysAU Corona SDK Cross platform mobile
  25. 25. @developersteve #APIDaysAU Let’s Encrypt Automatically renewable SSL
  26. 26. @developersteve #APIDaysAU Auto renew SSL https://devstev.es/autossl
  27. 27. @developersteve #APIDaysAU Auto renew SSL https://devstev.es/autossl2
  28. 28. @developersteve #APIDaysAU PCI DSS 3.2 Payment Card Industry Data Security Standard
  29. 29. @developersteve #APIDaysAU Implement TLS A more secure connection TLS 1.0 TLS 1.1 TLS 1.2
  30. 30. @developersteve #APIDaysAU
  31. 31. @developersteve #APIDaysAU Configuration Setting up the
  32. 32. @developersteve #APIDaysAU Installing OpenResty openresty.org
  33. 33. @developersteve #APIDaysAU Openresty Nginx Config nginx.conf ./configure --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid
  34. 34. @developersteve #APIDaysAU Openresty Libraries https://devstev.es/orlibs --with-luajit --with-pcre-jit --with-debug --with-http_auth_request_module --with-http_geoip_module --with-http_gzip_static_module --with-http_ssl_module --with-ipv6 --with-http_v2_module --with-http_postgres_module
  35. 35. @developersteve #APIDaysAU Make… Install…
  36. 36. @developersteve #APIDaysAU
  37. 37. @developersteve #APIDaysAU Nginx.conf Loadbalance Nginx as per normal
  38. 38. @developersteve #APIDaysAU Nginx.conf Basic Nginx as per normal worker_processes auto; error_log logs/error.log; events { worker_connections 1024; } http { server { } }
  39. 39. @developersteve #APIDaysAU Nginx.conf SSL/TLS Nginx as per normal ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AE S256+EDH";ssl_ecdh_curve secp384r1; ssl_session_timeout 1d;ssl_session_cache shared:SSL:10m;ssl_session_tickets off;ssl_stapling on;ssl_stapling_verify on;listen 443 ssl http2;listen [::]:443 ssl http2;ssl_certificate /etc/letsencrypt/live/website.com/fullchain.pem;ssl_certificat e_key /etc/letsencrypt/live/website.com/privkey.pem;add_header X-Frame-Options DENY;add_header X-Content-Type- Options nosniff;add_header X-XSS-Protection "1; mode=block";
  40. 40. @developersteve #APIDaysAU
  41. 41. @developersteve #APIDaysAU Nginx.conf additionals Nginx setup http { init_by_lua ’ json = require "cjson"; '; }
  42. 42. @developersteve #APIDaysAU Nginx.conf Routes Routing like a boss location / { content_by_lua_file ”./hello.lua"; }
  43. 43. @developersteve #APIDaysAU Calling in Lua helloworl.lua local cjson = require("cjson") ngx.status = ngx.HTTP_OK ngx.header.content_type = "application/json; charset=utf-8” ngx.say(cjson.encode({ hello = "world" })) return ngx.exit(ngx.HTTP_OK)
  44. 44. @developersteve #APIDaysAU Run OpenResty Run Fingers crossed nginx -p `pwd`/ -c nginx.conf
  45. 45. @developersteve #APIDaysAU Nginx.conf Routes Routing like a boss location / { content_by_lua_file ”./hello.lua"; } location ~/status { content_by_lua_file ”./status.lua"; }
  46. 46. @developersteve #APIDaysAU Calling in Lua Return a status local cjson = require("cjson") ngx.status = ngx.HTTP_OK ngx.header.content_type = "application/json; charset=utf-8” ngx.say(cjson.encode({ status = true })) return ngx.exit(ngx.HTTP_OK)
  47. 47. @developersteve #APIDaysAU
  48. 48. @developersteve #APIDaysAU Template Engine Lua https://devstev.es/luatemp
  49. 49. @developersteve #APIDaysAU OpenResty Snippets https://devstev.es/luasnip
  50. 50. @developersteve #APIDaysAU Load Testing I feel the need for speed
  51. 51. @developersteve #APIDaysAU
  52. 52. @developersteve #APIDaysAU
  53. 53. @developersteve #APIDaysAU BlitzIO https://blitz.io
  54. 54. @developersteve #APIDaysAU Legacy
  55. 55. @developersteve #APIDaysAU OpenResty
  56. 56. @developersteve #APIDaysAU Response Times Left is legacy – Right is new OpenRestyLegacy
  57. 57. @developersteve #APIDaysAU Hit Rate Left is legacy – Right is new OpenRestyLegacy
  58. 58. @developersteve #APIDaysAU
  59. 59. @developersteve #APIDaysAU Reading Recommended
  60. 60. @developersteve #APIDaysAU Designing robust API’s https://devstev.es/api1
  61. 61. @developersteve #APIDaysAU What is OpenResty https://devstev.es/api2
  62. 62. @developersteve #APIDaysAU Moltin OpenResty https://devstev.es/api3
  63. 63. @developersteve #APIDaysAU Thanks Questions? Comments?
  64. 64. @developersteve #APIDaysAU 8-Bit Open Source
  65. 65. @developersteve #APIDaysAU Drop Microphone Walk off stage

×