DEV Community

Arpit Mohan
Arpit Mohan

Posted on • Originally published at insnippets.com

Tips for increasing your application performance

TL;DR notes from articles I read today.

Tips for 10x application performance

  • Accelerate and secure applications with a reverse proxy server to free up the application server from waiting for users to interact with it. It is also a prerequisite for many other performance increasing capabilities - load balancing, caching static files, and for better security & scalability too.
  • Apply load balancing to protocols such as HTTP, HTTPS, SPDY, HTTP/2, WebSocket, FastCGI, SCGI, uwsgi, memcached, TCP-based applications, Layer 4 protocols etc.
  • Cache both static and dynamic content to reduce the load on application servers.
  • Use established compression standards to reduce file sizes for photos, videos, and music. Avoid leaving text data, including HTML, CSS, and JavaScript uncompressed as their compression can have a large effect especially over slow or otherwise constrained connections. If you use SSL, compression reduces the amount of data to be SSL-encoded, saving time.
  • Monitor real-world performance closely, in real-time, both within specific devices and across your web infrastructure. You should use global application performance monitoring tools to check page load times remotely and also monitor the delivery side. 


Full post here, 20 mins read


Simple Java performance tuning tips

  • To start optimizing your app, use a profiler to find the real bottlenecks in the code and then create a performance test suite for the whole application based on that information. Run your tests before and after every attempt at optimization.
  • Use primitive types rather than wrapper classes wherever possible to minimize overheads as they are stored to the stack and not the heap. Avoid BigInteger and BigDecimal as they dramatically slow down calculations and use a lot of memory.
  • If your app uses a lot of replace operations and you aren’t updated to the latest version of Java, consider the Apache Commons StringUtils.replace method rather than String.replace. You can make the change easily by adding a Maven dependency for Apache’s Commons Lang to your app’s pom.xml to replace all instances.
  • Cache especially your more expensive resources or most-used snippets of code, such as database connections or the valueOf method for the Integer class. However, you are creating an overhead and you may need to manage the cache to keep it accessible and remove outdated information, so be sure the tradeoff is worthwhile.


Full post here, 9 mins read


How to optimize your website speed by improving the backend

  • The N+1 query problem slows down many apps when several queries are issued to linked fields in a database. You can use the ActiveRecord ORM tool in Rails that employs eager loading of all associated elements with a single query to help solve this problem.
  • Normalize relational databases at the design stage itself and ensure effective indexing so the indexes don’t slow down your website. In some cases, denormalization is more effective though - where there are many table joins, adding an extra field to one table may be better or adding calculated values you need often to a table can help if you frequently execute complicated calculations.
  • Cache carefully to speed up your site. For SQL caching in Rails, use low-level caching to store query results for a longer time. In general, prefer fragment caching of page blocks for dynamic web apps, use page caching in Rails with the actionpack-page_caching gem, but avoid it if your web has frequently updated content like news feeds. For authentication actions and error messages, use the actionpack-action_caching gem.
  • Use a content delivery network (CDN) of edge servers to cache static content like images, JavaScript, and CSS files for reduced latency across geographies, reduced operational costs compared to handling your own servers, stability and scalability.

Full post here, 11 mins read


Get these notes directly in your inbox every weekday by signing up for my newsletter, in.snippets().

Top comments (0)