On Node.js, Go and concurrency

On Node.js, Go and concurrencyRyan Dahl, the creator of Node.js, said the following while he was talking about Node's concurrency model: [...] I think Node is not the best system to build a massive server web. I would use Go for that. And honestly, that’s the reason why I left Node. It was the realization that: oh, actually, this is not the best server-side system ever. That was strong. Why Dahl, who worked so hard to build and advocate Node.js back then, would just give up his creation and promote something else? What does that mean to Node.js and its huge community? Let's first do a quick recap.

Node.js historyNode.js was inspired on NGINX event-driven architecture non-blocking I/O. Basically it means that instead of relying on threads for concurrency (be it OS, green or coroutines), we have only one thread coordinating asynchronous work through an event loop. Dahl then built Node.js to make it happen, mixing together other facilities like a simplified web server API, V8 and Ja…

How to ...

1. How to nginx are designed and work ?
- NGINX uses an asynchronous, event‑driven approach to handling connections. - One worker process per CPU core - When an NGINX server is active, only the worker processes are busy. Each worker process handles multiple connections in a nonblocking fashion, reducing the number of context switches
- Command: ps axw -o pid,ppid,user,%cpu,vsz,wchan,command | egrep '(nginx|PID)'
- worker_processes – The number of NGINX worker processes (the default is 1). In most cases, running one worker process per CPU core works well, and we recommend setting this directive to auto to achieve that. There are times when you may want to increase this number, such as when the worker processes have to do a lot of disk I/O. - worker_connections – The maximum number of connections that each worker process can handle simultaneously. The default is 512, …

Node.js Summarization

1. What is node js

-Node.js is a javascript runtime built on Chrome's V8 javascript engine

- Js on server
global process
- Js on the browser( Chrome )

window  document

2. Why should use node js

- Node js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient
- Nodejs' package ecosystem npm is the largest ecosystem of open source libraries in the world

HTML Character Sets

HTML Character Sets

ISO-8859-1 :
UTF-8 :

The Difference Between Unicode and UTF-8

Unicode is a character set. UTF-8 is encoding. Unicode is a list of characters with unique decimal numbers (code points). A = 65, B = 66, C = 67, .... This list of decimal numbers represent the string "hello": 104 101 108 108 111 Encoding is how these numbers are translated into binary numbers to be stored in a computer: UTF-8 encoding will store "hello" like this (binary): 01101000 01100101 01101100 01101100  01101111

How to Manage Processes from the Linux Terminal: 10 Commands You Need to Know

The Linux terminal has a number of useful commands that can display running processes, kill them, and change their priority level. This post lists the classic, traditional commands, as well as some more useful, modern ones. Many of the commands here perform a single function and can be combined — that’s the Unix philosophy of designing programs. Other programs, like htop, provide a friendly interface on top of the commands.
top The top command is the traditional way to view your system’s resource usage and see the processes that are taking up the most system resources. Top displays a list of processes, with the ones using the most CPU at the top.
To exit top or htop, use the Ctrl-C keyboard shortcut. This keyboard shortcut usually kills the currently running process in the terminal. htop The htop command is an improved top. It’s not installed by default on most Linux distributions — here’s the command you’ll need to install it on Ubuntu: sudo apt-get install htop
htop displays the sa…

Setup Django behind uWSGI and NGINX on CentOS 7

Setting up a web server for Django could be challenging and headache. Let’s try to make it simple: Django behind uWSGI and NGINX on CentOS 7 from scratch. At the end, our complete stack of components will look like this: the web client <-> the web server <-> the socket <-> uwsgi <-> Django 1. Install Dependencies 1.1. NGINX yum install epel-release -y
yum install nginx -y 1.2. Python 3 & PIP yum install python34-devel gcc -y
curl -O
/usr/bin/python3.4 1.3. Create VirtualEnv with Python3 pip install virtualenv
mkdir -p /var/www && cd /var/www
virtualenv -p python3 p3venv If you are up-to-dated person, you can install 3.6.2 (latest python version as of now – Aug 28, 2017) follow this instruction 1.4. Install uWSGI & Django # Activate virtual environment
source p3venv/bin/activate
pip install uwsgi
pip install django 2. Configuratio…