General principles of web application optimization

Illustration of general principles of web application optimization with server, browser, caching, database and performance improvement graph

Навигация

1 General principles of optimization

1.1 Concept, types and meaning of performance optimization

According to statistics, the number of Internet users in Russia is increasing annually1. In addition, the world creates approximately 495 million terabytes of data every day (as of 2025)2. This leads to an increase in the load on web applications and an increase in the size of databases. At the same time, users place high demands on web applications, which must not only perform certain tasks, but also do it quickly. The ability of an application to quickly and efficiently process user requests represents web application performance.

According to Martin Fowler, performance can be understood as one of two indicators - response time or throughput, depending on which indicator is most important in a particular situation. In some situations, it can be difficult to judge performance if, for example, using a particular solution increases throughput but also increases response time. From a user's perspective, responsiveness may be a more important metric than response time, so improving responsiveness at the expense of throughput or increased response time can improve performance3.

In the above quote, Martin Fowler uses similar terms (response time and responsiveness) that need to be clarified. Response time is the total time from sending a request to receiving a complete response (an objective measure, such as a complete response received in 2 seconds). While responsiveness is how quickly the system begins to respond to the user’s action (a subjective factor that depends on the user’s perception, for example, the instant response of the application interface). In other words, Martin Fowler emphasizes the importance of the user's subjective perception of the speed of the application. Sometimes you can worsen the response time, but improve the feeling of speed. While response time is an objective metric, responsiveness often has a greater impact on user perception of performance.

The loading speed of a website’s pages is one of the important indicators of its quality. Due to low speed, the user may not wait for the page to open and go to another resource. This reduces the level of trust in the site, its traffic and affects other statistical indicators4. The speed at which an application executes a request is an indicator that can be determined and influenced by technical means. This problem can be solved by optimizing the performance of a web application, which is an activity aimed at increasing the speed of the application. Given these circumstances, the importance of optimizing the performance of web applications is constantly increasing. In this work, we will consider optimizing the performance of a web application using the Yii2 framework as the most common PHP framework in Russia.

According to Peter Smith, one of the best ways to improve PHP performance is to not use it at all5. The corresponding point of view is widespread in the software engineering community and should be taken into account when determining the list of technologies to solve the problems assigned to the developer. At the same time, it is also important to note that PHP is developing dynamically, for example, the seventh version of this programming language showed a significant increase in productivity compared to the fifth. In addition, PHP remains the most common programming language used in web application development to this day.

Among the main reasons for the need to optimize the performance of web applications are the following: improving the user experience (users expect an instant response from the application interface; a long response from a web application often entails refusal to use the service); increased scalability (an optimized application can serve more users without increasing hardware resources); reduced infrastructure costs (efficient use of processor, memory and network reduces infrastructure costs); increasing system reliability (optimization reduces the likelihood of overload, failures and application crashes); compliance with search engine requirements (page loading speed affects site ranking).

The literature notes that a significant factor in the success of applications in the modern digital environment is their performance. Page loading speed, interface responsiveness, and visual stability directly impact user experience, which impacts conversion rates and business competitiveness. Users are placing increasingly high demands on the quality of web applications (including performance). For this reason, web application developers use optimization techniques such as server-side rendering, static site generation, code splitting, and the use of modern frameworks to improve the efficiency of web applications. The above optimization methods allow you to improve the user experience, as well as provide higher positions for web applications when ranking by search engines.

With the increasing complexity of web applications and increasing demands for multimedia content and interactivity, performance optimization has become an integral aspect of web development. Using advanced optimization tools and technologies, developers ensure that web applications remain fast, efficient, and user-friendly even as they handle more complex functions. Optimizing performance is essential not only to providing a superior user experience, but also to achieving long-term business success in a highly competitive online environment6.

