Research and analysis of Spserver Open source server framework

Source: Internet
Author: User

The Web-based open-source C/s server framework is still relatively small. Recently studied Spserver, which used a lot of design patterns, the purpose of using the design pattern is to separate things and mutable things and packaging, to avoid the future modification of the code, the application of design patterns in the book is "Closed to change, open to expansion", But misuse of design patterns can complicate simple questions.

Spserver code is relatively small, it is easier to understand, if only to do a simple echo server, Spserver can give the novice a quick framework to build a server.

After testing with VLD, it was found that Spserver had a lot of memory leaks. and the Msgqueue_destroy function causes the thread to block and the program does not end normally.

The semi-synchronous half-Asynchronous pattern inside the Spserver is equivalent to the main thread responsible for all data sending and receiving, and the worker thread is responsible for logic. The main thread communicates with the worker thread through Message Queuing. After the main thread receives the data, notifies the worker thread, has the data, the worker thread carries on the message parsing and processing, sends the data to send the queue, then notifies the main thread, has the data, you go to send the.

This model can deal with the complexity of logic, long processing time, the need to send and receive less data is more appropriate situation. But if you need to deal with a file server like this, IO data a lot, but the logic is very simple server, it is not appropriate, the main thread will become a bottleneck, that is, IO will become a bottleneck.

In addition, Spserver does not implement code that connects other servers as a client, requiring users to implement their own connections to other servers.

I am now encapsulating an open source server framework, which is more general and broader than Spserver, and will encapsulate a relatively complete set of implementations based on the system architecture of the game server, from the database proxy server, the login server, the hall server, the game server, the gateway server and other framework processing.

http://blog.csdn.net/langeldep/article/details/5607110

Research and analysis of Spserver Open source server framework

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.