PostgreSQL : subquery, CTE

What is subquery in PostgreSQL? In PostgreSQL, a subquery is a query that is nested inside another query. The subquery is executed first, and its results are used as input to the outer query. Subqueries can be used in various contexts, such as in the SELECT, WHERE, and HAVING clauses of a query. For example, […]

Optimize SQL : rule and todo list

Some rule and todo list to Optimize SQL REF https://www.pgmustard.com/blog/indexing-best-practices-postgresql

PostgreSQL Compound indexes

What is Compound indexes in PostgreSQL? A compound index (also known as a composite index or a multi-column index) refers to an index that is created on two or more columns of a table. It allows PostgreSQL to quickly find rows that match a query condition based on the values in multiple columns, which can […]

Use AWS to deploy your applications and services

Amazon Web Services (AWS) is a cloud computing platform that provides a wide range of services to help businesses and individuals build and deploy applications in the cloud. AWS offers a variety of services such as compute, storage, databases, networking, security, and more. In this guide, we will walk through the steps to get started […]

Use docker to run go project

Docker is a powerful tool that enables developers to create, deploy and run applications in a containerized environment. Using Docker to run Go projects has many advantages, including the ability to isolate your application from the underlying operating system, simplifying the deployment process, and allowing for greater scalability and flexibility. In this guide, we will […]

PostgreSQL indexing best practices

Don’t index every column If indexes are so useful, why don’t we add them to every column? There are a few good reasons, but a big one is that indexes add overhead to writes. Not only do indexes need to be kept up to date when we write to the table, but they can also […]

Golang the basic concept of Go Programing

Go is a statically-typed, concurrent, and garbage-collected programming language developed by Google. Here are some of the basic concepts and guidelines for writing code in Go: Syntax: Go has a simple and straightforward syntax that is easy to learn. The language has a strict coding style, with specific rules for naming variables, functions, and types, […]

Clean code in writing Go program

When writing code in Go, it is important to follow good coding practices to ensure that your code is clean, maintainable, and scalable. Here are some clean code and clean architecture practices to follow: Go coding style: Follow the official Go coding style guide, which includes recommendations for naming conventions, formatting, and documentation. Consistent coding […]

Interfaces in Go and best practice

Interfaces in Go are a set of methods that defines a behavior. A type can implement an interface by defining methods with the same signatures as the methods defined in the interface. This allows for a form of polymorphism in Go, where a single function or method can operate on values of different types, as […]

Explicit ssl bumping with Squid

To perform explicit SSL bumping with Squid, you need to perform the following steps: Generate a SSL certificate and key: You can either generate a self-signed certificate or obtain one from a certificate authority. The certificate and key will be used by Squid to encrypt and decrypt the traffic. Install and configure Squid: Squid is […]

Explicit ssl bumping with HAProxy

Basic guide About Explicit SSL bumping Explicit SSL bumping also known as “SSL interception,” is a feature of some reverse proxies and security appliances that allows the proxy to decrypt, inspect, and re-encrypt SSL/TLS encrypted traffic. The proxy acts as a man-in-the-middle, decrypting incoming SSL/TLS traffic and re-encrypting it before forwarding it to the destination […]

Nodes and Clusters

It is best practice to create clusters with at least three nodes to guarantee reliability and efficiency Every cluster has one master node, which is a unified endpoint within the cluster, and at least two worker nodes Here, we discover some points of nodes and clusters. Let’s begin Nodes and clusters are two of the […]

RPC, gRPC, protocol buffers

What is Remote Procedure Call (RPC) Remote Procedure Call is a software communication protocol that one program can use to request a service from a program located in another computer on a network without having to understand the network’s details. RPC is used to call other processes on the remote systems like a local system. […]

System design practice : twitter

REF https://medium.com/double-pointer/system-design-interview-uber-or-a-similar-app-grab-lyft-or-ola-design-76807fac24c3

System design practice : uber

REF https://medium.com/double-pointer/system-design-interview-uber-or-a-similar-app-grab-lyft-or-ola-design-76807fac24c3

Leader Heavy – Team Management

Kỷ luật Công bằng Xây dựng uy tín ( trust ) Make noise , shout out Làm gì khi thiếu người Áp lực tốt và áp lực xấu Gắn kết team Phát triển kỹ năng cứng và mềm cho team member Tiêu chí: 1/ Làm tốt công việc được giao 3/Làm vượt kỳ vọng REF […]

System design

