SlideShare una empresa de Scribd logo
1 de 91
Descargar para leer sin conexión
HOW TO DESIGN A BACKEND
FOR THE IOT
İBRAHİM GÜRSES
WHO AM I?
▸ Graduated From Bilkent University in 2011
▸ Vakıfbank, Gate Elektronik, T2 Yazılım, OpsGenie,
Hazelcast, Arçelik.
▸ Currently working on IoT infrastructure @Arçelik
▸ Co-Founder of Ankara Cloud Meetup
ANKARA CLOUD MEETUP
SERVERLESS COMPUTING WITH AWS
HTTPS://WWW.YOUTUBE.COM/WATCH?V=LEPQXTOWDJS
DEVOPS CULTURE AND PRACTICES
HTTPS://WWW.YOUTUBE.COM/WATCH?V=D3E0XJCRWCE
AGENDA
▸ IOT
▸ DevOps
▸ 12 Factor App
▸ Cloud
▸ Microservices
▸ Q&A & Demo
IOT
FROM MOORE’S LAW TO METCALFE’S LAW
Metcalfe's law states that the value of a telecommunications network
is proportional to the square of the number of connected users of the
system
WHAT IS IOT?
▸ The network of physical object that contain embedded
technology to communicate and interact with their internal
states or the external environment. (Gartner)
▸ The term is coined by Kevin Ashton in 1999 in
Procter&Gamble
▸ Also called M2M, Industrial Internet, Web of Things,
Internet of Everything, Industry 4.0
3 PILARS OF IOT
GARTNER’S HYPE CYCLE 2016
FATHER OF JAVA AND IOT
FATHER OF JAVA AND IOT
A TYPICAL IOT DATA PROCESSING ARCHITECTURE
Source : Internet of Things: Principles and Paradigms, Elsevier Science, 2016
PROCESSING DATA FROM THE EDGE
▸ Collect
▸ Instrument apps
▸ Deliver events to analytics service
▸ Receive and store many live data streams
▸ Analyze
▸ Real-time and historical analysis of event streams
▸ Aggregations, pivots and patterns
▸ Consume
▸ Publish analytics in a consumable format
▸ Inform and influence
▸ Make better decisions
IOT TECH STACK
DEVOPS
DEVELOPMENT BEFORE DEVOPS
▸ DevOps is a new term that primarily
focuses on improved collaboration,
communication, and integration between
software developers and IT operations. It’s
an umbrella term that some describe as a
philosophy, cultural change, and paradigm
shift. Figure shows developer throwing
code "over the wall" Historically many
organisations have been vertically
structured with poor integration among
development, infrastructure, security and
support teams. Frequently the groups
report into different organisational
structures with different corporate goals
and philosophies.
FILLING THE GAPS
WHAT DEVOPS BRINGS
▸ Today, these old divisions are breaking down, with the IT and
developer roles merging and following a series of systematic
principles:
▸ Infrastructure as code
▸ Continuous deployment
▸ Automation
▸ Monitoring
▸ Security
INFRASTRUCTURE AS CODE
▸ Repeatability (Humans make mistakes)
▸ Agility (Roll forward or roll back easily)
▸ Auditing and Security (Paper trail and permissions)
AUTOMATION AND CONFIGURATION MANAGEMENT
▸ Provisioning (CloudFormation, OpsWorks, BeansTalk)
▸ Declarative (Loosely coupled to implementation)
▸ Configuration (Chef, Pupper, SaltStack, Ansible, DSC)
MONITORING AND SECURITY
▸ Processing all systems logs in real time.
▸ Logs should be considered as events
▸ Security can inject analysis tools to dev pipeline.
▸ Testing is not optional in devops.
DEVOPS
▸ Do not write code and toss it to ops and testing team
▸ Do not repeat task manually
▸ Rise of devops tools(Chef, Puppet, Ansible)
▸ Spend time developing business code instead of
infrastructure code (NoOps)
MOVING LEGACY APPS ON CLOUD
▸ Asset Hosting
▸ How do you deal with uploaded content? (images/
videos/music)?
▸ Session Management
▸ How do you deal with session data? Session replication
will be a necessity, sticky session is bad for scalability
and availability
MOVING LEGACY APPS ON CLOUD CONTD
▸ SQL
▸ What considerations are there SQL? (How to handle
stored procedures)
▸ NoSQL
▸ How can you take advantage modern trends of NoSQL?
MOVING LEGACY APPS ON CLOUD CONTD
▸ Caching
▸ How do you incorporate modern caching techniques?
▸ Async Processing
▸ How do you handle long running processes?
12 FACTOR APP
12FACTOR.NET
WHAT IS 12 FACTOR APP?
▸ It is a methodology for building SaaS application
▸ Tries to define systematic problems in app development
▸ Tries to define a set of conceptual solutions to those
problems
GENERAL PROPERTIES OF 12 FACTOR APP
▸ Uses declarative format for setup automation.(Easy
orientation for new joining devs)
▸ Has a clean contract with underlying operations system
(Increases portability)
▸ Is suitable for deployment on modern cloud systems
(CloudNative app, also no need for an army of ops guys to
deploy and maintain the app)
12 FACTOR APP
▸ Code is version Controlled
▸ Always tracked in version control system
▸ 1:1 relationship between code base and app
▸ Many deploys of given app
▸ Codebase same across deploys version may differ
WHAT WE DO?
12 FACTOR APP
▸ Dependencies are declared and Isolated
▸ Never assume system-wide packages
▸ Dependency declaration manifest
▸ Isolated so no dependency leak from system
▸ Helps new developers
WHAT WE DO?
We use maven. A new
developer can start working
by simply typing single
command `mvn clean install`
and all library dependencies
will be installed.
12 FACTOR APP
▸ Configuration is Stored in the Environment
▸ Should store in env variables
▸ Should not be constants in code
▸ Ideally not in conf files
▸ Avoid grouping as environments
WHAT WE DO?
▸ All environment variable and configuration information is
stored over AWS and all applications including mobile
client and wifi-card gets their configuration information
from a single place.
12 FACTOR APP
▸ Backing Services as Attached Resource
▸ Services consumed over the network
▸ No distinction between local or third party services
▸ Keep Dependencies de-coupled
▸ Attach and detach at will
WHAT WE DO?
▸ We use AWS services for both SQL
and NoSQL data storage
(RDS,DynamoDB)
12 FACTOR APP
▸ Build and Run Stages are separated
▸ Impossible to change code at runtime
▸ Releases should have IDs
▸ Build may be complex, started by Devs
▸ Run is simple and completely unattended
WHAT WE DO?
12 FACTOR APP
▸ Application Executed as Stateless Processes
▸ Share Nothing (Universal Scalability Law)
▸ Persisted data in stateful backing store
▸ Memory and File System is for cache only
▸ Avoid sticky Sessions
WHAT WE DO?
▸ We implemented stateless serverless architecture with
AWS API Gateway and Lambda.
▸ Each request to cloud is executed within a Lambda
function inside a isolated stateless container
12 FACTOR APP
▸ Services Exported via Port Binding
▸ Self Contained
▸ Embedded servers
▸ Listen on specific port
▸ Very specific and idealistic
12 FACTOR APP
▸ Application scaled out via process model
▸ Processes are first class citizens
▸ Work assigned to process type
▸ Applications have process that span servers
▸ Use OS process managers not deamons
12 FACTOR APP
▸ Processes are disposable
▸ Can be started or stopped at any time
▸ Minimal start up time, graceful shutdown
▸ Worker processes return to work queue
▸ Robust against sudden death
12 FACTOR APP
▸ Parity Between Application Environments
▸ Avoid time/personnel/tool gaps
▸ Design for continuous deployment
▸ Very important for backing services
▸ Containers and config mgmt. makes this easier.
12 FACTOR APP
▸ Logs are stream of time-ordered events
▸ App is never concerned with storing log files
▸ Execution environment capture logs
▸ May be routed to file, watched, sent to external service
WHAT WE DO?
▸ We use AWS CloudWatch to monitor system logs.
12 FACTOR APP
▸ Management Task Run as One-off Process
▸ Run in identical environment
▸ Separate out as scripts that are source controlled
▸ Don’t run from local terminal
▸ Don’t run directly against the database
ADDITIONAL DEVOPS DESIGN CONSIDERATIONS
▸ Rely on sync messaging
▸ Compose applications out of service
▸ Assess portability requirements
▸ Embrace the abstractions
DEVOPS ANTI-PATTERNS
▸ Relying on the local file system
▸ Building services that scale up
▸ Trying to change code server side
▸ Manually coordinating builds
▸ Hard-coding configuration
▸ Cramming everything into one app
DEVOPS CONCEPTS BEFORE FAILURE
▸ Chaos Monkey
▸ Blue/Green - Canary Deployment
▸ Dependency Injection
▸ Andon Cords
▸ The Cloud
▸ Embedded Teams
DEVOPS CONCEPTS AFTER FAILURE
▸ Blameless Postmortems
▸ Public Status Page
▸ Developers on Call
▸ Incident Command System
CAMS MODEL
▸ Culture
▸ Automation
▸ Measurement
▸ Sharing
KAIZEN’S GUIDES
▸ Good processes bring good results
▸ Go see for yourself (gemba)
▸ Speak with data, manage by facts
▸ Take action to contain and correct root causes
▸ Work as a team
▸ Kaizen is everybody’s business
SOFTWARE FACTORY
LEVELS OF MATURITY OF DEVOPS PROCESS
WHERE TO BEGIN?
CLOUD
CLOUD APPLICATION DELIVERY MODELS
▸ IaaS (Infrastructure as a Service) - Host
▸ PaaS (Platform as a Service) - Build
▸ SaaS (Software as a Service) - Consume
PETS VS CATTLE
AWS IOT
AWS IOT COMPONENTS
▸ Device Gateway
▸ Enables devices to securely and efficiently communicate with
AWS IoT.
▸ Message Broker
▸ Provides a secure mechanism for things and AWS IoT
applications to publish and receive messages from each
other. You can use either the MQTT protocol directly or MQTT
over WebSocket to publish and subscribe. You can use the
HTTP REST interface to publish.
AWS IOT COMPONENTS
▸ Rule Engine
▸ Provides message processing and integration with other AWS services.
You can use a SQL-based language to select data from message
payloads, process and send the data to other services, such as Amazon
S3, Amazon DynamoDB, and AWS Lambda. You can also use the
message broker to republish messages to other subscribers
▸ Security and Identity Service
▸ Provides shared responsibility for security in the AWS cloud. Your things
must keep their credentials safe in order to securely send data to the
message broker. The message broker and rules engine use AWS security
features to send data securely to devices or other AWS services.
AWS IOT COMPONENTS
▸ Thing registry
▸ Organizes the resources associated with each thing. You register your
things and associate up to three custom attributes with each thing. You
can also associate certificates and MQTT client IDs with each thing to
improve your ability to manage and troubleshoot your things.Security
and Identity Service.
▸ Thing Shadow Service
▸ Provides persistent representations of your things in the AWS cloud. You
can publish updated state information to a thing shadow, and your thing
can synchronize its state when it connects. Your things can also publish
their current state to a thing shadow for use by applications or devices.
SERVERLESS COMPUTING MODEL
AWS LAMBDA
AWS APIGATEWAY
MOBILE SAMPLE BACKEND SERVERLESS ARCITECTURE
WHAT WE DO?
AMAZON S3 HOSTED WEBSITE
WHAT WE DO?
MICROSERVICES
MICROSERVICE
▸ Is there a formal definition for microservice architecture ?
▸ No
▸ What is the Difference between monolithic and micro
service styles?
▸ Easy to maintain
▸ Deployment
▸ Scaling
DON’T !!!
ADVANTAGES
▸ Can use right tool for the job
▸ Can replace entire components easier
▸ Can scale specific components
▸ Super cloud friendly
▸ Will push you DevOps
CHALLENGES
▸ Distributed/versioned configuration
▸ Auto configurations and refresh on runtime
▸ New services can auto register at startup
▸ Service registration and discovery
▸ Centralised log management
▸ Collects and visualise log events from distributed processes
▸ Circuit Breaker (Bulk Heading)
▸ Prevent problems with chain of failures
▸ Security
DISTRIBUTED SYSTEMS
SUN’S FALLACIES OF DISTRIBUTED COMPUTING
▸ The network is reliable.
▸ Latency is zero.
▸ Bandwidth is infinite.
▸ The network is secure.
▸ Topology doesn't change.
▸ There is one administrator.
▸ Transport cost is zero.
▸ The network is homogeneous.
ANY ORGANIZATION THAT DESIGNS A
SYSTEM WILL PRODUCE A DESIGN WHOSE
STRUCTURE IS A COPY OF THE
ORGANIZATION’S COMMUNICATION
STRUCTURE.
Melvin Conway
CONWAY’S LAW
DEMO
QUESTIONS?
WE ARE HIRING

