# ws_compare **Repository Path**: misc_projects/ws_compare ## Basic Information - **Project Name**: ws_compare - **Description**: 比较 websocketPP 与 uWebSocket 两个三方ws库的性能。 - **Primary Language**: C++ - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-08-28 - **Last Updated**: 2024-10-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # README 测试两个第三方`websocket`库的性能: - [uWebsockets](https://github.com/uNetworking/uWebSockets) - [websocketpp](https://github.com/zaphoyd/websocketpp) 其他WebSocket实现: - [libwebsockets](https://github.com/warmcat/libwebsockets) ## 测试结果 ### 1. 4个客户端 共`8000`次请求,每次返回`4M`字节数据。 ```bash ./test_client -t 4 -r 80000 ``` websocketpp: ```bash All clients finished in 391975.255262 ms. Per request average time: 19.5987627631 ms ``` uWebsockets: ```bash All clients finished in 98273.536712 ms. Per request average time: 4.9136768356000005 ms ``` ### 2. 8个客户端 共`8000`次请求,每次返回`4M`字节数据。 ```bash ./test_client -t 8 -r 80000 -p 13002 ``` websocketpp: ```bash All clients finished in 297170.177093 ms. Per request average time: 29.7170177093 ms ``` uWebsockets: ```bash All clients finished in 106424.44266 ms. Per request average time: 10.642444266 ms ``` ### 3. 16个客户端 ```bash ./test_client -p 13003 -t 16 -r 16000 ``` websocketpp: ```bash All clients finished in 86742.814601 ms. Per request average time: 86.742814601 ms ``` uWebsockets: ```bash All clients finished in 24193.924938 ms. Per request average time: 24.193924938 ms ``` ### 4. 32个客户端 ```bash ./test_client -p 13004 -t 32 -r 32000 ``` websocketpp: ```bash All clients finished in 153942.455073 ms. Per request average time: 153.942455073 ms ``` uWebsockets: ```bash All clients finished in 68590.992145 ms. Per request average time: 68.590992145 ms ``` ## ref: uWebsockets 资料 - [github ChatServer](https://github.com/Ok-san/ChatServer/blob/master/ChatServer/ChatServer.cpp) - [github uWebSockets HTTP](https://github.com/unikraft/app-uwebsockets/blob/staging/main.cpp) - [github simple-http-server-cpp](https://github.com/edmBernard/simple-http-server-cpp/blob/master/src/main.cpp) - [uWebSockets concurrent sessions](https://stackoverflow.com/questions/62109533/uwebsockets-concurrent-sessions) - [uWebSockets tests(Demos)](https://github.com/satishavhad/uWebSockets/blob/master/tests/main.cpp) - [uWebSocektsDemo](https://github.com/wangdamingll/uWebSocektsDemo/tree/master) - [WebSocketDemo](https://github.com/wangdamingll/WebSocketDemo)