Optimizing web application performance is a broad area of software engineering. You can optimize the performance of a web application developed using the Yii2 framework at several levels. Using just one performance optimization method is often not enough to ensure the best performance for your web application. To optimize performance, you need to use the built-in capabilities of the Yii2 framework, optimize performance at the infrastructure level, optimize at the database level, as well as on the client side (front-end level). An integrated and systematic approach to optimizing the performance of a web application allows you to ensure stable operation of the web application, reduce infrastructure costs, and achieve the best performance of the web application. However, at present there is not enough literature that would approach optimization issues in a comprehensive manner. This work is intended to fill the existing gap.

In this work, we will limit ourselves to considering the following techniques for optimizing the performance of web applications: at the level of the Yii2 framework, which provides extensive built-in capabilities for this (Chapter 2 of the Works); at the database level (Chapter 3 of the WRC); at the frontend level (Chapter 4 of the WRC); infrastructure optimization methods (Chapter 5 of the WRC). It is important to note that the above list of levels for optimizing the performance of web applications is not exhaustive and can be supplemented by others (for example, the network level can be highlighted separately).

Specific techniques will be considered within each type of optimization. In the framework of this work, a technique for optimizing the performance of a web application will be understood as a specific technique, a method that allows you to influence a web application in order to increase the speed of the corresponding application. Each specific technique for optimizing the performance of a web application is designed to answer the question: “How can I increase the speed of the application?” Terms such as “method”, “technique” and “method” in relation to application optimization within the framework of this work will be used as synonyms.

Some performance optimization methods are closely related or even overlap to a certain extent. This is consistent with achieving the purpose and objectives of this study, given its comprehensive nature. For example, when considering ways to optimize performance at the framework level (Chapter 2 of this WRC), minification and CSS/JS merging are discussed. This optimization method can be classified as optimization on the client side of the application (at the front-end level), but it is discussed in the second chapter, since the Yii2 framework provides convenient, built-in tools for minifying and combining CSS/JS through Asset Bundle. Effective work with Active Record is also discussed in the second chapter, although by all indications this is optimization at the database level.

Separate chapters of this work discuss caching, which is provided as part of the built-in capabilities of the framework. In this case, we should separately consider caching in the client part of the application (at the front-end level), infrastructure and database. The corresponding caching methods differ significantly from each other and deserve separate consideration in the corresponding chapters of this work. Chapter 3 looks at caching at the database level, Chapter 4 looks at caching at the front-end level, and Chapter 5 looks at caching that happens at the infrastructure level. At each level, caching has its own characteristics.

The second chapter discusses optimization methods at both the front-end and database levels, despite the fact that separate chapters of this work are devoted to the corresponding optimization levels (Chapters 4 and 3 of this WRC, respectively). This decision in terms of defining the work structure is appropriate, since Chapter 2 discusses the built-in optimization capabilities at the Yii2 framework level, while other chapters discuss universal features of performance optimization without being tied to a specific framework. The approach chosen in this work seems justified, since it allows for a consistent transition from general optimization principles to special techniques.

Optimizing web application performance should be considered one of the activities in the field of software engineering. When solving problems related to optimizing the performance of web applications, the first thing you should consider is the ease of use of the application (mainly in terms of response speed). Slow responsiveness of a web application often results in poor user experience (users want the application to run quickly). In some cases, search engines may lower the position of such an application when ranking. Insufficient optimization of application performance can often lead to increased costs for server infrastructure. Implementing performance optimization activities, along with improving the user experience, will also reduce infrastructure costs and reduce energy consumption. For this reason, performance optimization is also of economic importance.

1.2 Key performance indicators

To objectively assess the effectiveness of optimization, quantitative performance indicators (metrics) are used. The most important metric for user convenience is the response time of the application. The faster the response time, the faster the application is perceived to work. The following components of the application response time metric can be determined: 1) data transmission time over the network; 2) waiting time for a request in the queue; 3) the time it takes for the server to process the request; 4) request processing time by the database; 5) the time it takes to generate and present the final response to the user (HTML/JSON/XML), including, if necessary, loading static application resources, such as images, fonts, styles and other elements.

According to D.A. Skachkov, the following metrics for assessing the performance of web applications should be highlighted: 1) processor resource consumption (CPU,%); 2) RAM consumption (Memory usage, Mb); 3) consumption of network resources (kb/s); 4) working with the disk subsystem (I/O Wait); 5) working with the database (connections, requests time (ms))7. These metrics are important at the stage of identifying bottlenecks in the application. You should also note such metrics as: the number of requests per second (RPS) and the number of simultaneous connections.

