Рус Eng During last 365 days Approved articles: 1875,   Articles in work: 320 Declined articles: 767 
Library
Articles and journals | Tariffs | Payments | Your profile

Back to contents

Practical use of asynchronous programming in Python with Asyncio
Savostin Petr Alekseevich

Bachelor's Degree, Department of Algorithmic Languages, Lomonosov Moscow State University 

117437, Russia, g. Moscow, ul. Leninskie Gory, 1, str. 52

petersavostin@gmail.com
Efremova Natalya Ernestovna

PhD in Physics and Mathematics

Assistant, Department of Algorithmic Languages, Lomonosov Moscow State University

119234, Russia, Moskovskaya oblast', g. Moscow, ul. Leninskie Gory, 1, str. 52, aud. 707

nvasil@list.ru

Abstract.

The subject of the study is the study of the basic principles of asynchronous programming with the Asyncio package and their application for solving applied problems in Python. Since the Python interpreter uses the Global Interpreter Lock synchronization method, which limits the ability to parallelize programs in the given language and, as a result, does not allow achieving the greatest efficiency, the use of asynchronous programming technologies allows to significantly increase the speed of programs in this language, avoiding the mentioned limitations. The above described approach to creating programs is used in many tasks, for example: when creating a web server, client-server application, when extracting data from a resource by a web crawler. This paper is devoted to explaining the basic principles of working with the packageAsyncio in Python. Since the Russian-language literature on this package is often not enough to understand the basics of asynchronous programming in Python, this article gives examples of the use of this technology with explanations.

Keywords: scraping, couroutines, parsing, web-crawling, asynchronous programming, asyncio library, python programming language, GIL, parallel computing, data extraction

DOI:

10.7256/2454-0714.2018.2.25851

Article was received:

27-03-2018


Review date:

04-04-2018


Publish date:

13-06-2018


This article written in Russian. You can find full text of article in Russian here .

References
1.
Applications written in Python [Elektronnyi resurs]. – Elektron. dan. – URL: https://wiki.python.org/moin/Applications (data obrashcheniya: 25.03.2018).
2.
Asyncio documentation [Elektronnyi resurs]. – Elektron. dan. – URL: http://asyncio.readthedocs.io (data obrashcheniya: 25.03.2018).
3.
Python [Elektronnyi resurs]. – Elektron. dan. – URL: http://www.python.org/ (data obrashcheniya: 08.02.2018).
4.
Zhurnal Tproger [Elektronnyi resurs]. – Elektron. dan. – URL: https://tproger.ru/translations/programming-concepts-concurrency/ (data obrashcheniya: 25.03.2018)
5.
Donal'd Knut. Iskusstvo programmirovaniya, tom 1. Osnovnye algoritmy = The Art of Computer Programming, vol.1. Fundamental Algorithms. – 3-e izd. – M.: «Vil'yams», 2006. – S. 720. – ISBN 0-201-89683-4.Razdel 1.4.2: Soprogrammy, str. 229-236.
6.
Sammerfild M., Programmirovanie na Python 3. Podrobnoe rukovodstvo, 2009.