1. The difference between routers and switches
The router can automatically assign IP and virtual dial
switches for the local area network. It is only used to distribute network data. The
router is at the network layer. The
router can handle TCP / IP protocol according to the IP address . The switch cannot be
at the relay layer. The root MAC address addressing
router can One IP is distributed to multiple hosts. The same external IP
switch can connect many hosts. Different external IP
routers can provide firewalls. The switch can not
interact with the computer to expand the LAN access point, allowing the LAN to connect more computer
routers. Is used for internet connection
2. What is domain name resolution
Domain name resolution is the conversion process from domain name to IP address
3. Application scenarios and advantages of producer consumer model
Decoupling
supports concurrency.
Supports
multi-threading between uneven and busy . When doing crawling, producers use to generate url links, consumers use to obtain url data, and with the help of queues, you can use multi-threading to speed up crawling.
4. What is cdn
cdn: Content distribution network
caching algorithm The
caching algorithm determines the hit rate, source server pressure, pop node storage capacity,
distribution capacity,
distribution capacity depends on IDC capabilities and IDC strategic distribution,
load balancing,
intelligent scheduling determines the best route, response time, availability, quality of service
Based on DNS DNS-
based load balancing intelligently chooses the best node service
support protocol
static and dynamic acceleration, download acceleration, streaming media acceleration, enterprise application acceleration, mobile application acceleration
load balancing software nginx
5. What is nginx and its function
nginx is a high-performance HTTP and reverse proxy server, which is characterized by low memory consumption and strong concurrency.
Proxy server is the
main role of proxy network users to obtain network information
1. Break through its own IP access restrictions, visit foreign sites
2. Visit some units Or internal resources of the group
3. Break through the IP blockade of China Telecom
4. Improve the access speed
5. Hide the real IP from network attacks
The load balancing algorithm supported by Nginx is as follows:
1. Weight polling
default algorithm, the received requests are one by one in order Distribution, you can configure different weight values for each back-end server to adjust the distribution rate of different servers.
2.ip_hash
Each request is matched according to the hash result of the IP of the initiating client, so that each back-end is assigned The servers are all the same
3.fair
intelligent adjustment scheduling algorithm, combined with the first two modes of dynamic allocation, additional upstream_fair module needs to be installed
4.url_hash
distributes requests according to the hash result of accessing url, nginx as a static server can improve cache efficiency
advantages :
1. As a web server, Nginx processes static files, index files, and automatically requests High efficiency
2. As a proxy server, Nginx can achieve non-cached reverse proxy acceleration to improve the speed of the website
3. As a load balancing server, Nginx can directly support Rails and PHP internally, or it can support HTTP proxy servers for external services. Also supports simple fault tolerance and load balancing using algorithms
4. In terms of performance, Nginx supports high concurrency
5. In terms of stability, low memory consumption
6. In terms of high availability, Nginx supports hot deployment
6. What is the role of lvs
lvs: Linux Virtual Server, Linux virtual server, is a virtual server cluster system
lvs is mainly used for load balancing of multiple servers
1. Working at the network layer, can achieve high performance, high availability server cluster technology
2. Can be many The performance servers are combined to form a super server
. 3. Easy to use, simple to configure, and there are multiple load balancing methods
. 4. Stable, even if a server in the cluster cannot work normally, it does not affect the overall effect.
5. Very expandable
7. What is keepalived and its function
Keepalived is a lightweight high-availability solution under Linux. It
was originally designed for lvs and is specifically designed to monitor the status of each service node in the cluster system.
VRRP protocol
8. What is haproxy and its role
haproxy is a proxy software that provides high availability, load balancing, and TCP and HTTP applications. It supports virtual hosting, is free, fast, and reliable. It is
particularly suitable for web sites with heavy loads. These sites usually require session maintenance or seven-layer processing
. : High availability, load balancing, and proxy for TCP and http-based applications
9. What is load balancing
1. Forward a large amount of concurrent processing to multiple back-end nodes for processing, reducing work response time;
2. Forward a single heavy workload to multiple back-end nodes for processing, and then return to the load balancing center after processing, and then to the user
The four-layer load balancing
starts from the fourth-layer transport layer, uses ip + port to receive the request, and then forwards it to the corresponding machine
F5: hardware load balancer, good function, high cost
lvs: heavyweight four-layer load software
nginx: lightweight High-level four-layer load software with cache function, flexible regular expression
haproxy: Simulates four-layer forwarding, more flexible
Seven-layer load balancing
starts from the seventh layer application layer, receives requests according to virtual url or ip, host name, and then turns Corresponding processing server
haproxy: inherent load balancing skills, full support for seven-layer proxy, session maintenance, marking, path transfer
nginx: only function better on http protocol and mail protocol
apache: poor function
mysql proxy: function is
generally lvs do four-layer load, nginx do seven-layer load
10. Briefly describe the role and application scenarios of the asynio module
asyncio is a standard library introduced in python3.4 version
. The programming model that supports asynchronous IO directly is a message loop. We directly obtain an EventLoop reference from the asyncio module, and then throw the coroutine that needs to be executed to EventLoop. Implementation, it realizes asynchronous IO
11. Briefly describe the role and application scenarios of the genent module
When a greenlet encounters IO operations, such as accessing the network, it automatically switches to other greenlets, waits for the IO operations to complete, and then switches back to continue execution when appropriate. Because the IO operation is very time-consuming, the program is often in a waiting state. With greenlet automatically switching coroutines, it is guaranteed that there are always greenlets running, rather than waiting for IO
12. Use and application of twisted framework
twisted is a single-threaded asynchronous framework that can process multiple tasks concurrently.
Single-threaded and multi-threaded are used to process multiple tasks
. Cycles are used to drive task processing. The reactor model
uses the Application class to solve Reactor Loop management. Users only need to introduce this Class and declare that you can
use the service class to manage the user's business logic, users only need to register the service in the Application can
use the defferred class to manage callbacks, this class of objects can help users deal with abnormal problems