1.3 Main methods of performance analysis

The effectiveness of web application optimization largely depends on the regular implementation of a certain sequence of actions, including the following: measuring current application performance; identifying bottlenecks; making changes; repeated measurement; comparison of results. Thus, optimization is impossible without objective measurements. Changes should be based on the results of the analysis. There are three main ways to determine application performance: 1) profiling; 2) benchmarking; 3) monitoring.

Application performance profiling is an analysis of the execution time of individual parts of the application and resource consumption. Application performance profiling allows you to determine: the slowest queries; redundant operations; frequent access to the database; bottlenecks in algorithms.

Profiling shows what share each element of the system contributes to the total cost of obtaining the result. The simplest cost metric is time, but profiling can also measure the number of function calls, I/O operations, database queries, etc. It is important to understand why a system performs the way it does8.

The Yii2 framework provides built-in profiling and logging tools, which are especially useful during the application development stage and allow you to identify bottlenecks and help in optimizing performance. Yii2 application performance profiling is implemented as a special tab (“Profiling”) in the application debugging panel (“Debug Panel”). The profiling tab of the Yii2 application debug panel is shown in Figure 1.

Figure 1 ¾ Profiling tab of the Yii2 application debug panel

The main principle when dealing with bottlenecks is that you should never assume anything and you should always test and profile your code before trying to optimize it9. Profiling in Yii2 is the most important source of information about application performance bottlenecks. However, only calls to the database are covered by profiling in Yii2; everything else must be marked manually10.

Controlled benchmarking allows you to compare choices, identify regressions, and evaluate performance limitations before they become apparent in the production environment11. In its most general form, benchmarking is testing a system under a controlled load to determine its performance. In some cases, benchmarking uses specialized load testing tools that simulate user actions. Benchmarking allows you to solve the following problems: determine the maximum throughput; identify the behavior of the system as the load increases; compare different configurations; evaluate the effectiveness of optimizations.

For a web application to run effectively, it is important to constantly monitor system performance. This problem is intended to be solved by monitoring, which allows: timely identification of overloads; detect memory leaks; analyze long-term trends; prevent emergency situations.


  1. Statbase. Number of Internet users in Russia. [Electronic resource]. – URL: https://statbase.ru/data/rus-population-using-internet/ (access date: 02/03/2026). 

  2. How much data is generated every day? [Electronic resource]. – URL: https://soax.com/research/data-generated-per-day (date of access: 03/07/2026). 

  3. Fowler M. Templates for enterprise applications. Per. from English – M.: LLC “I.D. Williams", 2016. 

  4. Working with Yandex Webmaster. How to make a website faster. [Electronic resource]. – URL: https://yandex.ru/support/webmaster/ru/yandex-indexing/page-speed (access date: 02/03/2026). 

  5. Smith P. Professional website performance: optimizing the front end and the back end. – Indianapolis: John Wiley & Sons, 2013. 

  6. Alekseev P.O. Optimizing the performance of web applications using modern frameworks // Universum: technical sciences: electron. scientific magazine 2025. 4 (133). [Electronic resource]. – URL: https://7universum.com/ru/tech/archive/item/19668 (access date: 03/04/2026). 

  7. Skachkov D.A. Research and selection of metrics for assessing the performance of web applications // Problems of modern science and education. 2014. 11 (29). 

  8. Schwartz B., Zaitsev P., Tkachenko V., Zavodny J., Lenz A., Balling D. MySQL. Performance Optimization, 2nd Edition. – Per. from English – St. Petersburg: Symbol-Plus, 2010. 

  9. Bogdanov A., Eliseev D. Yii2 Application Development Cookbook. – Packt Publishing, 2016. 

  10. Safronov M. Development of web applications in Yii 2 - M.: DMK Press, 2015. 

  11. Gregg B. Systems performance. – St. Petersburg: Peter, 2023.