| 10.14489/vkit.2023.09.рр.020-026 |
|
DOI: 10.14489/vkit.2023.09.рр.020-026 Кокотов Д. В. Аннотация. По мере роста числа пользователей сервисов в Интернете остро встает проблема производительности системы, и повышается важность масштабирования веб-приложений. Существуют различные способы оптимизации работы приложения, в том числе на этапе проектирования архитектуры. Для решения проблемы производительности в условиях высокой нагрузки предложена реактивная модель неблокирующего веб-приложения на реактивном стеке технологий. Рассмотрены принципы обработки запросов в реактивной модели. Для организации реактивного подхода использована библиотека Project Reactor, приведена схема ее работы. В дополнение к ней рассмотрен фреймворк Spring WebFlux, позволяющий разрабатывать полноценные неблокирующие веб-приложения на всех уровнях системы. Приведены примеры программного кода сервисов с использованием описанных технологий. Предложена альтернативная реализация спецификации реактивных потоков на базе корутин из библиотеки kotlinx.coroutines, продемонстрированы некоторые возможности их применения. Сформулированы общие выводы относительно эффективности использования реактивного подхода для решения проблемы производительности в веб-приложениях. Проведено сравнение предложенной модели неблокирующего веб-приложения с классическим блокирующим приложением. Ключевые слова: реактивный стек; HTTP-запросы; веб-приложение; библиотека Project Reactor; фреймворк Spring WebFlux; язык программирования Kotlin; корутины Kotlin; библиотека kotlinx.coroutines; база данных MongoDB.
Kokotov D. V. 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 EngD. 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). Eng1. Project Reactor. Retrieved from https://projectreactor.io/docs/core/release/reference/ (Accessed: 01.05.2023).
РусСтатью можно приобрести в электронном виде (PDF формат). DOI: 10.14489/vkit.2023.09. Скопируйте DOI статьи и перейдите по ссылке https://id-spektr.ru/product/pokupka-elektronnoy-stati-iz-zhurnala-vestnik-kompyuternyh-i-informatsionnyh-tehnologiy В комментарии к заказу обязательно укажите DOI статьи. .
EngThis article is available in electronic format (PDF). DOI: 10.14489/vkit.2023.09. Copy the article DOI and follow the link https://id-spektr.ru/product/pokupka-elektronnoy-stati-iz-zhurnala-vestnik-kompyuternyh-i-informatsionnyh-tehnologiy Please specify the article DOI in the order comments.
.
|
Архив номеров
Разработка концепции и создание сайта - ООО «Издательский дом «СПЕКТР»