Browse Source

Lithium: Fix plaintext errors. (#5538)

* Lithium: Fix plaintext errors.

* Lithium update.

* Lithium: Fix.

* Lithium: Fix.
Matthieu Garrigues 5 years ago
parent
commit
534c0de116

+ 0 - 19
frameworks/C++/lithium/benchmark_config.json

@@ -47,26 +47,7 @@
         "display_name": "Lithium-postgres",
         "display_name": "Lithium-postgres",
         "notes": "",
         "notes": "",
         "versus": "None"
         "versus": "None"
-      },
-      "plaintext-g": {
-        "plaintext_url"  : "/plaintext",
-        "port": 8080,
-        "approach": "Realistic",
-        "classification": "Micro",
-        "database": "mysql",
-        "framework": "Lithium",
-        "language": "C++",
-        "flavor": "None",
-        "orm": "Full",
-        "platform": "None",
-        "webserver": "None",
-        "os": "Linux",
-        "database_os": "Linux",
-        "display_name": "Lithium-plaintext-g",
-        "notes": "",
-        "versus": "None"
       }
       }
-
       
       
     }
     }
   ]
   ]

+ 1 - 1
frameworks/C++/lithium/lithium-mysql.dockerfile

@@ -5,7 +5,7 @@ RUN apt install -yqq libboost-dev libmariadb-dev wget  libboost-context-dev g++-
 
 
 COPY ./ ./
 COPY ./ ./
 
 
-ENV COMMIT=d66c2fcf52606587601032124cf8a08d47aebaed
+ENV COMMIT=062c167b61ba14292d54bade9534adca33a8d19e
 
 
 RUN wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_mysql.hh
 RUN wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_mysql.hh
 RUN wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_http_backend.hh
 RUN wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_http_backend.hh

+ 0 - 15
frameworks/C++/lithium/lithium-plaintext-g.dockerfile

@@ -1,15 +0,0 @@
-FROM buildpack-deps:focal
-
-RUN apt update -yqq
-RUN apt install -yqq libboost-dev libmariadb-dev wget  libboost-context-dev g++-9 gdb
-
-COPY ./ ./
-
-ENV COMMIT=d66c2fcf52606587601032124cf8a08d47aebaed
-
-RUN wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_mysql.hh
-RUN wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_http_backend.hh
-
-RUN g++ -O3 -g -DTFB_MYSQL -DPLAINTEXT_ONLY -std=c++17 ./lithium.cc -I /usr/include/mariadb -lpthread -lmariadbclient -lboost_context -o /lithium_tbf
-
-CMD gdb -batch -x ./gdb.cmds --args /lithium_tbf tfb-database 8080

+ 1 - 1
frameworks/C++/lithium/lithium-postgres.dockerfile

@@ -5,7 +5,7 @@ RUN apt install -yqq g++-9 libboost-dev postgresql-server-dev-all libpq-dev wget
 
 
 COPY ./ ./
 COPY ./ ./
 
 
-ENV COMMIT=d66c2fcf52606587601032124cf8a08d47aebaed
+ENV COMMIT=062c167b61ba14292d54bade9534adca33a8d19e
 
 
 RUN wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_pgsql.hh
 RUN wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_pgsql.hh
 RUN wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_http_backend.hh
 RUN wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_http_backend.hh

+ 21 - 22
frameworks/C++/lithium/lithium.cc

@@ -33,7 +33,7 @@ void set_max_sql_connections_per_thread(int max)
 #endif
 #endif
 }
 }
 
 