Más contenido relacionado

La actualidad más candente

Successfully Implementing DEV-SEC-OPS in the Cloud
Successfully Implementing DEV-SEC-OPS in the CloudSuccessfully Implementing DEV-SEC-OPS in the Cloud
Successfully Implementing DEV-SEC-OPS in the Cloud
Amazon Web Services
 

La actualidad más candente (20)

[muCon2017]DevSecOps: How to Continuously Integrate Security into DevOps
[muCon2017]DevSecOps: How to Continuously Integrate Security into DevOps[muCon2017]DevSecOps: How to Continuously Integrate Security into DevOps
[muCon2017]DevSecOps: How to Continuously Integrate Security into DevOps
 
Digitální transformace: zabezpečení agilních prostředí
Digitální transformace: zabezpečení agilních prostředíDigitální transformace: zabezpečení agilních prostředí
Digitální transformace: zabezpečení agilních prostředí
 
Addressing the 8 Key Pain Points of Kubernetes Cluster Management
Addressing the 8 Key Pain Points of Kubernetes Cluster ManagementAddressing the 8 Key Pain Points of Kubernetes Cluster Management
Addressing the 8 Key Pain Points of Kubernetes Cluster Management
 
Enterprise-Ready Private and Hybrid Cloud Computing Today
Enterprise-Ready Private and Hybrid Cloud Computing TodayEnterprise-Ready Private and Hybrid Cloud Computing Today
Enterprise-Ready Private and Hybrid Cloud Computing Today
 
