Solving Python cold start issues in cloud infrastructure

Denys Makogon

Abstract

First of all, this talk brings quite important, but still ignored the problem of python application startup time. This talk is very useful for people who strive for better python application performance. Also, I'd like to share some techniques for performance profiling and problem-solving.

Description

Intro

We all do cloud applications, no matter if they were built with the cloud (an app that consumes cloud services) or for cloud (an app that was designed to run within cloud/container). The only thing that we, as Python community, haven’t talked out loud is imports performance that is so critical for business especially when you run your own business and cloud provider charges your own credit card.

Problem area

Until Python 3.7 it was quite challenging to profile application code dependencies and imports specifically. With a new imports profiler, Python developers can measure how much time each import takes at the startup. The interesting thing, a new profiler opened the whole new Python problem - cold start issue. In this talk, we will go through one very challenging case: Python in serverless and why most of the Python libraries were never been designed to start fast.

If you’re going to attend this talk you’d get the following key takeaways:

  • Python coding strategy (placement, efficient and delayed imports)

  • New things in Python 3.7 related to imports

  • Module coding strategy.

and my favourite ones:

  • Why you should be careful with python code in serverless.

  • How to profile cold start and measure overall startup time.

  • The best CPU/RAM configuration for performing cold startup time measures.

WHO is the intended audience for your talk and why you should attend it?

First of all, developers, who got used to code a lot and host their apps in the cloud. Specifically, Python developers who performance testing and adjustments, while running applications in the cloud, but the key target audience here are the developers who do serverless applications and would like to learn some best practices and get into the problem area.

WHAT are you going to be talking about and WHAT will people learn from your talk?

In this talk, I'll try to explain why and showcase why there's a need to change the way we do Python applications in the clouds, why performance matters and why "python was not designed to run on tight resources" is a fake statement.

WHY is your talk important/interesting/useful? Explain why people would want to attend your talk.

Let's decouple these questions onto three.

1. Why my talk is important?

Because most of the developers along with Python core team doesn't make much about the problem of performance, people think that Python and high performance is not something possible. So, during my talk, I'd like to bring this topic to a wider audience around the globe in order to collect the feedback along with showcasing why it matters a lot to people who do cloud-based applications.

2. Why my talk is interesting?

Well, based on my experience, at almost all Python events around the world I've attended, people were talking about ML/AI, Django. But nothing about Python performance, because, maybe people don't care about that much, but when you get a bill from your cloud provider you may wonder why does it have $$$$ amount to pay.

3. Why my talk is useful?

I'll be giving exact tips on how to make the code efficient and be less resource-intensive (at least I will try to). So, my talk will consist of speaking, coding, giving tips. Isn't that a good mix for a good talk?

HOW will you be delivering your talk?

Speaking, giving tips, coding and expect to get a good discussion in QA session and after-talk activities.

Bio

Software enthusiast focused on developing and designing platform and software as a service application for clouds. He’s a principal software developer in Oracle, concentrating on product development along with bringing well-designed and production ready integration with clouds solutions, contributor to various open source projects, cloud-related technologies along having fun with IoT devices and photography. Denis is a regular attendee and speaker at OpenStack summits (Atlanta, Austin, Paris, Barcelona, Boston) and PyCon Hong Kong 2016, 2017, PyCon Italy 2018. co-author of OpenStack Application development, OpenStack Trove Essentials.