| Русский Русский | English English |
   
Главная
15 | 05 | 2024
10.14489/vkit.2023.09.рр.020-026

DOI: 10.14489/vkit.2023.09.рр.020-026

Кокотов Д. В.
РАЗРАБОТКА НЕБЛОКИРУЮЩЕГО ВЕБ-ПРИЛОЖЕНИЯ С ИСПОЛЬЗОВАНИЕМ РЕАКТИВНОГО СТЕКА НА ЯЗЫКЕ КОТЛИН
(с. 20-26)

Аннотация. По мере роста числа пользователей сервисов в Интернете остро встает проблема производительности системы, и повышается важность масштабирования веб-приложений. Существуют различные способы оптимизации работы приложения, в том числе на этапе проектирования архитектуры. Для решения проблемы производительности в условиях высокой нагрузки предложена реактивная модель неблокирующего веб-приложения на реактивном стеке технологий. Рассмотрены принципы обработки запросов в реактивной модели. Для организации реактивного подхода использована библиотека Project Reactor, приведена схема ее работы. В дополнение к ней рассмотрен фреймворк Spring WebFlux, позволяющий разрабатывать полноценные неблокирующие веб-приложения на всех уровнях системы. Приведены примеры программного кода сервисов с использованием описанных технологий. Предложена альтернативная реализация спецификации реактивных потоков на базе корутин из библиотеки kotlinx.coroutines, продемонстрированы некоторые возможности их применения. Сформулированы общие выводы относительно эффективности использования реактивного подхода для решения проблемы производительности в веб-приложениях.  Проведено сравнение предложенной модели неблокирующего веб-приложения с классическим блокирующим приложением.

Ключевые слова:  реактивный стек; HTTP-запросы; веб-приложение; библиотека Project Reactor; фреймворк Spring WebFlux; язык программирования Kotlin; корутины Kotlin; библиотека kotlinx.coroutines; база данных MongoDB.

 

Kokotov D. V.
DEVELOPING A NON-BLOCKING WEB APPLICATION USING REACTIVE STACK IN KOTLIN LANGUAGE
(рр. 20-26)

Abstract. As the number of users of services on the Internet grows, the importance of scaling web applications increases. The system performance problem becomes more acute in a highly loaded state. There are various ways to optimize the performance of an application, including at the stage of architecture design. The purpose of this article is to develop a non-blocking web application on a reactive stack of technologies to solve the problem of performance under high load. In the course of the work, the principles of processing requests in the reactive model were considered. To organize the reactive approach, the Project Reactor library was used and a diagram of its operation was given. In addition to the Project Reactor library, the Spring WebFlux framework was considered, which allows you to develop full-fledged non-blocking web applications at all system levels. Examples of the program code of services using the described technologies are given. Further, an alternative implementation of the specification of reactive streams based on coroutines from the kotlinx.coroutines library is proposed, and some possibilities of their application are demonstrated. In conclusion, general conclusions are formulated regarding the effectiveness of using the reactive approach to solve the performance problem in modern web applications, and a comparative characteristic is given in relation to classical blocking applications.

Keywords: Reactive stack; HTTP requests; Web application; Project Reactor library; Spring WebFlux framework; Kotlin programming language; Kotlin coroutines; Kotlinx.coroutines library; MongoDB database.

Рус

Д. В. Кокотов (ООО «Цифровые привычки», Санкт-Петербург, Россия) E-mail: Этот e-mail адрес защищен от спам-ботов, для его просмотра у Вас должен быть включен Javascript  

Eng

D. V. Kokotov (Digital Habits LLC, St. Petersburg, Russia) E-mail: Этот e-mail адрес защищен от спам-ботов, для его просмотра у Вас должен быть включен Javascript  

Рус

1. Project Reactor [Электронный ресурс]. URL: https://projectreactor.io/docs/core/release/reference/ (дата обращения: 01.05.2023).
2. Herrera E. Unraveling Project Reactor: Your Guide to Reactive Programming. USA: Independently published, 2023. 390 p.
3. Walls C. Spring in Action, Sixth Edition. USA, Shelter Island: Manning Publications, 2022. 520 p.
4. Spring WebFlux Documentation [Электронный ресурс]. URL: https://docs.spring.io/spring-framework/reference/web/webflux.html (дата обращения: 08.05.2023).
5. Arpendu K. G. Getting Started with Spring WebFlux [Электронный ресурс]. URL: https://reflectoring.io/getting-started-with-spring-webflux/ (дата обращения: 08.05.2023).
6. Bradshaw S., Brazil E., Chodorow K. MongoDB: The Definitive Guide: Powerful and Scalable Data Storage. USA: O’Reilly Media, Inc., 2019. 511 p.
7. Coroutines [Электронный ресурс]. URL: https://kotlinlang.org/docs/coroutines-overview.html (дата обращения: 09.05.2023).
8. Hochbergs G. Reactive programming and its effect on performance and the development process [Электронный ресурс]. URL: https://lup.lub.lu.se/student-papers/search/publication/8932146 (дата обращения: 06.05.2023).
9. Koval N., Alistarh D., Elizarov R. Fast and Scalable Channels in Kotlin Coroutines [Электронный ресурс]. URL: https://arxiv.org/abs/2211.04986 (дата обращения: 09.05.2023).

Eng

1. Project Reactor. Retrieved from https://projectreactor.io/docs/core/release/reference/ (Accessed: 01.05.2023).
2. Herrera E. (2023). Unraveling Project Reactor: Your Guide to Reactive Programming. USA: Independently published.
3. Walls C. (2022). Spring in Action, Sixth Edition. Shelter Island: Manning Publications.
4. Spring WebFlux Documentation. Retrieved from https://docs.spring.io/spring-framework/reference/web/webflux.html (Accessed: 08.05.2023).
5. Arpendu K. G. Getting Started with Spring WebFlux. Retrieved from https://reflectoring.io/getting-started-with-spring-webflux/ (Accessed: 08.05.2023).
6. Bradshaw S., Brazil E., Chodorow K. (2019). MongoDB: The Definitive Guide: Powerful and Scalable Data Storage. USA: O’Reilly Media, Incorporated.
7. Coroutines. Retrieved from https://kotlinlang.org/docs/coroutines-overview.html (Accessed: 09.05.2023).
8. Hochbergs G. Reactive programming and its effect on performance and the development process. Retrieved from https://lup.lub.lu.se/student-papers/search/publication/8932146 (Accessed: 06.05.2023).
9. Koval N., Alistarh D., Elizarov R. Fast and Scalable Channels in Kotlin Coroutines. Retrieved from https://arxiv.org/abs/2211.04986 (Accessed: 09.05.2023).

Рус

Статью можно приобрести в электронном виде (PDF формат).

Стоимость статьи 500 руб. (в том числе НДС 20%). После оформления заказа, в течение нескольких дней, на указанный вами e-mail придут счет и квитанция для оплаты в банке.

После поступления денег на счет издательства, вам будет выслан электронный вариант статьи.

Для заказа скопируйте doi статьи:

10.14489/vkit.2023.09.рр.020-026

и заполните  форму 

Отправляя форму вы даете согласие на обработку персональных данных.

.

 

Eng

This article  is available in electronic format (PDF).

The cost of a single article is 500 rubles. (including VAT 20%). After you place an order within a few days, you will receive following documents to your specified e-mail: account on payment and receipt to pay in the bank.

After depositing your payment on our bank account we send you file of the article by e-mail.

To order articles please copy the article doi:

10.14489/vkit.2023.09.рр.020-026

and fill out the  form  

 

.

 

 

 
Баннер
Баннер
Rambler's Top100 Яндекс цитирования