Browse Source

[mORMot] speed up pipelining; speed up docker build (#8057)

* [mORMot] using a modified libpq that allows to send the PipelineSync command without flushing prev. commands to socket

* [mORMot] fix dockerfile, speed up a docker build command

* [mORMot] shorten server name for better plaintext performance

* [mORMot] change `Server` header value to `mmt` because `M` provokes debate

* [mORMot] use 1 letter server header, till is NOT added as a rule and verification

---------

Co-authored-by: pavel.mash <[email protected]>
pavelmash 2 years ago
parent
commit
9f43d30e64

+ 1 - 2
frameworks/Pascal/mormot/mormot.dockerfile

@@ -11,8 +11,7 @@ RUN /bin/bash -c ./setup_and_build.sh
 
 FROM ubuntu:22.04
 COPY --from=builder /build/bin/fpc-x86_64-linux/raw /usr/local/bin/raw
-
-RUN apt-get update && apt-get install -yqq postgresql-client
+COPY --from=builder /build/libpq.so.5.16 /usr/lib/x86_64-linux-gnu/libpq.so.5
 
 EXPOSE 8080
 CMD ["raw"]

+ 5 - 1
frameworks/Pascal/mormot/setup_and_build.sh

@@ -35,11 +35,15 @@ echo "Download statics from $URL ..."
 wget -qO- "$URL" | tar -xz -C ./libs/mORMot/static
 
 # uncomment for fixed commit URL
-URL=https://github.com/synopse/mORMot2/tarball/c57d48846f050f4f68856758d28cf76450addaf2
+URL=https://github.com/synopse/mORMot2/tarball/edf377a61aa5ac99add92d144480b12095f578c2
 #URL="https://api.github.com/repos/synopse/mORMot2/tarball/$USED_TAG"
 echo "Download and unpacking mORMot sources from $URL ..."
 wget -qO- "$URL" | tar -xz -C ./libs/mORMot  --strip-components=1
 
+# download our modified libpq what do not PQflush inside PQPipelineSync
+URL=https://github.com/pavelmash/postgres/releases/download/5.16_PQpipelineSync_noflush/libpq.so.5.16
+echo "Download modified libpq from $URL ..."
+wget -q -O./libpq.so.5.16 "$URL"
 
 # uncomment line below to echo commands to console
 set -x

+ 2 - 0
frameworks/Pascal/mormot/src/raw.pas

@@ -193,6 +193,7 @@ begin
      hsoIncludeDateHeader  // required by TPW General Test Requirements #5
     ] + flags);
   fHttpServer.HttpQueueLength := 10000; // needed e.g. from wrk/ab benchmarks
+  fHttpServer.ServerName := 'M';
   // use default routing using RTTI on the TRawAsyncServer published methods
   fHttpServer.Route.RunMethods([urmGet], self);
   // wait for the server to be ready and raise exception e.g. on binding issue
@@ -233,6 +234,7 @@ begin
     pStmt.SendPipelinePrepared;
     pConn.PipelineSync;
   end;
+  pConn.Flush; // we use modified libpq what not flush inside PQPipelineSync - flush manually
   for i := 0 to cnt - 1 do
   begin
     pStmt.GetPipelineResult;