Architecting Cloud Computing Solutions with Java [1.1]
Architecting Cloud Computing Solutions with Java [1.1]Architecting Cloud Computing Solutions with Java [1.1]
Architecting Cloud Computing Solutions with Java [1.1]
 
Policy as code what helm developers need to know about security
Policy as code  what helm developers need to know about securityPolicy as code  what helm developers need to know about security
Policy as code what helm developers need to know about security
 
Compliance in the Cloud Using Security by Design
Compliance in the Cloud Using Security by DesignCompliance in the Cloud Using Security by Design
Compliance in the Cloud Using Security by Design
 
Docker FedSummit 2017 - Journey to the Cloud with CaaS
Docker FedSummit 2017 - Journey to the Cloud with CaaSDocker FedSummit 2017 - Journey to the Cloud with CaaS
Docker FedSummit 2017 - Journey to the Cloud with CaaS
 
ThoughtWorks Technology Radar Roadshow - Brisbane
ThoughtWorks Technology Radar Roadshow - BrisbaneThoughtWorks Technology Radar Roadshow - Brisbane
ThoughtWorks Technology Radar Roadshow - Brisbane
 
DevSecOps at the GSA
DevSecOps at the GSADevSecOps at the GSA
DevSecOps at the GSA
 
Cloud native programming model comparison
Cloud native programming model comparisonCloud native programming model comparison
Cloud native programming model comparison
 
