Skip to content

Instantly share code, notes, and snippets.

View nmvuong92's full-sized avatar
🎯
Focusing

Vượng Nguyễn nmvuong92

🎯
Focusing
View GitHub Profile

We can't really recommend a way to start root sagas however we can certainly explain better the effect. I think it's probably worth creating a dedicated documentation page.

// single entry point to start all Sagas at once

export default function* rootSaga() {
  yield [
    saga1(),
    saga2(),
    saga3(),

redux saga

sagas/rootSage.js

import {delay} from 'redux-saga';
import {all} from 'redux-saga/effects';
  • effect là hàm kết nối redux-saga vào reducer
  • all là một redux saga effect dùng để chạy nhiều saga cùng 1 lúc
import { sayHello, watchIncrement, watchDecrement } from './counterSaga'; /*import 3 saga watch function*/

cấu trúc http://localhost:9200/tên_index/tên_type/mã_id nguồn

https://www.linkedin.com/pulse/big-data-t%E1%BB%95ng-quan-v%E1%BB%81-elasticsearch-donald-trung-manh-nguyen/
$ curl -XPUT 'http://localhost:9200/blog/post/1' -d '{
   "author": "lucas",
 "tags": ["java", "web"],

NGUYÊN TẮC THIẾT KẾ TRONG ELASTICSEARCH

Bạn không thể thiết kế một cụm (cluster) mà không biết khối lượng công việc của bạn sẽ là bao nhiêu?

"You can't design a cluster without knowing what your workload will be"

Bao nhiêu tìm kiếm và ghi mỗi giây bạn sẽ nhận được?

"how much search and writes per second you'll get"

tốc độ các chỉ mục của bạn sẽ tăng nhanh như thế nào?

"how fast your indexes will grow"

@nmvuong92
nmvuong92 / ES.md
Last active September 6, 2018 08:52

ELASTICSEARCH

Các khái niệm, đơn vị

NRT near real time

Là ứng dụng gần thời gian thực, dưới 1 giây

cluster (cụm)

  • Một tập hợp Nodes (servers) chứa tất cả các dữ liệu.
  • Cái tên nói lên tất cả, 1 cụm cluster trong Elasticsearch là một nhóm của nhiều nút elasticsearch (nodes) được kết nối với nhau

REDIS

  • Là ứng dụng lưu trữ cache key-value trên RAM

By default there are 16 databases (indexed from 0 to 15) and you can navigate between them using select command. Number of databases can be changed in redis config file with databases setting. để chọn database

select index

By default, it selects the database 0. To select a specified one, use redis-cli -n 2 (selects db 2)

MongoDB

Bước 1: tải đúng file

cmd > php -v

PHP 7.1.19 (cli) (built: Jun 20 2018 23:37:55) ( ZTS MSVC14 (Visual C++ 2015) x86 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

Ví dụ ở trên MSVC14 => phải tải cùng phiên bản Visual c++ về sau đó giải nén copy file php_mongodb.dll vào thư mục C:\xampp\php\ext

@nmvuong92
nmvuong92 / Fix Composer can't find mongodb extension.md
Last active September 5, 2018 06:00
Fix Composer can't find mongodb extension
composer require jenssegers/mongodb --ignore-platform-reqs

hoặc

composer install --ignore-platform-reqs
@nmvuong92
nmvuong92 / Blocking & Nonblocking IO.md
Last active September 4, 2018 09:43
Blocking & Nonblocking I/O

I/O?

  • Là quá trình giao tiếp
  • Đưa dữ liệu vào trả dữ liệu ra

BLOCKING vs NonBlocking

Blocking I/O

  • Yêu cầu thực thi một IO operation, sau khi hoàn thành thì trả kết quả lại. Process/Theard gọi bị block cho đến khi có kết quả trả về hoặc xảy ra ngoại lệ.