SlideShare uma empresa Scribd logo
1 de 26
Baixar para ler offline
Send Balls Into Orbit with
Python3, AsyncIO,
WebSockets, Redis and React
Taras Lyapun, KhmelnitskiyPy#1
About me
- Organizer of KhmelnytskyiPy

- CTO at Turfmapp.com

- Founder of Four-Eyes.IO
Turfmapp.com
• Find places and company to
play soccer

• Like meetup.com, but soccer
specific

• Like runkeeper.com, but for
team sports

• Chicago based startup, with
R&D office in Khmelnitskiy
What is this story
about?
- We had everything for players
before game

- But we didn’t have anything for
game

- Introduce - Mini Challenges
Send Balls Into Orbit with Python3, AsyncIO,
WebSockets, Redis and React
Send Balls Into Orbit with Python3, AsyncIO,
WebSockets, Redis and React
Python
• Simple

• Maintainable

• Powerful

• Great syntax

• Can be used for anything:

• web

• network

• math

• ML

• NLP

• etc

• Great community!
Send Balls Into Orbit with Python3, AsyncIO,
WebSockets, Redis and React
Python3
• New, modern version of
Language

• A lot of improvements

• Unicode everywhere

• Lazy by default

• One more thing…
Send Balls Into Orbit with Python3, AsyncIO,
WebSockets, Redis and React
AsyncIO
• Allows you to start event loop, and execute your code
asynchronously without additional libraries or frameworks
• So you can write your python code in both ways - sync
and async, depends on your task
• Allows you easy support thousands persistent
connections without threads overhead
• The best way to deal with network
Introduction to Asynchronous Programming
http://cs.brown.edu/courses/cs168/f12/handouts/async.pdf
PEP-0492
PEP-0492
Send Balls Into Orbit with Python3, AsyncIO,
WebSockets, Redis and React
WebSockets
• Full-duplex communication channel over TCP
• Allow you to have real-time communication between
server and client
• Supported by most browsers, but can be used also with
any client (ios, android, whatever)
• aiohttp handles it well
aiohttp
Send Balls Into Orbit with Python3, AsyncIO,
WebSockets, Redis and React
Redis
• Advanced Key-Value cache
and store

• Strings, hashes, lists, sets, etc

• Publish Subscribe

• High performance with good
enough level of persistency for
this task
asyncio-redis
Another Decisions
• Always send full state of game (everything needed to
display screen), instead of sending incremental updates -
easy and error prone
• How to deal with concurrency updates? - Some sort of
optimistic locks
• Use JSON for easy extending protocol
• Process all data through Redis - for easy scale
Send Balls Into Orbit with Python3, AsyncIO,
WebSockets, Redis and React
Thanks!

Mais conteúdo relacionado

Destaque

2013-02-02 03 Голушко. Полнотекстовый поиск с Elasticsearch
2013-02-02 03 Голушко. Полнотекстовый поиск с Elasticsearch2013-02-02 03 Голушко. Полнотекстовый поиск с Elasticsearch
2013-02-02 03 Голушко. Полнотекстовый поиск с Elasticsearch
Омские ИТ-субботники
 
The Apache Solr Smart Data Ecosystem
The Apache Solr Smart Data EcosystemThe Apache Solr Smart Data Ecosystem
The Apache Solr Smart Data Ecosystem
Trey Grainger
 
Searching on Intent: Knowledge Graphs, Personalization, and Contextual Disamb...
Searching on Intent: Knowledge Graphs, Personalization, and Contextual Disamb...Searching on Intent: Knowledge Graphs, Personalization, and Contextual Disamb...
Searching on Intent: Knowledge Graphs, Personalization, and Contextual Disamb...
Trey Grainger
 

Destaque (20)

PyCon Poland 2016: Maintaining a high load Python project: typical mistakes
PyCon Poland 2016: Maintaining a high load Python project: typical mistakesPyCon Poland 2016: Maintaining a high load Python project: typical mistakes
PyCon Poland 2016: Maintaining a high load Python project: typical mistakes
 
Автоматизация анализа логов на базе Elasticsearch
Автоматизация анализа логов на базе ElasticsearchАвтоматизация анализа логов на базе Elasticsearch
Автоматизация анализа логов на базе Elasticsearch
 
Using Pivotal Cloud Foundry with Google’s BigQuery and Cloud Vision API
Using Pivotal Cloud Foundry with Google’s BigQuery and Cloud Vision APIUsing Pivotal Cloud Foundry with Google’s BigQuery and Cloud Vision API
Using Pivotal Cloud Foundry with Google’s BigQuery and Cloud Vision API
 
