SlideShare a Scribd company logo
and how to live with it
What is ServerlessWhat is Serverless
and how to live with it
Nikolay Markov, Pycon 2017
Shameless Plug
● My name is Nikolay Markov
● Senior Data Engineer at Aligned Research Group
● Used Python for 6+ years
● PyData Moscow Organizer
(http://meetup.com/PyData-Moscow/)
● Python, C++, Scala and FP are good, everything with
“java” in its title is bad, haven’t decided about Go yet
What is Data Engineering?
They said DevOps means everything and nothing at once
● And, of course, it’s different in every
company
● As Big Data is, isn’t it?
● Also, writing a good code is not a data
scientist’s job, but math and stats is
● So, what the hell is Serverless and what
Python has to do with all this?
Pipelines (+ ETL’s)
● Airflow/Luigi/Jenkins
● Bash
● RabbitMQ/Apache Kafka
● SQL
● MongoDB/HBase
● ELK
● …
● PROFIT
Enough marketing words!
Let’s talk about Clouds, Big Data and Microservices instead!
Let’s get ourselves some cloud
● Move the slider - get the
resources
● Cut the cloud into pieces
(VMs)
● Now let’s have DevOps guys
to support them…
● You see where this is going,
right?
So, what is Serverless then?
● An application that significantly or fully depend on 3rd party
cloud-based applications/services to manage server-side logic and state
(Backend as a Service).
● Parts of a business logic run in stateless compute containers that are
event-triggered, ephemeral (may only last for one invocation), and fully
managed by a 3rd party (Function as a Service).
https://martinfowler.com/articles/serverless.html
Typical cases: API
● Someone or something is querying your service
● You do some background magic and return the result
Typical cases: Storage
● Object storage
● Document storage
● Analytic storage
● BI/Data Warehouse
Typical cases: Mobile/IoT
● Sending messages and notifications
● Collecting data from a network of devices
● Launch events directly on devices
● Build cross-platform apps and firmwares
Typical cases: CI/CD and Security
● Run tests
● Simulate user traffic
● Security analysis
● Build packages
● Roll out updates
Typical cases: Distributed Computing
*aaS pandemia
FaaS to rule them all
Perks and advantages
● Decrease the load on DevOps
● Pay per usage time
● Just write your business logic
Bad stuff
● Tied to a particular vendor
● May become expensive at some point
● Limited resources
More than 1 hour to get results? Perfect!
More streamy-like should do it, right?
Bash pipe
~$ sleep 3 | echo “OK”
Link to my Bash pipeline talk slides (in Russian): http://bit.ly/2tfdUCG
To stream or not to stream?
Let’s run some code!
1.
Let’s run some code!
2.
Let’s run some code!
3.
Events and triggers
● Write code and pack it
with dependencies
● Bind to certain events
● Configure security policies
● …
● Manually it’s kinda hard
You need a framework!
Chalice
Here’s how it looks
+
Serverless:
~$ sls create -t aws-python3
Apex:
~$ apex init
(+ .tf files for Hashicorp Terraform)
Here’s how it looks
{
"name": "mycoolproject",
"description": "My cool
project that does stuff",
"runtime": "python3.6",
"memory": 128,
"timeout": 5,
"role":
"arn:aws:iam::SECRET:role/mycool
project_lambda_function",
"environment": {}
}
Apex:
service: aws-python3 provider:
name: aws
runtime: python3.6
functions:
hello:
handler: handler.do_stuff
events:
- http:
path: items/{item_id}
method: get
Serverless:
All you need after that is “import boto3”, write magic and
“sls deploy” or “apex deploy”
{
"dev": {
"app_function": "app.app",
"aws_region": "us-west-1",
"profile_name": "default",
"s3_bucket": "zappa-20d98oewi"
}
}
It’s similar with microservice frameworks
Zappa:
And your cloud-based Flask/Django/WSGI app runs as
fast as “zappa deploy”
Chalice:
Basically just Flask
import pywren
def myfunc(args):
# Do something!
return result
pwex = pywren.default_executor()
futures = pwex.map(myfunc, args)
results = pwex.get_all_results(futures)
PyWren
http://pywren.io/
Some gotchas
● Mind your library-dependent requirements! (install
serverless-python-requirements for Serverless)
Manually:
https://stackoverflow.com/questions/34749806/using-mo
viepy-scipy-and-numpy-in-amazon-lambda
Pre-built:
https://github.com/Miserlou/lambda-packages
● Nothing in Lambda console? Try CloudFormation!
Some limits of AWS Lambda
● <= 512 Mb HD
● Request size <= 6Mb (if Event - 128K)
● <= 1000 concurrent executions per region
● <= 50 Mb compressed deployment package size
● <= 250 Mb uncompressed
● <= 75 Gb total packages uploaded per region
● <= 5 minutes run per request
https://docs.aws.amazon.com/lambda/latest/dg/limits.htm
l
AWS Lambda pricing
● First 1 million requests per month are free
● $0.20 per 1 million requests thereafter ($0.0000002 per
request)
● The Lambda free tier includes 1M free requests per
month and 400,000 GB-seconds of compute time per
month.
● API Gateway: $3.50 per million API calls received, plus
the cost of data transfer out, in gigabytes.
https://aws.amazon.com/lambda/pricing/
https://aws.amazon.com/api-gateway/pricing/
How to test your serverless applications
Run lambdas:
https://github.com/lambci/docker-lambda
Mock Boto:
https://github.com/spulec/moto
«Что такое serverless-архитектура и как с ней жить?» Николай Марков, Aligned Research Group

More Related Content

PDF
Как сделать высоконагруженный сервис, не зная количество нагрузки / Олег Обле...
PDF
Tracing Microservices with Zipkin
PPTX
PostgreSQL @Alibaba Cloud / Xianming Dou (Alibaba Cloud)
PDF
High Performance Systems in Go - GopherCon 2014
PDF
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
PPT
The MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.js
PDF
Javantura 2014 - Java 8 JavaScript Nashorn
PPTX
Silverstripe at scale - design & architecture for silverstripe applications
Как сделать высоконагруженный сервис, не зная количество нагрузки / Олег Обле...
Tracing Microservices with Zipkin
PostgreSQL @Alibaba Cloud / Xianming Dou (Alibaba Cloud)
High Performance Systems in Go - GopherCon 2014
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
The MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.js
Javantura 2014 - Java 8 JavaScript Nashorn
Silverstripe at scale - design & architecture for silverstripe applications

What's hot (19)

ODP
RSYSLOG v8 improvements and how to write plugins in any language.
PDF
Modern Web App Development using ClojureScript & React.js / Baishampayan “BG”...
PPTX
Introduction to Napa.js
PDF
Using AWS CloudFront with S3 at SMARTSTUDY
PDF
Monitoring a billion kilometers of monthly ride sharing at BlaBlaCar - Zabbix...
PDF
Vert.x introduction
PDF
Development with Vert.x: an event-driven application framework for the JVM
PDF
Server-Side JavaScript with Nashorn
PDF
Open Source Cyber Weaponry
PDF
Understanding Non Blocking I/O with Python
ODP
The rsyslog v8 engine (developer's view)
PPTX
Real World Enterprise Reactive Programming using Vert.x
PDF
02 vng thanhnt-speedup_ntvv2_by_ph_pextmodule_
PDF
Midwest php 2013 deploying php on paas- why & how
ODP
Sensu at brightpearl
PPTX
Rsyslog version naming (v8.6.0+)
PDF
Zabbix 3.0 and beyond - FISL 2015
PDF
Nodejs
PDF
Zingme practice for building scalable website with PHP
RSYSLOG v8 improvements and how to write plugins in any language.
Modern Web App Development using ClojureScript & React.js / Baishampayan “BG”...
Introduction to Napa.js
Using AWS CloudFront with S3 at SMARTSTUDY
Monitoring a billion kilometers of monthly ride sharing at BlaBlaCar - Zabbix...
Vert.x introduction
Development with Vert.x: an event-driven application framework for the JVM
Server-Side JavaScript with Nashorn
Open Source Cyber Weaponry
Understanding Non Blocking I/O with Python
The rsyslog v8 engine (developer's view)
Real World Enterprise Reactive Programming using Vert.x
02 vng thanhnt-speedup_ntvv2_by_ph_pextmodule_
Midwest php 2013 deploying php on paas- why & how
Sensu at brightpearl
Rsyslog version naming (v8.6.0+)
Zabbix 3.0 and beyond - FISL 2015
Nodejs
Zingme practice for building scalable website with PHP
Ad

Similar to «Что такое serverless-архитектура и как с ней жить?» Николай Марков, Aligned Research Group (20)

PDF
Writing and deploying serverless python applications
PDF
PyConIE 2017 Writing and deploying serverless python applications
PDF
PyConIT 2018 Writing and deploying serverless python applications
PDF
Python in the land of serverless
PDF
Python in the serverless era (PyCon 2017)
PDF
Čtvrtkon #64 - AWS Serverless - Michal Haták
PDF
Microservices and Serverless for Mega Startups - DevOps IL Meetup
PDF
Jumpstart your idea with AWS Serverless [Oct 2020]
PDF
Serverless: A love hate relationship
PPTX
Primeros pasos en desarrollo serverless
PDF
Python in the Serverless Era (PyCon IL 2016)
PPTX
Serverless at Lifestage
PDF
AWS Lambda Deep Dive
PDF
Building serverless applications (April 2018)
PDF
Serverless Streaming Architectures and Algorithms for the Enterprise
PDF
Origins of Serverless
PPTX
What is Serverless Computing?
PDF
2022 Presentation | Serverless Innovation with AWS
PDF
Proof of Concept: Serverless with Swarm by Nirmal Mehta, Booz Allen Hamilton
PDF
Serverless brewbox
Writing and deploying serverless python applications
PyConIE 2017 Writing and deploying serverless python applications
PyConIT 2018 Writing and deploying serverless python applications
Python in the land of serverless
Python in the serverless era (PyCon 2017)
Čtvrtkon #64 - AWS Serverless - Michal Haták
Microservices and Serverless for Mega Startups - DevOps IL Meetup
Jumpstart your idea with AWS Serverless [Oct 2020]
Serverless: A love hate relationship
Primeros pasos en desarrollo serverless
Python in the Serverless Era (PyCon IL 2016)
Serverless at Lifestage
AWS Lambda Deep Dive
Building serverless applications (April 2018)
Serverless Streaming Architectures and Algorithms for the Enterprise
Origins of Serverless
What is Serverless Computing?
2022 Presentation | Serverless Innovation with AWS
Proof of Concept: Serverless with Swarm by Nirmal Mehta, Booz Allen Hamilton
Serverless brewbox
Ad

More from it-people (20)

PDF
«Про аналитику и серебряные пули» Александр Подсобляев, Rambler&Co
PDF
«Scrapy internals» Александр Сибиряков, Scrapinghub
PDF
«Отладка в Python 3.6: Быстрее, Выше, Сильнее» Елизавета Шашкова, JetBrains
PDF
«Gevent — быть или не быть?» Александр Мокров, Positive Technologies
PDF
«Ещё один Поиск Яндекса» Александр Кошелев, Яндекс
PDF
«How I Learned to Stop Worrying and Love the BFG: нагрузочное тестирование со...
PDF
«Write once run anywhere — почём опиум для народа?» Игорь Новиков, Scalr
PDF
«Gensim — тематическое моделирование для людей» Иван Меньших, Лев Константино...
PDF
«Тотальный контроль производительности» Михаил Юматов, ЦИАН
PDF
«Детские болезни live-чата» Ольга Сентемова, Тинькофф Банк
PDF
«Микросервисы наносят ответный удар!» Олег Чуркин, Rambler&Co
PDF
«Память и Python. Что надо знать для счастья?» Алексей Кузьмин, ЦНС
PDF
«Python на острие бритвы: PyPy project» Александр Кошкин, Positive Technologies
PDF
«PyWat. А хорошо ли вы знаете Python?» Александр Швец, Marilyn System
PDF
«(Без)опасный Python», Иван Цыганов, Positive Technologies
PDF
«Python of Things», Кирилл Борисов, Яндекс
PDF
«Как сделать так, чтобы тесты на Swift не причиняли боль» Сычев Александр, Ra...
PDF
«Клиенту и серверу нужно поговорить» Прокопов Никита, Cognician
PDF
«Кошелек или деньги: сложный выбор между памятью и процессором» Алексеенко Иг...
PDF
ЗАВИСИМОСТИ В КОМПОНЕНТНОМ ВЕБЕ, ПРИГОТОВЛЕННЫЕ ПРАВИЛЬНО, Гриненко Владимир,...
«Про аналитику и серебряные пули» Александр Подсобляев, Rambler&Co
«Scrapy internals» Александр Сибиряков, Scrapinghub
«Отладка в Python 3.6: Быстрее, Выше, Сильнее» Елизавета Шашкова, JetBrains
«Gevent — быть или не быть?» Александр Мокров, Positive Technologies
«Ещё один Поиск Яндекса» Александр Кошелев, Яндекс
«How I Learned to Stop Worrying and Love the BFG: нагрузочное тестирование со...
«Write once run anywhere — почём опиум для народа?» Игорь Новиков, Scalr
«Gensim — тематическое моделирование для людей» Иван Меньших, Лев Константино...
«Тотальный контроль производительности» Михаил Юматов, ЦИАН
«Детские болезни live-чата» Ольга Сентемова, Тинькофф Банк
«Микросервисы наносят ответный удар!» Олег Чуркин, Rambler&Co
«Память и Python. Что надо знать для счастья?» Алексей Кузьмин, ЦНС
«Python на острие бритвы: PyPy project» Александр Кошкин, Positive Technologies
«PyWat. А хорошо ли вы знаете Python?» Александр Швец, Marilyn System
«(Без)опасный Python», Иван Цыганов, Positive Technologies
«Python of Things», Кирилл Борисов, Яндекс
«Как сделать так, чтобы тесты на Swift не причиняли боль» Сычев Александр, Ra...
«Клиенту и серверу нужно поговорить» Прокопов Никита, Cognician
«Кошелек или деньги: сложный выбор между памятью и процессором» Алексеенко Иг...
ЗАВИСИМОСТИ В КОМПОНЕНТНОМ ВЕБЕ, ПРИГОТОВЛЕННЫЕ ПРАВИЛЬНО, Гриненко Владимир,...

Recently uploaded (20)

PDF
RPKI Status Update, presented by Makito Lay at IDNOG 10
PPTX
SAP Ariba Sourcing PPT for learning material
PPT
tcp ip networks nd ip layering assotred slides
PPTX
Introuction about WHO-FIC in ICD-10.pptx
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PDF
Paper PDF World Game (s) Great Redesign.pdf
PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
PPTX
presentation_pfe-universite-molay-seltan.pptx
PPTX
Introduction to Information and Communication Technology
PDF
Testing WebRTC applications at scale.pdf
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PPTX
innovation process that make everything different.pptx
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PDF
The Internet -By the Numbers, Sri Lanka Edition
PDF
WebRTC in SignalWire - troubleshooting media negotiation
PPTX
PptxGenJS_Demo_Chart_20250317130215833.pptx
PDF
Slides PDF The World Game (s) Eco Economic Epochs.pdf
PDF
Triggering QUIC, presented by Geoff Huston at IETF 123
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
RPKI Status Update, presented by Makito Lay at IDNOG 10
SAP Ariba Sourcing PPT for learning material
tcp ip networks nd ip layering assotred slides
Introuction about WHO-FIC in ICD-10.pptx
Unit-1 introduction to cyber security discuss about how to secure a system
Paper PDF World Game (s) Great Redesign.pdf
522797556-Unit-2-Temperature-measurement-1-1.pptx
presentation_pfe-universite-molay-seltan.pptx
Introduction to Information and Communication Technology
Testing WebRTC applications at scale.pdf
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Job_Card_System_Styled_lorem_ipsum_.pptx
innovation process that make everything different.pptx
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
The Internet -By the Numbers, Sri Lanka Edition
WebRTC in SignalWire - troubleshooting media negotiation
PptxGenJS_Demo_Chart_20250317130215833.pptx
Slides PDF The World Game (s) Eco Economic Epochs.pdf
Triggering QUIC, presented by Geoff Huston at IETF 123
Tenda Login Guide: Access Your Router in 5 Easy Steps

«Что такое serverless-архитектура и как с ней жить?» Николай Марков, Aligned Research Group

  • 1. and how to live with it What is ServerlessWhat is Serverless and how to live with it Nikolay Markov, Pycon 2017
  • 2. Shameless Plug ● My name is Nikolay Markov ● Senior Data Engineer at Aligned Research Group ● Used Python for 6+ years ● PyData Moscow Organizer (http://meetup.com/PyData-Moscow/) ● Python, C++, Scala and FP are good, everything with “java” in its title is bad, haven’t decided about Go yet
  • 3. What is Data Engineering? They said DevOps means everything and nothing at once ● And, of course, it’s different in every company ● As Big Data is, isn’t it? ● Also, writing a good code is not a data scientist’s job, but math and stats is ● So, what the hell is Serverless and what Python has to do with all this?
  • 4. Pipelines (+ ETL’s) ● Airflow/Luigi/Jenkins ● Bash ● RabbitMQ/Apache Kafka ● SQL ● MongoDB/HBase ● ELK ● … ● PROFIT
  • 5. Enough marketing words! Let’s talk about Clouds, Big Data and Microservices instead!
  • 6. Let’s get ourselves some cloud ● Move the slider - get the resources ● Cut the cloud into pieces (VMs) ● Now let’s have DevOps guys to support them… ● You see where this is going, right?
  • 7. So, what is Serverless then? ● An application that significantly or fully depend on 3rd party cloud-based applications/services to manage server-side logic and state (Backend as a Service). ● Parts of a business logic run in stateless compute containers that are event-triggered, ephemeral (may only last for one invocation), and fully managed by a 3rd party (Function as a Service). https://martinfowler.com/articles/serverless.html
  • 8. Typical cases: API ● Someone or something is querying your service ● You do some background magic and return the result
  • 9. Typical cases: Storage ● Object storage ● Document storage ● Analytic storage ● BI/Data Warehouse
  • 10. Typical cases: Mobile/IoT ● Sending messages and notifications ● Collecting data from a network of devices ● Launch events directly on devices ● Build cross-platform apps and firmwares
  • 11. Typical cases: CI/CD and Security ● Run tests ● Simulate user traffic ● Security analysis ● Build packages ● Roll out updates
  • 14. FaaS to rule them all
  • 15. Perks and advantages ● Decrease the load on DevOps ● Pay per usage time ● Just write your business logic Bad stuff ● Tied to a particular vendor ● May become expensive at some point ● Limited resources
  • 16. More than 1 hour to get results? Perfect!
  • 17. More streamy-like should do it, right?
  • 18. Bash pipe ~$ sleep 3 | echo “OK” Link to my Bash pipeline talk slides (in Russian): http://bit.ly/2tfdUCG
  • 19. To stream or not to stream?
  • 20. Let’s run some code! 1.
  • 21. Let’s run some code! 2.
  • 22. Let’s run some code! 3.
  • 23. Events and triggers ● Write code and pack it with dependencies ● Bind to certain events ● Configure security policies ● … ● Manually it’s kinda hard
  • 24. You need a framework! Chalice
  • 25. Here’s how it looks + Serverless: ~$ sls create -t aws-python3 Apex: ~$ apex init (+ .tf files for Hashicorp Terraform)
  • 26. Here’s how it looks { "name": "mycoolproject", "description": "My cool project that does stuff", "runtime": "python3.6", "memory": 128, "timeout": 5, "role": "arn:aws:iam::SECRET:role/mycool project_lambda_function", "environment": {} } Apex: service: aws-python3 provider: name: aws runtime: python3.6 functions: hello: handler: handler.do_stuff events: - http: path: items/{item_id} method: get Serverless: All you need after that is “import boto3”, write magic and “sls deploy” or “apex deploy”
  • 27. { "dev": { "app_function": "app.app", "aws_region": "us-west-1", "profile_name": "default", "s3_bucket": "zappa-20d98oewi" } } It’s similar with microservice frameworks Zappa: And your cloud-based Flask/Django/WSGI app runs as fast as “zappa deploy” Chalice: Basically just Flask
  • 28. import pywren def myfunc(args): # Do something! return result pwex = pywren.default_executor() futures = pwex.map(myfunc, args) results = pwex.get_all_results(futures) PyWren http://pywren.io/
  • 29. Some gotchas ● Mind your library-dependent requirements! (install serverless-python-requirements for Serverless) Manually: https://stackoverflow.com/questions/34749806/using-mo viepy-scipy-and-numpy-in-amazon-lambda Pre-built: https://github.com/Miserlou/lambda-packages ● Nothing in Lambda console? Try CloudFormation!
  • 30. Some limits of AWS Lambda ● <= 512 Mb HD ● Request size <= 6Mb (if Event - 128K) ● <= 1000 concurrent executions per region ● <= 50 Mb compressed deployment package size ● <= 250 Mb uncompressed ● <= 75 Gb total packages uploaded per region ● <= 5 minutes run per request https://docs.aws.amazon.com/lambda/latest/dg/limits.htm l
  • 31. AWS Lambda pricing ● First 1 million requests per month are free ● $0.20 per 1 million requests thereafter ($0.0000002 per request) ● The Lambda free tier includes 1M free requests per month and 400,000 GB-seconds of compute time per month. ● API Gateway: $3.50 per million API calls received, plus the cost of data transfer out, in gigabytes. https://aws.amazon.com/lambda/pricing/ https://aws.amazon.com/api-gateway/pricing/
  • 32. How to test your serverless applications Run lambdas: https://github.com/lambci/docker-lambda Mock Boto: https://github.com/spulec/moto