REF https://medium.com/double-pointer/system-design-interview-uber-or-a-similar-app-grab-lyft-or-ola-design-76807fac24c3

Elastic Search

REF https://pkg.go.dev/gopkg.in/olivere/elastic.v6

Varnish Exporter

Input Output REF https://github.com/jonnenauha/prometheus_varnish_exporter

Caching with varnish

Input Output REF https://varnish-cache.org

gRPC

Input Output REF https://200lab.io/blog/grpc-la-gi-vu-khi-tang-tai-microservices/

Proxy Server

use tmux

Install tmux for macos brew install tmux Install tmux for ubuntu sudo apt-get install tmux -y Config file in tmux Config file is located at ~/.tmux.conf Leader key in tmux By default, leader key is Ctrl+b (Press Ctrl and b) It will activate more tmux function Install plugin manager for tmux Install plugin for tmux […]

Database gateway

Input Output

API gateway

Input 2 server node Output 2 server is served in a cluster Traffic need to balance for 2 server node API gateway with Nginx API gateway with HAProxy REF

Design whole technical system for a Stock Exchange enterprise such as HoSE

Input Database connection: 2000 TPS: 1500 Output:

Design whole technical system for a shipping company such as Grab

Input Database connection: 2000 TPS: 1500 Output:

Design whole technical system for a bank company such as HSBC

Input Database connection: 2000 TPS: 1500 Output:

PgBouncer

PgPoolii

use Git

Git merge Git rebase Git commit Git revert Git add Git checkout Git head~ Git diff Lệnh git fetch Lệnh git fetch tải về dữ liệu từ Remote Repo (các dữ liệu như các commit, các file, refs), dữ liệu tải về để bạn theo dõi sự thay đổi của remote, tuy nhiên tải về […]

Optimize SQL

Ví dụ sử dụng EXPLAIN ANALYZE và đọc dữ liệu plan EXPLAIN ANALYZE SELECT * FROM ENGINEER WHERE first_name = ‘Dominique’ AND last_name LIKE ‘%a%’; Chú ý cách đọc plan sẽ đi từ trong ra ngoài, không phải từ trên xuống dưới: Step đầu tiên dễ dàng nhận thấy là index scan với điều kiện […]

NodeJs Cluster Application

# REF https://nodejs.org/api/cluster.html

Debug go lang with dlv dap

# REF https://github.com/golang/vscode-go/blob/master/docs/debugging.md

Thread and concurrent in swift

A thread is basically a particular path of execution of code. Thread1 is the “main thread”, the one where your app does its basic operations, all of the user interface code, etc. When you start getting into more sophisticated programming, you might employ concurrency, where you send time consuming operations to a background thread/queue so […]

Calculate memory of a map golang

+ cách tính memory của 1 map + có release không thì dựa vào GC bito computing + câu chuyện memory + câu chuyện computing, n với n2

Nodejs developer roadmap

  REF https://github.com/aliyr/Nodejs-Developer-Roadmap

Basic understanding of ELK-stack

Basic understanding of Hadoop

Lock and Deadlock

    DeadLock trong cơ sở dữ liệu và cách phòng tránh   https://www.javatpoint.com/deadlock-in-dbms        

Use postman to run runner

https://blog.postman.com/using-csv-and-json-files-in-the-postman-collection-runner/

Build for global scale: combine all in one together

REFERENCE https://dev.to/aurelmegn/setting-up-distributed-database-architecture-with-postgresql-261 https://www.postgresql.org/docs/9.5/sql-createforeigntable.html https://www.postgresql.org/docs/9.3/ddl-foreign-data.html

Build for global scale: distributed database

A distributed database is a database in which data is stored across different physical locations. It may be stored in multiple computers located in the same physical location (e.g. a data centre); or maybe dispersed over a network of interconnected computers. Some basic information and keyword Master server Slave Server Foreign Table Config file location: […]

Build for global scale: why to choose go lang ?

If you surfering the internet with the keyword “why choose golang” , you might go to a short brief why most people choose go lang for their project Five reasons to start with Golang include: + Golang is advanced and reliable, offering great built-in ways to handle errors. + It is efficient, compiling down to […]

Build for global scale: postgres vs mongodb vs mysql vs redis

SQL Server vs PostgreSQL Comparison Table Here are some of the Comparison: The Basis Of Comparison  SQL Server PostgreSQL Basic Difference SQL server is a database management system which is mainly used for e-commerce and providing different data warehousing solutions. PostgreSQL is an advanced version of SQL which provides support to different functions of SQL […]

RestAPI with GO

