lithium icon indicating copy to clipboard operation
lithium copied to clipboard

Performance issues

Open danielbaud opened this issue 3 years ago • 0 comments

Description

I have faced performance issues with Lithium when using it on a linux 12-core server Even though some benchmarks showed good results (approx 5000 requests per second, 0.3 ms response time), a real conditions scenario resulted in long response times and difficulties with keeping up with the incoming requests The main difference between the two scenarios is that each request is made by a new connection in the second scenario whereas the benchmarks use the same 200 connections during the whole process Also, when using 12 threads (by default), the cpu is barely used. Some tests using up to 800 threads improved the benchmarks but did not solve the problem in the real conditions scenario

Code

The server used in those tests is from this code

li::http_api api;

api.get("/route1") = [&](li::http_request& request, li::http_response& response) {
    response.set_header("Connection", "Keep-alive");
    response.write("\n");
  };

api.get("/route2") = [&](li::http_request& request, li::http_response& response) {
  response.set_header("Connection", "Keep-alive");
  response.write("\n");
};

li::http_serve(api, 12345);

danielbaud avatar Oct 05 '22 10:10 danielbaud