{"id":108695,"date":"2023-05-16T09:27:21","date_gmt":"2023-05-16T16:27:21","guid":{"rendered":"https:\/\/www.backblaze.com\/blog\/?p=108695"},"modified":"2023-07-11T10:06:57","modified_gmt":"2023-07-11T17:06:57","slug":"python-gil-vs-nogil-boost-i-o-performance-10x-with-one-line-change","status":"publish","type":"post","link":"https:\/\/www.backblaze.com\/blog\/python-gil-vs-nogil-boost-i-o-performance-10x-with-one-line-change\/","title":{"rendered":"Python GIL vs. nogil: Boost I\/O Performance 10x With One Line Change"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.backblaze.com\/blog\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance.png\" alt=\"A decorative image showing the words &quot;Python 3.11 on one side and Python 3.9-nogil on the other\" width=\"6000\" height=\"3417\" class=\"alignnone size-full wp-image-108698\" srcset=\"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance.png 6000w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance-300x171.png 300w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance-1024x583.png 1024w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance-768x437.png 768w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance-1536x875.png 1536w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance-2048x1166.png 2048w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance-560x319.png 560w\" sizes=\"auto, (max-width: 6000px) 100vw, 6000px\" \/><\/p>\n<div class=\"abstract\" style=\"line-height: 1.8; margin: 24px 12px; padding: 24px 12px 10px 12px;\">\n<p>Last year, our team published <a href=\"\/blog\/the-python-gil-past-present-and-future\/\" rel=\"noopener\" target=\"_blank\">a history of the Python GIL<\/a>. We tapped two contributors, <a href=\"https:\/\/barry.warsaw.us\/\" rel=\"noopener\" target=\"_blank\">Barry Warsaw<\/a>, a longtime Python core developer, and <a href=\"http:\/\/www.linkedin.com\/in\/pawelpolewicz\" rel=\"noopener\" target=\"_blank\">Pawel Polewicz<\/a>, a backend software developer and longtime Python user, to help us write the post. <\/p>\n<p>Today, Pawel is back to revisit the original inspiration for the post: the experiments he did testing different versions of Python with the <a href=\"https:\/\/github.com\/Backblaze\/B2_Command_Line_Tool\" rel=\"noopener\" target=\"_blank\">Backblaze B2 CLI<\/a>. <\/p>\n<p>If you find the results of Pawel\u2019s speed tests useful, sign up to get more developer content every month in our <a href=\"https:\/\/info.backblaze.com\/tech-community-sign-up\" rel=\"noopener\" target=\"_blank\">Backblaze Developer Newsletter<\/a>. We\u2019ll let Pawel take it from here.<\/p>\n<p>\u2014The Editors\n<\/p><\/div>\n<p id=\"bzdropcap\">I was setting up and testing a backup solution for one of my clients when I noticed a couple of interesting things I\u2019d like to share today. I realized by using Python 3.9-nogil, I could increase I\/O performance by 10x. I\u2019ll get into the tests themselves, but first let me tell you why I\u2019m telling this story on the Backblaze blog.\n<\/p>\n<p>I use <a href=\"https:\/\/www.backblaze.com\/cloud-storage\" rel=\"noopener\" target=\"_blank\">Backblaze B2 Cloud Storage<\/a> for disaster recovery for myself and my clients for a few reasons:<\/p>\n<ul>\n<li><a href=\"\/blog\/cloud-storage-durability\/\" rel=\"noopener\" target=\"_blank\"><strong>Durability<\/strong><\/a>: The numbers bear out that B2 Cloud Storage is reliable.<\/li>\n<li><strong>Redundancy<\/strong>: If the entire AWS, Google Cloud Platform (GCP), or Microsoft Azure account of one of my clients (usually a startup founder) gets hacked, backups stored in B2 Cloud Storage will stay safe.<\/li>\n<li><strong>Affordability<\/strong>: The price for B2 Cloud Storage is one-fifth the cost of AWS, GCP, or Azure\u2014better than anywhere else.<\/li>\n<li><strong>Availability<\/strong>: You can read data immediately without any special \u201crestore from archive\u201d steps. Those might be hard to perform when your hands are shaking after you accidentally deleted something.<\/li>\n<\/ul>\n<p>Naturally, I always want to make sure my clients can get their backup data out of cloud storage fast should they need to. This brings us to \u201cThe Experiment.\u201d<\/p>\n<h2>The Experiment: Speed Testing the Backblaze B2 CLI With Different Python Versions<\/h2>\n<p>I ran a speed test to see how quickly we could get large files back from Backblaze B2 using the <a href=\"https:\/\/github.com\/Backblaze\/B2_Command_Line_Tool\/\" rel=\"noopener\" target=\"_blank\">B2 CLI<\/a>. To my surprise, I&#8217;ve found that it depends on the Python version.<\/p>\n<p>The chart below shows download speeds from different Python versions, 3.6 to 3.11, for both single-file and multi-file downloads.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.backblaze.com\/blog\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance_Infographic-2_cropped.png\" alt=\"\" width=\"5938\" height=\"3360\" class=\"alignnone size-full wp-image-108715\" srcset=\"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance_Infographic-2_cropped.png 5938w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance_Infographic-2_cropped-300x170.png 300w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance_Infographic-2_cropped-1024x579.png 1024w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance_Infographic-2_cropped-768x435.png 768w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance_Infographic-2_cropped-1536x869.png 1536w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance_Infographic-2_cropped-2048x1159.png 2048w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance_Infographic-2_cropped-560x317.png 560w\" sizes=\"auto, (max-width: 5938px) 100vw, 5938px\" \/><\/p>\n<h3>What\u2019s Going On Under the Hood?<\/h3>\n<p>The Backblaze B2 CLI is fetching data from the B2 Cloud Storage server using <a href=\"https:\/\/requests.readthedocs.io\/en\/latest\/\" rel=\"noopener\" target=\"_blank\">Python\u2019s Requests library<\/a>. It then saves it on a local storage device using Python threads\u2014one writer thread per file. In this type of workload, the newer versions of Python are much faster than the older ones\u2014developers of CPython (the standard implementation of the Python programming language) have been working hard on performance for many years. CPython 3.10 had the highest performance improvement from the official releases I\u2019ve tested. CPython 3.11 is almost twice as fast as 3.6!<\/p>\n<h3>Refresher: What\u2019s the GIL Again?<\/h3>\n<p>GIL stands for global interpreter lock. You can check out the <a href=\"\/blog\/the-python-gil-past-present-and-future\/\" rel=\"noopener\" target=\"_blank\">history of the GIL<\/a> in the post from last year for a deep dive, but essentially, the GIL is a lock that allows only a single operating system thread to run the central Python bytecode interpreter loop. It serves to serialize operations involving the Python bytecode interpreter\u2014that is, to run tasks in an order\u2014without which developers would need to implement fine grained locks to prevent one thread from overriding the state set by another thread. <\/p>\n<p>Don\u2019t worry\u2014here\u2019s a diagram. <\/p>\n<figure id=\"attachment_105829\" aria-describedby=\"caption-attachment-105829\" style=\"width: 1440px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.backblaze.com\/blog\/wp-content\/uploads\/2022\/05\/GIL-Serializing-Reference-Count.png\" alt=\"\" width=\"1440\" height=\"1315\" class=\"size-full wp-image-105829\" srcset=\"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2022\/05\/GIL-Serializing-Reference-Count.png 1440w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2022\/05\/GIL-Serializing-Reference-Count-300x274.png 300w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2022\/05\/GIL-Serializing-Reference-Count-1024x935.png 1024w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2022\/05\/GIL-Serializing-Reference-Count-768x701.png 768w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2022\/05\/GIL-Serializing-Reference-Count-560x511.png 560w\" sizes=\"auto, (max-width: 1440px) 100vw, 1440px\" \/><figcaption id=\"caption-attachment-105829\" class=\"wp-caption-text\">Two threads incrementing an object reference counter.<\/figcaption><\/figure>\n<p>The GIL prevents multiple threads from mutating this state at the same time, which is a good thing as it prevents data corruption, but unfortunately it also prevents any Python code from running in other threads (regardless of whether they would mutate a shared state or not). <\/p>\n<h2>How Did \u201cnogil\u201d Perform?<\/h2>\n<p>I ran one more test using the &#8220;nogil&#8221; fork of CPython 3.9. I had heard it improves performance in some cases, so I wanted to try it out to see how much faster my program would be without GIL. <\/p>\n<p>The results of that test were added to the tests run on versions of unmodified CPython and you can see them below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.backblaze.com\/blog\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance_Infographic-1_cropped.png\" alt=\"Chart showing single-file and multiple-files download performance of Backblaze B2 CLI on various CPython versions from 3.6 to 3.11, getting +60MB\/s per version on average.\" width=\"5944\" height=\"3369\" class=\"alignnone size-full wp-image-108714\" srcset=\"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance_Infographic-1_cropped.png 5944w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance_Infographic-1_cropped-300x170.png 300w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance_Infographic-1_cropped-1024x580.png 1024w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance_Infographic-1_cropped-768x435.png 768w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance_Infographic-1_cropped-1536x871.png 1536w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance_Infographic-1_cropped-2048x1161.png 2048w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance_Infographic-1_cropped-560x317.png 560w\" sizes=\"auto, (max-width: 5944px) 100vw, 5944px\" \/><\/p>\n<p>In this case not being limited by GIL has quite an effect! Most performance benchmarks I\u2019ve seen show how fast the CPython test suite is, but some Python programs move data around. For this type of usage, 3.9-nogil was 2.5 or 10 times faster (for single and multiple files, respectively) on the test than unmodified CPython 3.9.<\/p>\n<h2>Why Isn\u2019t nogil Even Faster?<\/h2>\n<p>A simple test running parallel writes on the RAID-0 array we\u2019ve set up on an AWS EC2 i3en.24xlarge instance\u2014a monster VM, with 96 virtual CPUs, 768 GiB RAM and 8 x 7500GB of <a href=\"\/blog\/nvme-vs-m-2-drives\/\" rel=\"noopener\" target=\"_blank\">NVMe SSD storage<\/a>\u2014shows that the bottleneck is not in userspace. The bottleneck is likely a combination of filesystem, raid driver, and the storage device. A single I\/O-heavy Python process outperformed one of the fastest virtual servers you can get in 2023, and enabling nogil required just one change\u2014the <strong>FROM<\/strong> line of the Dockerfile.<\/p>\n<h2>Why Not Use Multiprocessing?<\/h2>\n<p>For a single file, POSIX doesn\u2019t guarantee consistency of writes if those are done from different threads (or processes)\u2014that\u2019s why the B2 Cloud Storage CLI uses a single writer thread for each file while the other threads are getting data off the network and passing it to the writer using a <a href=\"https:\/\/docs.python.org\/3\/library\/queue.html#queue.Queue\" rel=\"noopener\" target=\"_blank\">queue.Queue<\/a> object. Using a <a href=\"https:\/\/docs.python.org\/3\/library\/multiprocessing.html#multiprocessing.Queue\" rel=\"noopener\" target=\"_blank\">multiprocessing.Queue<\/a> in the same place results in degraded performance (approximately -15%).<\/p>\n<p>The cool thing about threading is that it\u2019s easy to learn. You can take almost any synchronous code and run it in threads in a few minutes. Using something like <a href=\"https:\/\/docs.python.org\/3\/library\/asyncio.html\" rel=\"noopener\" target=\"_blank\">asyncio<\/a> or <a href=\"https:\/\/docs.python.org\/3\/library\/multiprocessing.html\" rel=\"noopener\" target=\"_blank\">multiprocessing<\/a> is not so easy. In fact, whenever I tried multiprocessing, the serialization overhead was so high that the entire program slowed down instead of speeding up. As for asyncio, it won\u2019t make Python run on 20 cores, and the cost of rewriting a program based on Requests is prohibitive. Many libraries do not support async anyway and the only way to make them work with async is to wrap them in a thread. Performance of clean async code is known to be higher than threads, but if you mix the async code with threading code, you lose this performance gain.<\/p>\n<h2>But Threads Can Be Hard Too!<\/h2>\n<p>Threads might be easy in comparison to other ways of making your program concurrent, but even that\u2019s a high bar. While some of us may feel confident enough to go around limitations of Python by using asyncio with <a href=\"https:\/\/github.com\/MagicStack\/uvloop\" rel=\"noopener\" target=\"_blank\">uvloop<\/a> or writing custom extensions in C, not everyone can do that. Case in point: over the last three years I\u2019ve challenged 1622 applicants to a senior Python backend developer job opening with a very basic task using Python threads. There was more than enough time, but only 30% of the candidates managed to complete it. <\/p>\n<h2>What\u2019s Next for nogil?<\/h2>\n<p>On January 9, 2023, <a href=\"https:\/\/research.facebook.com\/people\/gross-sam\/\" rel=\"noopener\" target=\"_blank\">Sam Gross<\/a> (the author of the nogil branch) submitted [<a href=\"https:\/\/peps.python.org\/pep-0703\/\" rel=\"noopener\" target=\"_blank\">PEP-703<\/a>]\u2014an official proposal to include the nogil mode in CPython. I hope that it will be accepted and that one day nogil will be merged into mainline, so that Python can exceed single core performance when commanded by lots of users of Python and not just those who are talented and lucky enough to be able to benefit from asyncio, multiprocessing, or custom extensions written in C.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We tested different version of Python with the Backblaze B2 CLI, and the results are in. Check out which version did best. <\/p>\n","protected":false},"author":168,"featured_media":108698,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":""},"categories":[7,483],"tags":[468],"class_list":["post-108695","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud-storage","category-tech-lab","tag-b2cloud","entry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python GIL vs. nogil: Boost I\/O Performance 10x With One Line Change<\/title>\n<meta name=\"description\" content=\"We tested different version of Python with the Backblaze B2 CLI, and the results are in. Check out which version did best.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.backblaze.com\/blog\/python-gil-vs-nogil-boost-i-o-performance-10x-with-one-line-change\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python GIL vs. nogil: Boost I\/O Performance 10x With One Line Change\" \/>\n<meta property=\"og:description\" content=\"We tested different version of Python with the Backblaze B2 CLI, and the results are in. Check out which version did best.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/backblazeprod.wpenginepowered.com\/blog\/python-gil-vs-nogil-boost-i-o-performance-10x-with-one-line-change\/\" \/>\n<meta property=\"og:site_name\" content=\"Backblaze Blog | Cloud Storage &amp; Cloud Backup\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/backblaze\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-16T16:27:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-11T17:06:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance.png\" \/>\n\t<meta property=\"og:image:width\" content=\"6000\" \/>\n\t<meta property=\"og:image:height\" content=\"3417\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Backblaze\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@backblaze\" \/>\n<meta name=\"twitter:site\" content=\"@backblaze\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Backblaze\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python GIL vs. nogil: Boost I\/O Performance 10x With One Line Change","description":"We tested different version of Python with the Backblaze B2 CLI, and the results are in. Check out which version did best.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.backblaze.com\/blog\/python-gil-vs-nogil-boost-i-o-performance-10x-with-one-line-change\/","og_locale":"en_US","og_type":"article","og_title":"Python GIL vs. nogil: Boost I\/O Performance 10x With One Line Change","og_description":"We tested different version of Python with the Backblaze B2 CLI, and the results are in. Check out which version did best.","og_url":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/python-gil-vs-nogil-boost-i-o-performance-10x-with-one-line-change\/","og_site_name":"Backblaze Blog | Cloud Storage &amp; Cloud Backup","article_publisher":"https:\/\/www.facebook.com\/backblaze","article_published_time":"2023-05-16T16:27:21+00:00","article_modified_time":"2023-07-11T17:06:57+00:00","og_image":[{"width":6000,"height":3417,"url":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance.png","type":"image\/png"}],"author":"Backblaze","twitter_card":"summary_large_image","twitter_creator":"@backblaze","twitter_site":"@backblaze","twitter_misc":{"Written by":"Backblaze","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/python-gil-vs-nogil-boost-i-o-performance-10x-with-one-line-change\/#article","isPartOf":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/python-gil-vs-nogil-boost-i-o-performance-10x-with-one-line-change\/"},"author":{"name":"Backblaze","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#\/schema\/person\/c4aeb635459cb08cd0b8045ddac13173"},"headline":"Python GIL vs. nogil: Boost I\/O Performance 10x With One Line Change","datePublished":"2023-05-16T16:27:21+00:00","dateModified":"2023-07-11T17:06:57+00:00","mainEntityOfPage":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/python-gil-vs-nogil-boost-i-o-performance-10x-with-one-line-change\/"},"wordCount":1250,"commentCount":4,"publisher":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#organization"},"image":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/python-gil-vs-nogil-boost-i-o-performance-10x-with-one-line-change\/#primaryimage"},"thumbnailUrl":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance.png","keywords":["B2Cloud"],"articleSection":["Cloud Storage","Tech Lab"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/backblazeprod.wpenginepowered.com\/blog\/python-gil-vs-nogil-boost-i-o-performance-10x-with-one-line-change\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/python-gil-vs-nogil-boost-i-o-performance-10x-with-one-line-change\/","url":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/python-gil-vs-nogil-boost-i-o-performance-10x-with-one-line-change\/","name":"Python GIL vs. nogil: Boost I\/O Performance 10x With One Line Change","isPartOf":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/python-gil-vs-nogil-boost-i-o-performance-10x-with-one-line-change\/#primaryimage"},"image":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/python-gil-vs-nogil-boost-i-o-performance-10x-with-one-line-change\/#primaryimage"},"thumbnailUrl":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance.png","datePublished":"2023-05-16T16:27:21+00:00","dateModified":"2023-07-11T17:06:57+00:00","description":"We tested different version of Python with the Backblaze B2 CLI, and the results are in. Check out which version did best.","breadcrumb":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/python-gil-vs-nogil-boost-i-o-performance-10x-with-one-line-change\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/backblazeprod.wpenginepowered.com\/blog\/python-gil-vs-nogil-boost-i-o-performance-10x-with-one-line-change\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/python-gil-vs-nogil-boost-i-o-performance-10x-with-one-line-change\/#primaryimage","url":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance.png","contentUrl":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance.png","width":6000,"height":3417,"caption":"A decorative image showing the words \"Python 3.11 on one side and Python 3.9-nogil on the other"},{"@type":"BreadcrumbList","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/python-gil-vs-nogil-boost-i-o-performance-10x-with-one-line-change\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Python GIL vs. nogil: Boost I\/O Performance 10x With One Line Change"}]},{"@type":"WebSite","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#website","url":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/","name":"Backblaze Cloud Solutions Blog","description":"Cloud Storage &amp; Cloud Backup","publisher":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#organization","name":"Backblaze","url":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/i0.wp.com\/www.backblaze.com\/blog\/wp-content\/uploads\/2017\/12\/backblaze_icon_transparent.png?fit=512%2C512&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.backblaze.com\/blog\/wp-content\/uploads\/2017\/12\/backblaze_icon_transparent.png?fit=512%2C512&ssl=1","width":512,"height":512,"caption":"Backblaze"},"image":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/backblaze","https:\/\/x.com\/backblaze","https:\/\/www.youtube.com\/user\/Backblaze","https:\/\/en.wikipedia.org\/wiki\/Backblaze"]},{"@type":"Person","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#\/schema\/person\/c4aeb635459cb08cd0b8045ddac13173","name":"Backblaze","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2024\/03\/BB-flame-icon-300x300-1-150x150.jpg","url":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2024\/03\/BB-flame-icon-300x300-1-150x150.jpg","contentUrl":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2024\/03\/BB-flame-icon-300x300-1-150x150.jpg","caption":"Backblaze"},"description":"Backblaze is the cloud storage innovator delivering a modern alternative to traditional cloud providers. We offer high-performance, secure cloud object storage that customers use to develop applications, manage media, secure backups, build AI workflows, protect from ransomware, and more. Backblaze helps businesses break free from the walled gardens that traditional providers lock customers into, enabling them to use their data in open cloud workflows with the providers they prefer at a fraction of the cost. Headquartered in San Mateo, CA, Backblaze (NASDAQ: BLZE) was founded in 2007 and serves over 500,000 customers in 175 countries around the world. For more information, please go to www.backblaze.com.","url":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/author\/team\/"}]}},"jetpack_featured_media_url":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2023\/05\/bb-bh-CPython-3.11-vs-3.9-nogil-I-O-performance.png","_links":{"self":[{"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/posts\/108695","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/users\/168"}],"replies":[{"embeddable":true,"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/comments?post=108695"}],"version-history":[{"count":0,"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/posts\/108695\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/media\/108698"}],"wp:attachment":[{"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/media?parent=108695"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/categories?post=108695"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/tags?post=108695"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}