56k.cloud training
56k.cloud training56k.cloud training
56k.cloud training
 
NetDevOps Development Environments
NetDevOps Development EnvironmentsNetDevOps Development Environments
NetDevOps Development Environments
 
Netflix Open Source Meetup Season 4 Episode 3
Netflix Open Source Meetup Season 4 Episode 3Netflix Open Source Meetup Season 4 Episode 3
Netflix Open Source Meetup Season 4 Episode 3
 
OSCON 2014 - Crash Course in Open Source Cloud Computing
OSCON 2014 -  Crash Course in Open Source Cloud ComputingOSCON 2014 -  Crash Course in Open Source Cloud Computing
OSCON 2014 - Crash Course in Open Source Cloud Computing
 
Successfully Implementing DEV-SEC-OPS in the Cloud
Successfully Implementing DEV-SEC-OPS in the CloudSuccessfully Implementing DEV-SEC-OPS in the Cloud
Successfully Implementing DEV-SEC-OPS in the Cloud
 
DevSecOps Basics with Azure Pipelines
DevSecOps Basics with Azure Pipelines DevSecOps Basics with Azure Pipelines
DevSecOps Basics with Azure Pipelines
 
DockerCon 2016 - Structured Container Delivery
DockerCon 2016 - Structured Container DeliveryDockerCon 2016 - Structured Container Delivery
DockerCon 2016 - Structured Container Delivery
 
