2 service and configuration design dimensions -- ace Reading Notes

Source: Internet
Author: User
2 service and configuration design dimensions

Network Programming comprehensively balances complexity, security, and robustness, while making trade-offs in terms of time and space.
Complexity:
Single Service, stateless connection (HTTP)
Status hold (SMTP)
Thread Pool/(Oracle connection mode)
Listener Manager (inetd manages FTP and Telnet connections)
Security:
1) Multithreading
1. multithreading may cause problems: multiple threads share the same system resources and distribute different threads for connections of two users with different permissions, the two threads share the same file handle, which may pose a threat to system security.
2) Dynamic Connection Library
2. The same applies to dynamic database connection. Each process maps to the same database file. If a user modifies the database file. In this way, other users are also affected. A typical operation is a Trojan horse ". (Trojan horses)
Robustness
1) dynamic configuration. 24*7 uninterrupted operation. (Dynamic service reconfiguration ). An additional Configuration Manager is required to broadcast configuration update events.
2) load balancing.

Time:
1) running time:
Multi-thread: Shared data pages, effectively avoiding violent memory paging.
Thread/process pool: Reduces the time consumed for Thread/process creation and destruction.
2) space:
Thread Pool: a large amount of process space is used.
Dynamic Connection Library: reduces memory usage.

Simplest network server:

 

Several efficient network server models:

1. Multi-Service (multiservice servers) servers

Listen supports multiple ports, and select Monitors multiple socket handles. After the Select Operation, the event is sent to the appropriate process. Inetd is a typical example.

The multi-service model separates the TCP handshake process from the business logic. BenefitsCodeMaintenance.

2. multi-thread pool Server

Use local IPC to pass socket handle from the listening process to the session process. To implement a process to process multiple socket handle. Each thread uses ace_tp_reactor: handle_events () to process events on socket handle in a multi-threaded model.

The process pool and thread pool (Standing servers) are implemented through local IPC. Apue 2th edition 17.4. Passing file descriptors describes how to transfer handles between processes through the IPC Mechanism.

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.