Looking at the causes of performance bottlenecks

Usually, performance bottlenecks can be caused by a number of factors, which may include shortage of physical resources in the environment where the application is deployed or choosing a bad algorithm to process a particular workload when a better algorithm was available. Let's take a look at some of the possible issues that may lead to performance bottlenecks in a deployed application:

  • Not having enough hardware resources: Initially, most of the bottlenecks in performance and scalability are due to poor planning of the hardware resources required to run an application. This may happen due to incorrect estimations or a sudden unplanned surge in the user base of the application. When this happens, the existing hardware resources get stressed and the system slows down.
  • Incorrect design choices: In Chapter 2, Design Patterns – Making a Choice, we looked at how important design choices are to any enterprise-grade application. Constantly allocating new objects for something that could have been done through the allocation of a single shared object is going to impact the application's performance by not only stressing the available resources but also by causing unnecessary delays due to repeated allocations of objects.
  • Inefficient algorithms: The places where a large amount of data is being processed or the systems that perform a large amount of calculations to generate a result may often see degraded performance due to choosing inefficient algorithms. A careful study of the availability of alternative algorithms or in-place algorithmic optimizations may help boost the performance of the application.
  • Memory leaks: In large applications, there could be places where memory leaks may happen in an unexpected manner. Although this is difficult in garbage-collected languages such as Python, it's still a possibility. There could be times when objects, although no longer in use, still aren't garbage collected because of the way they have been mapped inside the application. Over a longer period of runtime, this will cause the available memory to decrease and eventually will bring the application to a halt.

These were a few reasons why performance bottlenecks in a system happen. Fortunately for us as software developers, we have a number of tools that can help us pinpoint bottlenecks, as well as find things such as memory leaks or even just profile the memory usage of individual portions.

With this knowledge about why some performance bottlenecks happen, it's time for us to move onto learning how to look for these performance bottlenecks in an application and then trying to understand some of the ways we can reduce their impact.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.40.189