A Hitchhiker's Guide to Enterprise Microservices with Go
A Hitchhiker's Guide to Enterprise Microservices with GoA Hitchhiker's Guide to Enterprise Microservices with Go
A Hitchhiker's Guide to Enterprise Microservices with Go
 
Building security into the pipelines
Building security into the pipelinesBuilding security into the pipelines
Building security into the pipelines
 

Similar a How to Design a Backend for IoT

Similar a How to Design a Backend for IoT (20)

DevOps and BigData Analytics
DevOps and BigData Analytics DevOps and BigData Analytics
DevOps and BigData Analytics
 
Designing a Reliable Software Factory for the Cloud
Designing a Reliable Software Factory for the CloudDesigning a Reliable Software Factory for the Cloud
Designing a Reliable Software Factory for the Cloud
 
Combining Cloud Native & PaaS: Building a Fully Managed Application Platform ...
Combining Cloud Native & PaaS: Building a Fully Managed Application Platform ...Combining Cloud Native & PaaS: Building a Fully Managed Application Platform ...
Combining Cloud Native & PaaS: Building a Fully Managed Application Platform ...
 
8 - OpenShift - A look at a container platform: what's in the box
8 - OpenShift - A look at a container platform: what's in the box8 - OpenShift - A look at a container platform: what's in the box
8 - OpenShift - A look at a container platform: what's in the box
 
.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles
 
Tlu introduction-to-cloud
Tlu introduction-to-cloudTlu introduction-to-cloud
Tlu introduction-to-cloud
 
12 factor app
12 factor app12 factor app
12 factor app
 
DevOps LA Meetup Intro to Habitat
DevOps LA Meetup Intro to HabitatDevOps LA Meetup Intro to Habitat
DevOps LA Meetup Intro to Habitat
 
[Capitole du Libre] #serverless -  mettez-le en oeuvre dans votre entreprise...
[Capitole du Libre] #serverless -  mettez-le en oeuvre dans votre entreprise...[Capitole du Libre] #serverless -  mettez-le en oeuvre dans votre entreprise...
[Capitole du Libre] #serverless -  mettez-le en oeuvre dans votre entreprise...
 
Tech Talk - Cloud Transformation in 2017
Tech Talk - Cloud Transformation in 2017Tech Talk - Cloud Transformation in 2017
Tech Talk - Cloud Transformation in 2017
 
To the Cloud and beyond (Nantes, Rebuild 2018)
To the Cloud and beyond (Nantes, Rebuild 2018)To the Cloud and beyond (Nantes, Rebuild 2018)
To the Cloud and beyond (Nantes, Rebuild 2018)
 
The Future of Cloud Innovation, featuring Adrian Cockcroft
The Future of Cloud Innovation, featuring Adrian CockcroftThe Future of Cloud Innovation, featuring Adrian Cockcroft
The Future of Cloud Innovation, featuring Adrian Cockcroft
 
Micro service Arthicetcure
Micro service Arthicetcure Micro service Arthicetcure
Micro service Arthicetcure
 
Modern application delivery with Consul
Modern application delivery with ConsulModern application delivery with Consul
Modern application delivery with Consul
 
(RivieraDev 2018) #serverless - 2 ans de retourS d'expérience
(RivieraDev 2018) #serverless - 2 ans de retourS d'expérience(RivieraDev 2018) #serverless - 2 ans de retourS d'expérience
(RivieraDev 2018) #serverless - 2 ans de retourS d'expérience
 
Introduction to Cloudify for OpenStack users
Introduction to Cloudify for OpenStack users Introduction to Cloudify for OpenStack users
Introduction to Cloudify for OpenStack users
 
The world of Docker and Kubernetes
The world of Docker and Kubernetes The world of Docker and Kubernetes
The world of Docker and Kubernetes
 
Cloud computing
Cloud computingCloud computing
Cloud computing
 
Introduction to Microsoft Azure
Introduction to Microsoft AzureIntroduction to Microsoft Azure
Introduction to Microsoft Azure
 
Red Hat Openshift on Microsoft Azure
Red Hat Openshift on Microsoft AzureRed Hat Openshift on Microsoft Azure
Red Hat Openshift on Microsoft Azure
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 

