// where we define the chain of handlers for each messeage received
class EchoPipelineFactory : public PipelineFactory {
public:
EchoPipeline::Ptr newPipeline(
std::shared_ptr sock) override {
auto pipeline = EchoPipeline::create();
pipeline->addBack(AsyncSocketHandler(sock));
`
The result is wangle need more ram and cpu than asio, but the throughput is much low.
the another test with clean libevent also better than wangle, and same as asio.
Please tell me how to Improve performance?
What should I do?Because I need an high performance server.
Please help me! Thanks
Thanks for your job, you did a great project.However, I encountered performance problems in my project
I did some benchmark for pingpong, but the result is sad. On my pc(amd fx8350, 16g ram, ubuntu16.04) the result of wangle test with 8 thread is
` W0424 01:17:14.667428 12226 client_fixed_size.cc:124] name=./benchmark_pingpong_client_fixed_size 63656968192 total bytes read W0424 01:17:14.667443 12226 client_fixed_size.cc:125] name=./benchmark_pingpong_client_fixed_size 16556827 total messages read W0424 01:17:14.667455 12226 client_fixed_size.cc:126] name=./benchmark_pingpong_client_fixed_size 3844.76 average message size W0424 01:17:14.667485 12226 client_fixed_size.cc:127] name=./benchmark_pingpong_client_fixed_size 607.08 MiB/s throughput
` 607.08 MiB/s
but the same client to the asio server is
` W0424 01:19:32.815338 12311 client_fixed_size.cc:124] name=./benchmark_pingpong_client_fixed_size 157147705344 total bytes read W0424 01:19:32.815352 12311 client_fixed_size.cc:125] name=./benchmark_pingpong_client_fixed_size 38366139 total messages read W0424 01:19:32.815363 12311 client_fixed_size.cc:126] name=./benchmark_pingpong_client_fixed_size 4096 average message size W0424 01:19:32.815392 12311 client_fixed_size.cc:127] name=./benchmark_pingpong_client_fixed_size 1498.68 MiB/s throughput
` the asio test code is https://github.com/huyuguang/asio_benchmark
my wangle echo server code is
` /*
include <gflags/gflags.h>
include <wangle/bootstrap/ServerBootstrap.h>
include <wangle/channel/AsyncSocketHandler.h>
include <wangle/codec/LineBasedFrameDecoder.h>
include <wangle/codec/StringCodec.h>
include <wangle/channel/OutputBufferingHandler.h>
using namespace folly; using namespace wangle;
DEFINE_int32(port, 8080, "echo server port");
typedef Pipeline<IOBufQueue&, std::unique_ptr> EchoPipeline;
// the main logic of our echo server; receives a string and writes it straight // back class EchoHandler : public BytesToBytesHandler { public:
};
// where we define the chain of handlers for each messeage received class EchoPipelineFactory : public PipelineFactory {
public:
EchoPipeline::Ptr newPipeline(
std::shared_ptr sock) override {
// pipeline->addBack(LineBasedFrameDecoder()); // pipeline->addBack(StringCodec()); pipeline->addBack(EchoHandler()); // pipeline->addBack(OutputBufferingHandler()); pipeline->finalize(); return pipeline; } };
class MyAsyncServerSocketFactory:public AsyncServerSocketFactory{ public: public: std::shared_ptr newSocket(
folly::SocketAddress address, int /backlog/, bool reuse,
const ServerSocketConfig& config) override {
};
int main(int argc, char** argv) { gflags::ParseCommandLineFlags(&argc, &argv, true);
}
` The result is wangle need more ram and cpu than asio, but the throughput is much low. the another test with clean libevent also better than wangle, and same as asio. Please tell me how to Improve performance? What should I do?Because I need an high performance server. Please help me! Thanks