What is in this article ? In this artivle, we’ll try to build a bookstore REST API that provides book data and performs CRUD operations. Let’s start by initializing a new Go module. This will enable us to manage the dependencies that are specifically installed for this project. <pre> Note: you can use the command […]

Webserver with nginx and apache

What is in this article ? How to install nginx on centos 7 Some of the basics of NGINX as a refresher Logging, explains that monitoring for errors and access patterns are fundamental to running a server. Rewrites, covers how rewrites work and also specific implementations of many of the common scenarios. It will be […]

Build for global scale : message broker with rabbitMQ and MQTT

What is in this article ? Install rabbitMQ server Connecting to a broker Producing messages Consuming messages Broadcasting messages Guaranteeing message processing Distributing messages to many consumers Using message properties Messaging with transactions Handling unroutable messages Install rabbitMQ server on centos7 You can see a download list here https://www.rabbitmq.com/install-rpm.html#downloads Some basic step to install can […]

Use raspberry as a server: install centos os on raspberry

Reference https://pimylifeup.com/raspberry-pi-centos/

Build for global scale : gRPC and Go

Reference https://grpc.io/docs/languages/go/quickstart/

Build for global scale : socket.io-redis, redis, kafka, rabbitMQ

Skip to content CONTACT US SIGN IN Otonomo Logo Redis, Kafka or RabbitMQ: Which MicroServices Message Broker To Choose? When using asynchronous communication for Microservices, it is common to use a message broker. A broker ensures communication between different microservices is reliable and stable, that the messages are managed and monitored within the system and […]

Build CDN for a global scale system

Some basic questions about CDN and what for 1. What are the seven requirements of end users that relate to Content Networking? The seven requirements of end users that relate to Content Networking are performance, availability, anonymity, ubiquity/accessibility, security, privacy, and personalization/relevancy. 2. What are the nine requirements of service providers that relate to Content […]

Build a system for global scale: basic theory

If you are trying to build a system and try to scale it globally, sell your product all over the world, you will need a collection of rules that are implemented in design and code. In this article, we will make clear some basic knowledge on how to build an system able to scale globally […]

Improve performance x times with concurrency / synchronization

The theory Job A: 5 sec Job B: 6 sec Job C: 7 sec So, to handle job A,B,C we need 5 + 6 + 7 = 18 sec How to improve it ? You can do all job asynchronous So, all to job will be executed at the same time How to do it […]

REDIS IN USE

Install Redis We can install EPEL using yum: sudo yum install epel-release #Once the EPEL installation has finished you can install Redis, again using yum: sudo yum install redis -y #This may take a few minutes to complete. After the installation finishes, start the Redis service: sudo systemctl start redis.service #If you’d like Redis to […]

HAPROXY IN USE

What is this article about ? What is HAProxy ? Install HAProxy Configure the load balancer Use HAProxy to balance Websocket traffic Use HAProxy to configue backup server HAProxy algo Use HAProxy to Observe all requests for errors Use HAProxy to Monitor for server downtime Use HAProxy to send logs to syslog Separating errors into […]

Use VIM for coding

What is in this article about vim? Some Basic knowledge and keyword to use VIM Basic search in document with VIM Basic select text and block with VIM Basic copy and paste with VIM Basic moving in VIM Copy and paste in vim over ssh with X11 forwarding Replace content with VIM Replace content with […]

Docker on Centos

Using Docker Machine, we can set up Docker hosts on local systems, on cloud providers, and other environments very easily. We’ll cover that in a different recipe. How to To Install Docker on centos $ yum -y install docker How it works… The preceding command will install Docker and all the packages required by it. […]

API Gateway with Go and Node.js

## Ref Building an API Gateway using Node.js https://github.com/motiv-labs/janus https://dev.to/alombarte/an-api-gateway-is-not-the-new-unicorn-2kk2

Golang in use

What is this article about? Import Debug Variables and Declarations Function Declarations Data Type Structure, enum, class Maps, Arrays and Slices Interfaces Concurrency Pointer How to create a routes ( Storing routes, static routes, dynamic routes, Forwarding routes… ) Working with web handlers, requests, and ResponseWriter instances: parse request data, response JSON Making a middleware […]

PostgreSQL in use

What is in this article in summary? + Install postgreSQL on centos 7 + Secure your database connection via ssh tunnel + Some basic guide on psql prompt (How to Switching Over to the postgres Account on server, exit postgres back to linux command prompt, Create a new role, Set password for postgres account, Create […]

Golang Concurrency