Shadow Fight 2: архитектура системы аналитики для миллиарда событий
Shadow Fight 2: архитектура системы аналитики для миллиарда событийShadow Fight 2: архитектура системы аналитики для миллиарда событий
Shadow Fight 2: архитектура системы аналитики для миллиарда событий
 
Optimizing Data Architecture for Natural Language Processing
Optimizing Data Architecture for Natural Language ProcessingOptimizing Data Architecture for Natural Language Processing
Optimizing Data Architecture for Natural Language Processing
 
2013-02-02 03 Голушко. Полнотекстовый поиск с Elasticsearch
2013-02-02 03 Голушко. Полнотекстовый поиск с Elasticsearch2013-02-02 03 Голушко. Полнотекстовый поиск с Elasticsearch
2013-02-02 03 Голушко. Полнотекстовый поиск с Elasticsearch
 
Natural Language Processing and Python
Natural Language Processing and PythonNatural Language Processing and Python
Natural Language Processing and Python
 
GATE : General Architecture for Text Engineering
GATE : General Architecture for Text EngineeringGATE : General Architecture for Text Engineering
GATE : General Architecture for Text Engineering
 
Cloud Machine Learning with Google Cloud Platform
Cloud Machine Learning with Google Cloud PlatformCloud Machine Learning with Google Cloud Platform
Cloud Machine Learning with Google Cloud Platform
 
Natural Language Search in Solr
Natural Language Search in SolrNatural Language Search in Solr
Natural Language Search in Solr
 
Elastic Stackにハマった話
Elastic Stackにハマった話Elastic Stackにハマった話
Elastic Stackにハマった話
 
Machine learning with Google machine learning APIs - Puppy or Muffin?
Machine learning with Google machine learning APIs - Puppy or Muffin?Machine learning with Google machine learning APIs - Puppy or Muffin?
Machine learning with Google machine learning APIs - Puppy or Muffin?
 
Webscraping with asyncio
Webscraping with asyncioWebscraping with asyncio
Webscraping with asyncio
 
Text analysis and Semantic Search with GATE
Text analysis and Semantic Search with GATEText analysis and Semantic Search with GATE
Text analysis and Semantic Search with GATE
 
South Big Data Hub: Text Data Analysis Panel
South Big Data Hub: Text Data Analysis PanelSouth Big Data Hub: Text Data Analysis Panel
South Big Data Hub: Text Data Analysis Panel
 
The Apache Solr Smart Data Ecosystem
The Apache Solr Smart Data EcosystemThe Apache Solr Smart Data Ecosystem
The Apache Solr Smart Data Ecosystem
 
Searching on Intent: Knowledge Graphs, Personalization, and Contextual Disamb...
Searching on Intent: Knowledge Graphs, Personalization, and Contextual Disamb...Searching on Intent: Knowledge Graphs, Personalization, and Contextual Disamb...
Searching on Intent: Knowledge Graphs, Personalization, and Contextual Disamb...
 
NLTK: Natural Language Processing made easy
NLTK: Natural Language Processing made easyNLTK: Natural Language Processing made easy
NLTK: Natural Language Processing made easy
 
Natural Language Processing in R (rNLP)
Natural Language Processing in R (rNLP)Natural Language Processing in R (rNLP)
Natural Language Processing in R (rNLP)
 
2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locator2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locator
 

Semelhante a Send Balls Into Orbit with Python3, AsyncIO, WebSockets and React

Comet: by pushing server data, we push the web forward
Comet: by pushing server data, we push the web forwardComet: by pushing server data, we push the web forward
Comet: by pushing server data, we push the web forward
NOLOH LLC.
 

Semelhante a Send Balls Into Orbit with Python3, AsyncIO, WebSockets and React (20)

Web to App:作業系統革命 Firefox OS
Web to App:作業系統革命  Firefox OSWeb to App:作業系統革命  Firefox OS
Web to App:作業系統革命 Firefox OS
 
CCU_Speech
CCU_SpeechCCU_Speech
CCU_Speech
 
Elastic Data Analytics Platform @Datadog
Elastic Data Analytics Platform @DatadogElastic Data Analytics Platform @Datadog
Elastic Data Analytics Platform @Datadog
 
Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"
 
Realtime web2012
Realtime web2012Realtime web2012
Realtime web2012
 
Harmonic Stack for Speed
Harmonic Stack for SpeedHarmonic Stack for Speed
Harmonic Stack for Speed
 
Intro to CakePHP
Intro to CakePHPIntro to CakePHP
Intro to CakePHP
 
05 integrate redis
05 integrate redis05 integrate redis
05 integrate redis
 
