In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
1. Model 1: TCP/IP S (classic) cause: there is no difference between the client and the server. But the resources (video, news, software) are all monopolized by the data provider: after the server starts, first create one or more listening socket, and call the bind function to bind it to the required (custom) port, and then call the listen function to wait for the customer connection characteristics: the customer connection is a random event, requires some kind of Icano model to listen for the connection. Example: server select system call (when the monitor receives a connection, the server receives it with accept, and allocates a logical unit to serve it, (the fork system generates a logical unit, which handles everything back to the client, which can be a newly created child process, subthread, or other).
two。 Next is the P2P model that the otaku is familiar with.
Advantage: get rid of the center of communication
The characteristic is that each machine will provide services to others when it consumes services.
Example: Thunderbolt, cloud computer group
Problem: hosts are difficult to find each other (find servers to solve this problem)
But it's still CS in essence, just an extension in disguise.
2.1I/O processing unit is composed of request queue (communication mode, usually permanent tCP connection) 2.1I/O processing unit: a module that manages client connections, waits and accepts new connections, accepts client data, and returns the corresponding data from the server to the client. The sending and receiving of the data may not be here, but it may also be in the logical unit, (depending on the event processing mode) 2.2 logical unit: analyze and process the data, and then pass the result to the Imax O processing unit or directly to the client (for the cluster, a logical unit may be a logical server) 2.3. Network storage: it can be databases, caches and files, or a server (some are not needed, such as ssh,telnet) 2.4. Request queue: the abstract two aspects of the communication mode between each unit: the way in which the TCP O processing unit notifies the logic unit, and the mechanism by which the logic unit accesses the memory unit. Here we will refer to the concept of pool, which is generally understood as a permanent and efficient TCP connection established beforehand.
3.I/O model
3.1 blocking and non-blocking can be used for all file descriptors, not just socket
3.2 blocking may not be completed immediately and is suspended by the operating system until a waiting event occurs.
3.3 non-blocking is that calls to the system always return immediately. So if the completion family does not occur, the same flag as the error will be returned. (errno can distinguish)
Requirements: we need to complete the family situation, the operation of non-blocking in order to achieve high efficiency.
Example: I use O multiplexing (the most commonly used notification mechanism, as well as SIGIO signals)
Meaning: there is a function called Istroke O reuse function, which can register a set of events with the kernel, and the kernel can notify the application of completed events.
Example: I use O reuse function: select,poll,epoll_wait
How it works: each function itself is blocked, but they all have the ability to listen for multiple Imax O events.
Note: the signal processing of SIGIO will be discussed later.
Remark 2: both the blocking Ihamo and the signal-driven IhampO are synchronous Ipicuro models.
Principle: the read and write operations of Icano are all after the occurrence of the Icano event.
Asynchronous I _ write O: (POSIX specification) users can directly read and write to I _ sign O, which tells the user the location of the read-write buffer and how the kernel notifies the application after the operation is completed.
The core difference between the two: synchronous is that the user handles the Icano operation, while asynchronous I.O is the kernel that executes the Icano operation.
Difference 2: synchronously notifies the application that the second is the Imax O ready event, and the async is the Imax O completion event.
Under linux, aio.h provides support for asynchronous Icano.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.