Studio theYANG’s expertise in performance optimization roots from the real concerns of clients unsatisfied by the response speed and stability of their Web systems. Why does the issue emerge gradually? What are the common misunderstandings? How do we mitigate the problems?
The Performance Issue
From our observation, the issue on web systems is ubiquitous because (1) web systems are expected to respond to sophisticated user interaction; (2) data accumulates over time; and (3) most importantly, the prevailing Agile methodology for software development highlights the realization of functionalities but partially ignores the sustainability of the realized functionalities in long term.
It is mostly the case that the issue itself exists but is not perceivable under a low usage of the web system and compared to the time spent on establishing the connection to the system via the Internet. Depending on the severity of the issue, it may become prominent very quickly along with the increased usage of the system. The severity of the issue can be characterized theoretically by the concept of time complexity.
When the performance issue comes up to the table, it most often leads to 504 GATEWAY TIMEOUT errors. This error, emitted by a web server when it has waited for too long for a response from the web system, is usually misinterpreted by non-technical client coordinators as the instability of the system.
The Misunderstandings
Studio theYANG believes the mutual understanding of the issue’s nature to be utmost important prior to the resolution of the issue, in particular with non-technical client coordinators.
The performance issue is, firstly, unrelated to the Internet speed. This was a misunderstanding of a past client of Studio theYANG who had been engaging their web system heavily with underdevelopment areas where Internet connections were unstable or slow. The issue is intrinsic to the web system itself and acts as a lower bound of the response speed. The situation would be even worse with a slow Internet. In the end, the performance optimization helped the client advance their business in underdevelopment areas.
Clients may also view the performance issue regardless of the scale of usage and the evolution of functionalities. In reality, large-scale systems are studied and engineered specifically and pose much more restraints on the flexibility and adaptability of regular web systems, let alone the computational resources that are required. The evolution of functionalities, sometimes restrained by the available resources at the client side, cannot invent major evolutions of the system’s architecture that supports upper-level functionalities and therefore introduce a number of unoptimized usages that burst out problems at a later time.
Finally, a by-product of performance optimization is usually an increase in memory usage, which is not easily perceivable by clients and may not call enough attention in most cases. Failing to correspondingly increase the memory allocation for the web system may lead to instability of the system that confuses the outcome of the optimization.
Our Expertise
The performance optimization is an architectural task where it is necessary to go deep into supporting pillars under the web system (threads, database, memory cache, etc.) and also to perform a “surgery” on the Python code of the web system itself.
In general, the performance optimization should look into the following directions, taking the example of Django applications:
- Auditing and reducing the number of SQL database hits in key requests (ideally to 1);
- Optimizing SQL table indexes in accordance with the usage of the web system;
- Distributing computationally intensive tasks and IO/network-bound tasks to background workers (such as Celery and FireWorks) and adapting existing user interaction;
- Implementing caching if necessary or as a quick workaround.
