Image for post
Image for post

Why is it so slow???” One of the top reasons for slow performance in backend is N+1 query. It is a query to load the main model and N queries for loading the associated model, inefficient query, and a common performance anti-pattern.

It is much faster to issue 1 query which returns 100 results than to issue 100 queries which each return 1 result.

Let’s take a look at this example with rails active record. Let’s say you have two tables on your DB, cars and variants, where an entity in cars can have many variants.

class Car < ActiveRecord::Base…


Image for post
Image for post
image from lucidchart.com

Giving feedback is a common way to tell someone about their performance. The purpose of feedback is to help someone becoming better or avoiding the same failures. It should not be used as a tool for attacking personal or listing mistakes.

Feedback can be positive (praise someone on what they’ve done well), negative (letting someone know about about things could be improved), or neutral (just an objective observation).

When the content is negative, the delivery should be always constructive.

Constructive feedback is providing comments or suggestions that contributes to a positive outcome, a better process or improved behaviours.

Writing a…


Elasticsearch, “you know for search”, is a well known search engine with RESTFUL HTTP interface. It’s fast, scalable, and easy to use. Elasticsearch is built to be always available and scale with our needs.

It’s hard to design the perfect elasticsearch setup for the first time. People usually start with the most simple solution that can fit their needs, that’s normal. As your documents and traffic grow, you may need to scale your elasticsearch, especially if you have a performance issue. Here are some tips that you can apply to scale your elasticsearch

Sharding

Image for post
Image for post
Image from codingexplained.com

Documents in an index can grow to…


Image for post
Image for post

Microservice is a famous architecture that has been applied by many tech companies. It enables the rapid, frequent and reliable delivery of large, complex applications, and allows an organisation to evolve its technology stack. It seems to be a good architecture but a too small service can increase the overhead on communications, maintenance, and many more. A service that is too small or fine-grade is called a Nanoservice.

Some people say that Nanoservice is an anti-pattern because of the overhead in maintenance, communication, and so on. Well, It’s not wrong. …

Bakti Yudha

Software Engineer | Architect | Manager | A father of two

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store