How to Design a Backend for IoT

  • 1. HOW TO DESIGN A BACKEND FOR THE IOT İBRAHİM GÜRSES
  • 2. WHO AM I? ▸ Graduated From Bilkent University in 2011 ▸ Vakıfbank, Gate Elektronik, T2 Yazılım, OpsGenie, Hazelcast, Arçelik. ▸ Currently working on IoT infrastructure @Arçelik ▸ Co-Founder of Ankara Cloud Meetup
  • 4. SERVERLESS COMPUTING WITH AWS HTTPS://WWW.YOUTUBE.COM/WATCH?V=LEPQXTOWDJS
  • 5. DEVOPS CULTURE AND PRACTICES HTTPS://WWW.YOUTUBE.COM/WATCH?V=D3E0XJCRWCE
  • 6. AGENDA ▸ IOT ▸ DevOps ▸ 12 Factor App ▸ Cloud ▸ Microservices ▸ Q&A & Demo
  • 7. IOT
  • 8. FROM MOORE’S LAW TO METCALFE’S LAW Metcalfe's law states that the value of a telecommunications network is proportional to the square of the number of connected users of the system
  • 9. WHAT IS IOT? ▸ The network of physical object that contain embedded technology to communicate and interact with their internal states or the external environment. (Gartner) ▸ The term is coined by Kevin Ashton in 1999 in Procter&Gamble ▸ Also called M2M, Industrial Internet, Web of Things, Internet of Everything, Industry 4.0
  • 10. 3 PILARS OF IOT
  • 12. FATHER OF JAVA AND IOT
  • 13. FATHER OF JAVA AND IOT
  • 14. A TYPICAL IOT DATA PROCESSING ARCHITECTURE Source : Internet of Things: Principles and Paradigms, Elsevier Science, 2016
  • 15. PROCESSING DATA FROM THE EDGE ▸ Collect ▸ Instrument apps ▸ Deliver events to analytics service ▸ Receive and store many live data streams ▸ Analyze ▸ Real-time and historical analysis of event streams ▸ Aggregations, pivots and patterns ▸ Consume ▸ Publish analytics in a consumable format ▸ Inform and influence ▸ Make better decisions
  • 16.
  • 19. DEVELOPMENT BEFORE DEVOPS ▸ DevOps is a new term that primarily focuses on improved collaboration, communication, and integration between software developers and IT operations. It’s an umbrella term that some describe as a philosophy, cultural change, and paradigm shift. Figure shows developer throwing code "over the wall" Historically many organisations have been vertically structured with poor integration among development, infrastructure, security and support teams. Frequently the groups report into different organisational structures with different corporate goals and philosophies.
  • 21. WHAT DEVOPS BRINGS ▸ Today, these old divisions are breaking down, with the IT and developer roles merging and following a series of systematic principles: ▸ Infrastructure as code ▸ Continuous deployment ▸ Automation ▸ Monitoring ▸ Security
  • 22. INFRASTRUCTURE AS CODE ▸ Repeatability (Humans make mistakes) ▸ Agility (Roll forward or roll back easily) ▸ Auditing and Security (Paper trail and permissions)
  • 23. AUTOMATION AND CONFIGURATION MANAGEMENT ▸ Provisioning (CloudFormation, OpsWorks, BeansTalk) ▸ Declarative (Loosely coupled to implementation) ▸ Configuration (Chef, Pupper, SaltStack, Ansible, DSC)
  • 24. MONITORING AND SECURITY ▸ Processing all systems logs in real time. ▸ Logs should be considered as events ▸ Security can inject analysis tools to dev pipeline. ▸ Testing is not optional in devops.
  • 25. DEVOPS ▸ Do not write code and toss it to ops and testing team ▸ Do not repeat task manually ▸ Rise of devops tools(Chef, Puppet, Ansible) ▸ Spend time developing business code instead of infrastructure code (NoOps)
  • 26. MOVING LEGACY APPS ON CLOUD ▸ Asset Hosting ▸ How do you deal with uploaded content? (images/ videos/music)? ▸ Session Management ▸ How do you deal with session data? Session replication will be a necessity, sticky session is bad for scalability and availability
  • 27. MOVING LEGACY APPS ON CLOUD CONTD ▸ SQL ▸ What considerations are there SQL? (How to handle stored procedures) ▸ NoSQL ▸ How can you take advantage modern trends of NoSQL?
  • 28. MOVING LEGACY APPS ON CLOUD CONTD ▸ Caching ▸ How do you incorporate modern caching techniques? ▸ Async Processing ▸ How do you handle long running processes?
  • 31. WHAT IS 12 FACTOR APP? ▸ It is a methodology for building SaaS application ▸ Tries to define systematic problems in app development ▸ Tries to define a set of conceptual solutions to those problems
  • 32. GENERAL PROPERTIES OF 12 FACTOR APP ▸ Uses declarative format for setup automation.(Easy orientation for new joining devs) ▸ Has a clean contract with underlying operations system (Increases portability) ▸ Is suitable for deployment on modern cloud systems (CloudNative app, also no need for an army of ops guys to deploy and maintain the app)
  • 33. 12 FACTOR APP ▸ Code is version Controlled ▸ Always tracked in version control system ▸ 1:1 relationship between code base and app ▸ Many deploys of given app ▸ Codebase same across deploys version may differ
  • 35. 12 FACTOR APP ▸ Dependencies are declared and Isolated ▸ Never assume system-wide packages ▸ Dependency declaration manifest ▸ Isolated so no dependency leak from system ▸ Helps new developers
  • 36. WHAT WE DO? We use maven. A new developer can start working by simply typing single command `mvn clean install` and all library dependencies will be installed.
  • 37. 12 FACTOR APP ▸ Configuration is Stored in the Environment ▸ Should store in env variables ▸ Should not be constants in code ▸ Ideally not in conf files ▸ Avoid grouping as environments
  • 38. WHAT WE DO? ▸ All environment variable and configuration information is stored over AWS and all applications including mobile client and wifi-card gets their configuration information from a single place.
  • 39. 12 FACTOR APP ▸ Backing Services as Attached Resource ▸ Services consumed over the network ▸ No distinction between local or third party services ▸ Keep Dependencies de-coupled ▸ Attach and detach at will
  • 40. WHAT WE DO? ▸ We use AWS services for both SQL and NoSQL data storage (RDS,DynamoDB)
  • 41. 12 FACTOR APP ▸ Build and Run Stages are separated ▸ Impossible to change code at runtime ▸ Releases should have IDs ▸ Build may be complex, started by Devs ▸ Run is simple and completely unattended
  • 43. 12 FACTOR APP ▸ Application Executed as Stateless Processes ▸ Share Nothing (Universal Scalability Law) ▸ Persisted data in stateful backing store ▸ Memory and File System is for cache only ▸ Avoid sticky Sessions
  • 44. WHAT WE DO? ▸ We implemented stateless serverless architecture with AWS API Gateway and Lambda. ▸ Each request to cloud is executed within a Lambda function inside a isolated stateless container
  • 45. 12 FACTOR APP ▸ Services Exported via Port Binding ▸ Self Contained ▸ Embedded servers ▸ Listen on specific port ▸ Very specific and idealistic
  • 46. 12 FACTOR APP ▸ Application scaled out via process model ▸ Processes are first class citizens ▸ Work assigned to process type ▸ Applications have process that span servers ▸ Use OS process managers not deamons
  • 47. 12 FACTOR APP ▸ Processes are disposable ▸ Can be started or stopped at any time ▸ Minimal start up time, graceful shutdown ▸ Worker processes return to work queue ▸ Robust against sudden death
  • 48. 12 FACTOR APP ▸ Parity Between Application Environments ▸ Avoid time/personnel/tool gaps ▸ Design for continuous deployment ▸ Very important for backing services ▸ Containers and config mgmt. makes this easier.
  • 49. 12 FACTOR APP ▸ Logs are stream of time-ordered events ▸ App is never concerned with storing log files ▸ Execution environment capture logs ▸ May be routed to file, watched, sent to external service
  • 50. WHAT WE DO? ▸ We use AWS CloudWatch to monitor system logs.
  • 51. 12 FACTOR APP ▸ Management Task Run as One-off Process ▸ Run in identical environment ▸ Separate out as scripts that are source controlled ▸ Don’t run from local terminal ▸ Don’t run directly against the database
  • 52. ADDITIONAL DEVOPS DESIGN CONSIDERATIONS ▸ Rely on sync messaging ▸ Compose applications out of service ▸ Assess portability requirements ▸ Embrace the abstractions
  • 53. DEVOPS ANTI-PATTERNS ▸ Relying on the local file system ▸ Building services that scale up ▸ Trying to change code server side ▸ Manually coordinating builds ▸ Hard-coding configuration ▸ Cramming everything into one app
  • 54. DEVOPS CONCEPTS BEFORE FAILURE ▸ Chaos Monkey ▸ Blue/Green - Canary Deployment ▸ Dependency Injection ▸ Andon Cords ▸ The Cloud ▸ Embedded Teams
  • 55. DEVOPS CONCEPTS AFTER FAILURE ▸ Blameless Postmortems ▸ Public Status Page ▸ Developers on Call ▸ Incident Command System
  • 56. CAMS MODEL ▸ Culture ▸ Automation ▸ Measurement ▸ Sharing
  • 57. KAIZEN’S GUIDES ▸ Good processes bring good results ▸ Go see for yourself (gemba) ▸ Speak with data, manage by facts ▸ Take action to contain and correct root causes ▸ Work as a team ▸ Kaizen is everybody’s business
  • 59. LEVELS OF MATURITY OF DEVOPS PROCESS
  • 61. CLOUD
  • 62.
  • 63. CLOUD APPLICATION DELIVERY MODELS ▸ IaaS (Infrastructure as a Service) - Host ▸ PaaS (Platform as a Service) - Build ▸ SaaS (Software as a Service) - Consume
  • 64.
  • 65.
  • 68. AWS IOT COMPONENTS ▸ Device Gateway ▸ Enables devices to securely and efficiently communicate with AWS IoT. ▸ Message Broker ▸ Provides a secure mechanism for things and AWS IoT applications to publish and receive messages from each other. You can use either the MQTT protocol directly or MQTT over WebSocket to publish and subscribe. You can use the HTTP REST interface to publish.
  • 69. AWS IOT COMPONENTS ▸ Rule Engine ▸ Provides message processing and integration with other AWS services. You can use a SQL-based language to select data from message payloads, process and send the data to other services, such as Amazon S3, Amazon DynamoDB, and AWS Lambda. You can also use the message broker to republish messages to other subscribers ▸ Security and Identity Service ▸ Provides shared responsibility for security in the AWS cloud. Your things must keep their credentials safe in order to securely send data to the message broker. The message broker and rules engine use AWS security features to send data securely to devices or other AWS services.
  • 70. AWS IOT COMPONENTS ▸ Thing registry ▸ Organizes the resources associated with each thing. You register your things and associate up to three custom attributes with each thing. You can also associate certificates and MQTT client IDs with each thing to improve your ability to manage and troubleshoot your things.Security and Identity Service. ▸ Thing Shadow Service ▸ Provides persistent representations of your things in the AWS cloud. You can publish updated state information to a thing shadow, and your thing can synchronize its state when it connects. Your things can also publish their current state to a thing shadow for use by applications or devices.
  • 74. MOBILE SAMPLE BACKEND SERVERLESS ARCITECTURE
  • 76. AMAZON S3 HOSTED WEBSITE
  • 79. MICROSERVICE ▸ Is there a formal definition for microservice architecture ? ▸ No ▸ What is the Difference between monolithic and micro service styles? ▸ Easy to maintain ▸ Deployment ▸ Scaling
  • 80.
  • 81.
  • 82.
  • 84. ADVANTAGES ▸ Can use right tool for the job ▸ Can replace entire components easier ▸ Can scale specific components ▸ Super cloud friendly ▸ Will push you DevOps
  • 85. CHALLENGES ▸ Distributed/versioned configuration ▸ Auto configurations and refresh on runtime ▸ New services can auto register at startup ▸ Service registration and discovery ▸ Centralised log management ▸ Collects and visualise log events from distributed processes ▸ Circuit Breaker (Bulk Heading) ▸ Prevent problems with chain of failures ▸ Security
  • 87. SUN’S FALLACIES OF DISTRIBUTED COMPUTING ▸ The network is reliable. ▸ Latency is zero. ▸ Bandwidth is infinite. ▸ The network is secure. ▸ Topology doesn't change. ▸ There is one administrator. ▸ Transport cost is zero. ▸ The network is homogeneous.
  • 88. ANY ORGANIZATION THAT DESIGNS A SYSTEM WILL PRODUCE A DESIGN WHOSE STRUCTURE IS A COPY OF THE ORGANIZATION’S COMMUNICATION STRUCTURE. Melvin Conway CONWAY’S LAW
  • 89. DEMO