diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6d7ca572..fdd7dfd4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -456,6 +456,42 @@ jobs: GRPC_IMAGE_NAME: ${{ needs.set-image-name.outputs.name }} + haskell_grpc_haskell_bench: + runs-on: ubuntu-latest + needs: + - set-image-name + - changed + if: fromJSON(needs.changed.outputs.base) || contains(needs.changed.outputs.files, 'haskell_grpc_haskell_bench/') + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Build haskell_grpc_haskell_bench + run: ./build.sh haskell_grpc_haskell_bench + env: + GRPC_IMAGE_NAME: ${{ needs.set-image-name.outputs.name }} + + - name: Benchmark haskell_grpc_haskell_bench + run: ./bench.sh haskell_grpc_haskell_bench + env: + GRPC_BENCHMARK_DURATION: 30s + GRPC_IMAGE_NAME: ${{ needs.set-image-name.outputs.name }} + + - if: github.ref == 'refs/heads/master' + name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - if: github.ref == 'refs/heads/master' + name: If on master push image to GHCR + run: docker push $GRPC_IMAGE_NAME:haskell_grpc_haskell_bench-complex_proto + env: + GRPC_IMAGE_NAME: ${{ needs.set-image-name.outputs.name }} + + java_aot_bench: runs-on: ubuntu-latest needs: diff --git a/haskell_grpc_haskell_bench/.gitignore b/haskell_grpc_haskell_bench/.gitignore new file mode 100644 index 00000000..bc6c8ff5 --- /dev/null +++ b/haskell_grpc_haskell_bench/.gitignore @@ -0,0 +1,2 @@ +dist-newstyle +src-gen/ diff --git a/haskell_grpc_haskell_bench/Dockerfile b/haskell_grpc_haskell_bench/Dockerfile new file mode 100644 index 00000000..a7571144 --- /dev/null +++ b/haskell_grpc_haskell_bench/Dockerfile @@ -0,0 +1,29 @@ +FROM docker.io/library/haskell:8.10.7 + +RUN apt-get update && apt-get install -y \ + build-essential autoconf libtool libssl-dev pkg-config cmake git + +ARG PARALLEL +RUN BUILD_DIR=$(mktemp -d) && \ + cd $BUILD_DIR && \ + git clone --depth 1 --branch v1.42.0 --recurse-submodules https://github.com/grpc/grpc && \ + cd grpc && \ + cmake -DCMAKE_INSTALL_PREFIX=/usr \ + -DgRPC_BUILD_TESTS=OFF \ + -DBUILD_SHARED_LIBS=ON \ + -DgRPC_INSTALL=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DgRPC_SSL_PROVIDER=package \ + . && \ + make -j ${PARALLEL:-$(nproc)} && \ + make install -j${PARALLEL:-$(nproc)} && \ + rm -rf $BUILD_DIR + +COPY haskell_grpc_haskell_bench /app/bench +COPY proto /app/proto + +RUN cd /app/bench && cabal update && make && cabal install + +RUN rm -rf /app + +ENTRYPOINT /root/.cabal/bin/haskell-grpc-haskell-bench +RTS -N${GRPC_SERVER_CPUS:-1} diff --git a/haskell_grpc_haskell_bench/Makefile b/haskell_grpc_haskell_bench/Makefile new file mode 100644 index 00000000..cb8fc796 --- /dev/null +++ b/haskell_grpc_haskell_bench/Makefile @@ -0,0 +1,11 @@ +CABAL ?= cabal +PROTO_COMPILE_HS = ~/.cabal/bin/compile-proto-file + +grpc-haskell: + ($(CABAL) build proto3-suite && mkdir -p ~/.cabal/bin && \ + $(CABAL) exec which compile-proto-file | tail -1 | xargs -I{} cp {} $(PROTO_COMPILE_HS)) + ($(PROTO_COMPILE_HS) \ + --includeDir /usr/local/include \ + --includeDir ../proto/helloworld \ + --proto helloworld.proto \ + --out ./src-gen/) diff --git a/haskell_grpc_haskell_bench/app/Main.hs b/haskell_grpc_haskell_bench/app/Main.hs new file mode 100644 index 00000000..24adefaf --- /dev/null +++ b/haskell_grpc_haskell_bench/app/Main.hs @@ -0,0 +1,24 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE OverloadedLists #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE RecordWildCards #-} + +module Main where + +import Network.GRPC.HighLevel +import Network.GRPC.HighLevel.Generated + +import Helloworld + +main :: IO () +main = + greeterServer + (Greeter{ greeterSayHello = sayHello }) + defaultServiceOptions{serverHost = "0.0.0.0", serverPort = 50051} + +sayHello + :: ServerRequest 'Normal HelloRequest HelloReply + -> IO (ServerResponse 'Normal HelloReply) +sayHello (ServerNormalRequest _metadata HelloRequest{..}) = do + return $ ServerNormalResponse (HelloReply helloRequestRequest) [] StatusOk "" diff --git a/haskell_grpc_haskell_bench/cabal.project b/haskell_grpc_haskell_bench/cabal.project new file mode 100644 index 00000000..76bc434c --- /dev/null +++ b/haskell_grpc_haskell_bench/cabal.project @@ -0,0 +1,17 @@ +packages: + . + +source-repository-package + type: git + location: https://github.com/awakesecurity/gRPC-haskell.git + tag: d20c20d63c170b5eaf5725f03f7b7060352af402 + +source-repository-package + type: git + location: https://github.com/awakesecurity/gRPC-haskell.git + tag: d20c20d63c170b5eaf5725f03f7b7060352af402 + subdir: core + +package grpc-haskell-core + extra-include-dirs: /usr/local/include + extra-lib-dirs: /usr/local/lib diff --git a/haskell_grpc_haskell_bench/grpc-haskell-bench.cabal b/haskell_grpc_haskell_bench/grpc-haskell-bench.cabal new file mode 100644 index 00000000..240eefe9 --- /dev/null +++ b/haskell_grpc_haskell_bench/grpc-haskell-bench.cabal @@ -0,0 +1,25 @@ +cabal-version: 2.4 +name: grpc-haskell-bench +version: 0.1.0.0 + +executable haskell-grpc-haskell-bench + main-is: Main.hs + hs-source-dirs: app src-gen + other-modules: Helloworld + build-depends: + , base >=4.14 && <5 + , bytestring + , containers + , deepseq + , grpc-haskell + , grpc-haskell-core + , proto3-suite ^>=0.6 + , proto3-wire ^>=1.4 + , text + , vector + + default-language: Haskell2010 + ghc-options: + -O2 -Wall -Wcompat -Widentities -Wincomplete-record-updates + -Wincomplete-uni-patterns -Wpartial-fields -Wredundant-constraints + -threaded -rtsopts diff --git a/haskell_mu_onhold/.gitignore b/haskell_mu_onhold/.gitignore deleted file mode 100644 index 4c61acd3..00000000 --- a/haskell_mu_onhold/.gitignore +++ /dev/null @@ -1 +0,0 @@ -dist-newstyle \ No newline at end of file diff --git a/haskell_mu_onhold/Dockerfile b/haskell_mu_onhold/Dockerfile deleted file mode 100644 index d4d0827e..00000000 --- a/haskell_mu_onhold/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM haskell:8.10.4 - -COPY haskell_mu_bench /app/haskell_mu_bench -COPY proto /app/proto - -RUN cd /app/haskell_mu_bench && cabal update && cabal install - -ENTRYPOINT /app/haskell_mu_bench/run.sh diff --git a/haskell_mu_onhold/app/Main.hs b/haskell_mu_onhold/app/Main.hs deleted file mode 100644 index da7c852f..00000000 --- a/haskell_mu_onhold/app/Main.hs +++ /dev/null @@ -1,32 +0,0 @@ -{-# LANGUAGE TypeApplications #-} -{-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE KindSignatures #-} -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE TypeOperators #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE OverloadedLabels #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE PartialTypeSignatures #-} -{-# OPTIONS_GHC -Wno-partial-type-signatures #-} -module Main where - -import Mu.Quasi.GRpc -import Mu.Server (MonadServer, SingleServerT, singleService, method) -import Mu.Schema ((:/:), Term) -import Mu.Schema.Optics (record1, (^.)) -import Mu.GRpc.Server (runGRpcApp, msgProtoBuf) - -grpc "HelloWorld" id "helloworld.proto" - -main :: IO () -main = runGRpcApp msgProtoBuf 50051 greeterServer - -type HelloRequest = Term HelloWorld (HelloWorld :/: "HelloRequest") -type HelloReply = Term HelloWorld (HelloWorld :/: "HelloReply") - -sayHello :: MonadServer m => HelloRequest -> m HelloReply -sayHello req = pure $ record1 (req ^. #name) - -greeterServer :: MonadServer m => SingleServerT info Greeter m _ -greeterServer = singleService (method @"SayHello" sayHello) diff --git a/haskell_mu_onhold/haskell-mu-bench.cabal b/haskell_mu_onhold/haskell-mu-bench.cabal deleted file mode 100644 index 1f5e717d..00000000 --- a/haskell_mu_onhold/haskell-mu-bench.cabal +++ /dev/null @@ -1,18 +0,0 @@ -cabal-version: 2.4 -name: haskell-mu-bench -version: 0.1.0.0 -author: Akshay Mankar -maintainer: itsakshaymankar@gmail.com -extra-source-files: helloworld.proto - -executable haskell-mu-bench - main-is: Main.hs - hs-source-dirs: app - default-language: Haskell2010 - ghc-options: -threaded -O2 - build-depends: base ^>=4.14.1.0 - , mu-grpc-server - , mu-optics - , mu-protobuf - , mu-rpc - , mu-schema diff --git a/haskell_mu_onhold/helloworld.proto b/haskell_mu_onhold/helloworld.proto deleted file mode 120000 index 57144e53..00000000 --- a/haskell_mu_onhold/helloworld.proto +++ /dev/null @@ -1 +0,0 @@ -../proto/helloworld/helloworld.proto \ No newline at end of file diff --git a/haskell_mu_onhold/run.sh b/haskell_mu_onhold/run.sh deleted file mode 100755 index 78753c8f..00000000 --- a/haskell_mu_onhold/run.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh - -/root/.cabal/bin/haskell-mu-bench +RTS "-N${GRPC_SERVER_CPUS:-1}" diff --git a/scala_akka_bench/pom.xml b/scala_akka_bench/pom.xml index fdea4018..26263394 100644 --- a/scala_akka_bench/pom.xml +++ b/scala_akka_bench/pom.xml @@ -14,7 +14,7 @@ 2.6.20 2.1.6 2.13 - 1.52.1 + 1.56.1 UTF-8