New book: LINUX multi-thread Server programming-using the muduo C ++ network library

Source: Internet
Author: User

After reading the classic UNIX network programming by W. Richard Steven S, can I use the Sockets API to compile the echo service as shown in the example, but still cannot start with a slightly complex network programming task? Examples in the bookCodeMixing the business logic with the sockets call does not seem to be conducive to future expansion?

    • ProgramWhen the test is normal on the local machine and is put on the network, data is often not fully collected?
    • Does TCP really have the so-called "stick packet problem? How do I design a package splitting protocol? How can we implement the encoding to avoid falling into the trap?
    • Is there any use of advanced features such as out-of-band data (OOB) and signal-driven I/O?
    • How to Design the network protocol format? Will alignment problems occur when sending C struct? How do I communicate with each other without using C/C ++? To upgrade the server software in the future, you need to add a field in the Protocol. Do you have to force upgrade the existing client?
    • To deal with thousands of concurrent connections, it seems that the traditional fork () model mentioned in the book cannot cope with it. Which concurrency model should be used? Try the IO reuse model such as select, poll, and epoll, and feel that there are many non-blocking Io traps. How can the CPU usage of the program always be 100%?
    • Do you want to use the ready-made libevent network library instead? How can I query the database and delay the requests from other connections? Use another thread pool. What if the other party is disconnected when the response is sent back? Will it be a string?
    • I have read "Advanced Programming in UNIX environment" and want to use multiple threads to improve the efficiency of multi-core CPU. However, what kind of multi-threaded model should the program use? Is there a wide range of multi-threaded I/O models worth recommending? Which underlying synchronization primitives, such as mutex, conditional variables, read/write locks, and semaphores, should be used or not? Is there a more advanced synchronization facility that can simplify development? Which of the various objective IPC mechanisms described in "UNIX Network Programming (Volume 2)" can balance development efficiency and scalability?

Network Programming is similar to multi-thread programming, and the actual project is started. More problems are coming to the fore:

    • I heard from people on the internet that server-side development should be able to run on a 7x24 basis. Isn't c ++ STL even disabled to prevent memory fragments from being used even for dynamic memory allocation? Is it worthwhile to do this with high hardware reliability?
    • It is rumored that server development mainly uses logs for error detection. What should I write in the logs? Who wrote the logs? How can I write logs without affecting performance?
    • What are the essential differences between multiple processes of a distributed system with a single server? Why is heartbeat protocol necessary? How can this problem be achieved?
    • How to manage C ++ large-scale projects? How is the library interface designed to ensure that binary compatibility is not damaged during upgrade?

In LINUX multi-thread Server programming, the author tries to answer the above questions based on years of practical engineering experience. Of course, the content is far more than that ......

 

Book supporting page: http://chenshuo.com/book, will be occasionally updated.

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.