-float tune_n_sql_connections(int& nc_to_tune, std::string http_req, int port, int min, int max) {
+void tune_n_sql_connections(int& nc_to_tune, std::string http_req, int port, int min, int max) {
 
 
   std::cout << std::endl << "Benchmark " << http_req << std::endl;
   std::cout << std::endl << "Benchmark " << http_req << std::endl;
 
 
@@ -46,6 +46,8 @@ float tune_n_sql_connections(int& nc_to_tune, std::string http_req, int port, in
     int nc = min + (max - min) * i / 7;
     int nc = min + (max - min) * i / 7;
     nc_to_tune = nc;
     nc_to_tune = nc;
 
 
+    // Warmup.
+    http_benchmark(sockets, 4, 200, http_req);
     float req_per_s = http_benchmark(sockets, 4, 1000, http_req);
     float req_per_s = http_benchmark(sockets, 4, 1000, http_req);
     std::cout << nc << " -> " << req_per_s << " req/s." << std::endl;
     std::cout << nc << " -> " << req_per_s << " req/s." << std::endl;
     if (req_per_s > max_req_per_s)
     if (req_per_s > max_req_per_s)
@@ -59,7 +61,6 @@ float tune_n_sql_connections(int& nc_to_tune, std::string http_req, int port, in
 
 
   std::cout << "best: " << best_nconn << " (" << max_req_per_s << " req/s)."<< std::endl;
   std::cout << "best: " << best_nconn << " (" << max_req_per_s << " req/s)."<< std::endl;
   nc_to_tune = best_nconn;
   nc_to_tune = best_nconn;
-  return best_nconn;
 }
 }
 
 
 int main(int argc, char* argv[]) {
 int main(int argc, char* argv[]) {
@@ -94,10 +95,10 @@ int main(int argc, char* argv[]) {
     s::randomNumber = int());
     s::randomNumber = int());
 
 
 
 
-  int db_nconn = 64;
-  int queries_nconn = 64;
-  int fortunes_nconn = 64;
-  int updates_nconn = 64;
+  int db_nconn = 128/nprocs;
+  int queries_nconn = 2;
+  int fortunes_nconn = 128/nprocs;
+  int updates_nconn = 2;
 
 
   http_api my_api;
   http_api my_api;
 
 
@@ -191,23 +192,21 @@ int main(int argc, char* argv[]) {
     response.write(ss.to_string_view());
     response.write(ss.to_string_view());
   };
   };
 
 
-#ifndef PLAINTEXT_ONLY
-  // Tune the number of sql connections.
-  int tunning_port = port+1;
-  std::thread server_thread([&] {
-    http_serve(my_api, tunning_port, s::nthreads = nprocs);
-  });
-  usleep(3e5);
-
-  tune_n_sql_connections(db_nconn, "GET /db HTTP/1.1\r\n\r\n", tunning_port, 1, sql_max_connection/nprocs);
-  tune_n_sql_connections(queries_nconn, "GET /queries?N=20 HTTP/1.1\r\n\r\n", tunning_port, 1,  std::min(sql_max_connection/nprocs, 20));
-  tune_n_sql_connections(fortunes_nconn, "GET /fortunes HTTP/1.1\r\n\r\n", tunning_port, 1, sql_max_connection/nprocs);
-  tune_n_sql_connections(updates_nconn, "GET /updates?N=20 HTTP/1.1\r\n\r\n", tunning_port, 1, std::min(sql_max_connection/nprocs, 20));
+  // // Tune the number of sql connections.
+  // int tunning_port = port+1;
+  // std::thread server_thread([&] {
+  //   http_serve(my_api, tunning_port, s::nthreads = nprocs);
+  // });
+  // usleep(3e5);
+
+  // tune_n_sql_connections(db_nconn, "GET /db HTTP/1.1\r\n\r\n", tunning_port, 1, sql_max_connection/nprocs);
+  // tune_n_sql_connections(queries_nconn, "GET /queries?N=20 HTTP/1.1\r\n\r\n", tunning_port, 1,  std::min(sql_max_connection/nprocs, 14));
+  // tune_n_sql_connections(fortunes_nconn, "GET /fortunes HTTP/1.1\r\n\r\n", tunning_port, 1, sql_max_connection/nprocs);
+  // tune_n_sql_connections(updates_nconn, "GET /updates?N=20 HTTP/1.1\r\n\r\n", tunning_port, 1, std::min(sql_max_connection/nprocs, 7));
   
   
-  li::quit_signal_catched = true;
-  server_thread.join();
-  li::quit_signal_catched = false;
-#endif
+  // li::quit_signal_catched = true;
+  // server_thread.join();
+  // li::quit_signal_catched = false;
 
 
   // Start the server for the Techempower benchmark.
   // Start the server for the Techempower benchmark.
   http_serve(my_api, port, s::nthreads = nprocs);
   http_serve(my_api, port, s::nthreads = nprocs);