Building a high performing Asynchronous Web Application in Python using Sanic Framework

Nitin Bhojwani (~nitinbhojwani)


Description:

Web Applications today spends most of the time waiting for calls to DB, calls to third party apis or other services APIs. That is I/O calls in general.

This is the reason for increasing focus on I/O optimizations and gaining popularity of Node JS and Go Lang. Also, Reactive Pattern is gaining lot of popularity in Java world also.

Considering AsyncIO:

asyncio is a library to write concurrent code using the async/await syntax.

Eventloop is at the core of AsyncIO and Using uvloop as the event loop for AsyncIO can even further increase the performance:

https://magic.io/blog/uvloop-blazing-fast-python-networking/

There is a popular web framework built on top of uvloop eventloop. And this talk will be introducing the audience to a blazing fast and truly asynchronous Web Framework called Sanic:

Sanic is a Python 3.6+ web server and web framework that’s written to go fast. It allows the usage of the async/await syntax added in Python 3.5, which makes your code non-blocking and speedy.

The goal of the project is to provide a simple way to get up and running a highly performant HTTP server that is easy to build, to expand, and ultimately to scale.

Let's also see how should we build an async application in Python which is faster than NodeJs and almost equal to GoLang.

Planned Talk Outline

  • Problem Statement: Issues with Multi-processing and multi-threading way of service an application
  • Solution: Async way of serving an application
  • How: Async Web Application using Sanic Framework
    • Think Async
    • Look at small web application with async / await syntax based code
  • Takeaways
  • Conclusion

Take Aways

  • Understand the need of Asynchronous and Event-driven approach (AsycIO) for efficient performance
  • Look at how code looks like in a Sanic application

Prerequisites:

  • Python Basics
  • I/O Workloads

Content URLs:

https://www.slideshare.net/secret/vcEa5SgffonCqv

Speaker Info:

Nitin Bhojwani has experience of around 5 years working in Python, in which he has worked on various scalable web applications. He likes Python and keeps exploring better ways of getting things done in Python. He is learning Machine Learning using Python.

Apart from Python, he has experience on SRE and UI development as well.

Speaker Links:

Blog https://nitinbhojwani-tech-talk.blogspot.com

Open Source Contributions

  • https://github.com/jsocol/django-ratelimit/pull/100
  • https://github.com/jsocol/django-jsonview/pull/32

Slides

  • https://www.slideshare.net/NitinBhojwani

Previous Talks

  • https://www.usenix.org/conference/srecon19asia/presentation/bhojwani

Id: 1163
Section: Web development
Type: Talks
Target Audience: Intermediate
Last Updated: