Improving performance the web application
Pagination: looks simple, but exists many applications no applying pagination in listing the data. Returning all registers generate processement unnecessary in many situations, not is necessary to return all data in one only time.
Orm: are tools that abstract communication with databases to the form object oriented, but there are moments where it is necessary to execute complex queries with orm is slow. This moment use native sql to complex queries is the correct for gain performance.
Search only the necessary: one another thing a lot simple, but when one application grows up it’s simple detail makes different. Imagem the scenery: you make one request to one endpoint in api and return many data unnecessary for context present generated process unnecessary. This moment can use one querystring to specifically necessary to return in response. Example: /peoples/?fields=usename,email.
Static files: are files that no matter how many times you request the files, the content continues the same. The css, js and image files are good examples. When we speak about static files there are some solutions to improving performance:
- Minify css and js files this form the file size reduce and it’s allow download more quick.
- Use CDN, what is it? CDN(content delivery network) where static content is cached and the content is searched in one machine geography more near the person that requested it.
Zip the response: when we work with applications using http protocol to request something, make requests to the server and the server processes data and returns a response. The response can be zipped making response reduce size and allowing download more quickly.
Asynchronous process: are processes that can execute in a moment later, different the processes synchronous that need execute in exactly the moment. Example: imagem that after registering a new user must send the email welcome. This email no need be sent in exactly the moment register user, email can be sent one time later.
Cache: is one solution very interessent to improving the performance of the applications due the data stored in memory. Example: one user makes a request to your application, you search the data in the database and store it in cache and after returning a response to the user. In the next request no necessary search data in the database only gets data in cache. It makes response return more quick, because getting data in memory is more quick than getting data in the database.