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 in Go
How to do it in NodeJs
Promise.all
How to do it in Swift
concurrency queue
How to do it in Java
AsyncTask
The notice
we don’t know exactly when the job complete, data return
Concurrency and parallelism
Keywords
Concurrency
parallelism
async
go routine
Reference
Bài viết khác
Laravel
Laravel là gì? Laravel là một framework PHP mã nguồn mở miễn phí được phát hành lần đầu tiên vào năm 2011. Taylor Otwell đã tạo ra Laravel nhằm giúp các Developer xây dựng các ứng dụng web bằng cách sử dụng mẫu kiến trúc Model-View-Controller (MVC). Mô hình Model-View-Controller (MVC) trong Laravel: 1. Model […]
PHP
PHP là gì? PHP là từ viết tắt của thuật ngữ Personal Home Page và hiện nay đang có tên Hypertext Preprocessor. Đây là một dạng mã lệnh hoặc một chuỗi ngôn ngữ kịch bản. Trong đó, ngôn ngữ PHP chủ yếu được phát triển để dành cho những ứng dụng nằm trên máy chủ. Mỗi […]
Build for global scale: AFK scale cube and basic rule to build an application for global scale
REF https://akfpartners.com/growth-blog/scale-cube
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 […]