JoshCap20 / areion

The fastest Python web server. A lightweight, fast, and extensible asynchronous Python web server framework.
MIT License
0 stars 1 forks source link

Implemented async version of logger #111

Open MihirKohli opened 1 month ago

MihirKohli commented 1 month ago

Synchronous Logger ❯ wrk -t12 -c400 -d30s http://localhost:8080/log

Running 30s test @ http://localhost:8080/log 12 threads and 400 connections Thread Stats Avg Stdev Max +/- Stdev Latency 12.27ms 3.27ms 48.36ms 96.80% Req/Sec 1.63k 783.22 3.03k 59.14% 584376 requests in 30.06s, 49.04MB read Socket errors: connect 157, read 167, write 0, timeout 0 Requests/sec: 19439.97 Transfer/sec: 1.63MB

Converting default implementation to Async ❯ wrk -t12 -c400 -d30s http://localhost:8080/log

Running 30s test @ http://localhost:8080/log 12 threads and 400 connections Thread Stats Avg Stdev Max +/- Stdev Latency 11.71ms 3.20ms 40.72ms 97.43% Req/Sec 1.71k 824.20 3.60k 54.19% 612285 requests in 30.08s, 51.39MB read Socket errors: connect 157, read 156, write 0, timeout 0 Requests/sec: 20357.39 Transfer/sec: 1.71MB

Using AioLogger ❯ wrk -t12 -c400 -d30s http://localhost:8080/log

Running 30s test @ http://localhost:8080/log 12 threads and 400 connections Thread Stats Avg Stdev Max +/- Stdev Latency 9.82ms 3.20ms 45.92ms 96.23% Req/Sec 2.05k 0.95k 9.67k 59.94% 733606 requests in 30.10s, 61.57MB read Socket errors: connect 157, read 161, write 0, timeout 0 Requests/sec: 24373.75 Transfer/sec: 2.05MB

currently i am facing an issue where internal implementation is all synchronous which somehow is not compatible with async nature of logger please take a look

JoshCap20 commented 1 month ago

currently i am facing an issue where internal implementation is all synchronous which somehow is not compatible with async nature of logger please take a look

Could you expand on this?

MihirKohli commented 1 month ago

one of my implementation include using aiologger with all of the function in async/await manner but that would require async event loop, which is already used by areion which affects the implementation and other implementation was forcing current implementation to async await but that would require an endpoint to be async we can't use async logger in sync endpoint. That was creating an issue while testing. If it doesn't explain the issue i will share screenshots for the same.

MihirKohli commented 1 month ago

check this https://async-worker.github.io/aiologger/index.html