Websockets: Pushing the web forward
Websockets: Pushing the web forwardWebsockets: Pushing the web forward
Websockets: Pushing the web forward
 
Basic computers for DIU laptop project students
Basic computers for DIU laptop project studentsBasic computers for DIU laptop project students
Basic computers for DIU laptop project students
 
Comet: by pushing server data, we push the web forward
Comet: by pushing server data, we push the web forwardComet: by pushing server data, we push the web forward
Comet: by pushing server data, we push the web forward
 
Scaling Machine Learning Systems up to Billions of Predictions per Day
Scaling Machine Learning Systems up to Billions of Predictions per DayScaling Machine Learning Systems up to Billions of Predictions per Day
Scaling Machine Learning Systems up to Billions of Predictions per Day
 
Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013
Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013
Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013
 
The world is not black and white – Impact of decisions over the lifetime of a...
The world is not black and white – Impact of decisions over the lifetime of a...The world is not black and white – Impact of decisions over the lifetime of a...
The world is not black and white – Impact of decisions over the lifetime of a...
 
IoT interoperability
IoT interoperabilityIoT interoperability
IoT interoperability
 
from ai.backend import python @ pycontw2018
from ai.backend import python @ pycontw2018from ai.backend import python @ pycontw2018
from ai.backend import python @ pycontw2018
 
Pi, Python, and Paintball??? Innovating with Affordable Tech!
Pi, Python, and Paintball??? Innovating with Affordable Tech!Pi, Python, and Paintball??? Innovating with Affordable Tech!
Pi, Python, and Paintball??? Innovating with Affordable Tech!
 
Pyconke2018
Pyconke2018Pyconke2018
Pyconke2018
 
IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...
IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...
IoT Service Bus - High availability with Internet of Things (IoT)/ API Rest/ ...
 
Basic of computers
Basic of computers Basic of computers
Basic of computers
 

Último

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 

Último (20)

AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 

Send Balls Into Orbit with Python3, AsyncIO, WebSockets and React

  • 1. Send Balls Into Orbit with Python3, AsyncIO, WebSockets, Redis and React Taras Lyapun, KhmelnitskiyPy#1
  • 2. About me - Organizer of KhmelnytskyiPy - CTO at Turfmapp.com - Founder of Four-Eyes.IO
  • 3. Turfmapp.com • Find places and company to play soccer • Like meetup.com, but soccer specific • Like runkeeper.com, but for team sports • Chicago based startup, with R&D office in Khmelnitskiy
  • 4. What is this story about? - We had everything for players before game - But we didn’t have anything for game - Introduce - Mini Challenges
  • 5. Send Balls Into Orbit with Python3, AsyncIO, WebSockets, Redis and React
  • 6. Send Balls Into Orbit with Python3, AsyncIO, WebSockets, Redis and React
  • 7. Python • Simple • Maintainable • Powerful • Great syntax • Can be used for anything: • web • network • math • ML • NLP • etc • Great community!
  • 8. Send Balls Into Orbit with Python3, AsyncIO, WebSockets, Redis and React
  • 9. Python3 • New, modern version of Language • A lot of improvements • Unicode everywhere • Lazy by default • One more thing…
  • 10. Send Balls Into Orbit with Python3, AsyncIO, WebSockets, Redis and React
  • 11. AsyncIO • Allows you to start event loop, and execute your code asynchronously without additional libraries or frameworks • So you can write your python code in both ways - sync and async, depends on your task • Allows you easy support thousands persistent connections without threads overhead • The best way to deal with network
  • 12. Introduction to Asynchronous Programming http://cs.brown.edu/courses/cs168/f12/handouts/async.pdf
  • 15. Send Balls Into Orbit with Python3, AsyncIO, WebSockets, Redis and React
  • 16. WebSockets • Full-duplex communication channel over TCP • Allow you to have real-time communication between server and client • Supported by most browsers, but can be used also with any client (ios, android, whatever) • aiohttp handles it well
  • 18. Send Balls Into Orbit with Python3, AsyncIO, WebSockets, Redis and React
  • 19. Redis • Advanced Key-Value cache and store • Strings, hashes, lists, sets, etc • Publish Subscribe • High performance with good enough level of persistency for this task
  • 21. Another Decisions • Always send full state of game (everything needed to display screen), instead of sending incremental updates - easy and error prone • How to deal with concurrency updates? - Some sort of optimistic locks • Use JSON for easy extending protocol • Process all data through Redis - for easy scale
  • 22. Send Balls Into Orbit with Python3, AsyncIO, WebSockets, Redis and React
  • 23.
  • 24.
  • 25.