Check Hiredis version requirement
mastermuduo with hiredis, ensure that the installed version of hiredis is 0.11.0 or greater.repository·master·Indexed 12 days ago
https://github.com/chenshuo/muduoA high-performance, multithreaded C++ network library built on the reactor pattern for Linux environments. It includes support for asynchronous HTTP requests via a libcurl bridge, a broadcasting hub system, and various protocol examples including Memcached, Finger (RFC 1288), and a Google Protobuf RPC proof of concept.
muduo with hiredis, ensure that the installed version of hiredis is 0.11.0 or greater.The muduo/net/protorpc directory contains a proof of concept implementation of Google Protobuf RPC built on top of the muduo network library.
Warning: This implementation is a proof of concept only. The object lifetime management is not ideal and deviates from the standard muduo approach.
For a more stable or production-ready version, users are encouraged to use the dedicated repository: http://github.com/chenshuo/muduo-protorpc.
The hub system is a broadcasting architecture composed of three main components:
hub server.Developers can use the pubsub library to build custom clients that communicate with the hub server for real-time message distribution.
The Finger protocol is a text-based protocol used to obtain information about users on a remote host. It operates over TCP on port 79.
Protocol Workflow:
The wordcount example demonstrates a distributed system where wordcount_hasher shards <word,count> pairs to multiple wordcount_receiver instances based on the hash of the word.
<word,count> pairs from multiple hashers and write the aggregated results to disk.hash(word).To run a cluster with 3 hashers and 4 receivers:
Run one receiver on each of the 4 target machines. The syntax is bin/wordcount_receiver <port> <num_hashers>.
Run the hashers on 3 machines. The syntax is bin/wordcount_hasher '<receiver_addresses>' <input_file1> [<input_file2> ...].
Wait for all hasher and receiver processes to exit to ensure all data is processed and written to disk.
### Example: 3 Hashers and 4 Receivers
# 1. Run 4 receivers on 4 machines
bin/wordcount_receiver port1 3
bin/wordcount_receiver port2 3
bin/wordcount_receiver port3 3
bin/wordcount_receiver port4 3
# 2. Run 3 hashers on 3 machines
bin/wordcount_hasher 'ip1:port1,ip2:port2,ip3:port3,ip4:port4' input1
bin/wordcount_hasher 'ip1:port1,ip2:port2,ip3:port3,ip4:port4' input2
bin/wordcount_hasher 'ip1:port1,ip2:port2,ip3:port3,ip4:port4' input3 input4To build the Muduo library and its components, run the provided build script from the repository root.
./build.shBefore building Muduo, ensure your system meets the following requirements:
boost::any only.Install the necessary build tools and libraries using your package manager:
For Debian, Ubuntu, and derivatives:
$ sudo apt install g++ cmake make libboost-devFor CentOS and derivatives:
$ sudo yum install gcc-c++ cmake make boost-devel# Debian, Ubuntu, etc.
$ sudo apt install g++ cmake make libboost-dev
# CentOS
$ sudo yum install gcc-c++ cmake make boost-develThe muduo-curl bridge is a proof-of-concept implementation demonstrating how to integrate libcurl with the muduo network library. It provides the simplest use case for performing asynchronous HTTP requests within a muduo-based application.
Critical Implementation Notes:
curl may be a blocking operation if your libcurl was not built with c-ares support. This can impact the performance of the muduo event loop.Request object must remain in scope and survive until the doneCallback is executed. Do not destroy the request object before the callback completes.The examples/memcached directory provides a simple implementation of the Memcached protocol for both the server and client sides. This is intended as sample code to demonstrate network programming patterns using the muduo library rather than a production-ready Memcached replacement.
Server Implementation:
(tc)malloc without customized memory management or footprint control.Current Limitations (Not implemented):
incr/decr operationsThe ZeroMQ examples in this repository demonstrate how to implement an echo server and client using a LengthHeaderCodec. This codec is used to handle message framing by prefixing messages with their length, ensuring reliable message delimitation in the stream.
local_lat.cc: Implements an echo server using LengthHeaderCodec.remote_lat.cc: Implements an echo client using LengthHeaderCodec.