Skip to content

Commit

Permalink
[MM-53432] Refactor to support multiple job types (#44)
Browse files Browse the repository at this point in the history
* Refactor part I

* Refactor part II

* Update

* Updates

* Update Go version

* Fix tests

* Bump recorder

* Bump transcriber

* Update old references

* Update Golang image

* [MM-53432] Improvements (#46)

* Update transcriber

* Don't set defaults

* Update Go image

* Include transcriptions performance test results (#47)

* Update deps

* Bump min recorder version
  • Loading branch information
streamer45 authored Nov 21, 2023
1 parent d119502 commit be7044b
Show file tree
Hide file tree
Showing 18 changed files with 425 additions and 198 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
go-version: [1.19.x]
go-version: [1.21.x]

runs-on: ubuntu-latest

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
name: lint
strategy:
matrix:
go-version: [1.19.x]
go-version: [1.21.x]
runs-on: ubuntu-latest
steps:
- name: Install Go
Expand All @@ -19,7 +19,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.52.2
version: v1.54.2

# Optional: if set to true then the action will use pre-installed Go.
skip-go-installation: true
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ DOCKER_REGISTRY_REPO ?= mattermost/${APP_NAME}-daily
DOCKER_USER ?= user
DOCKER_PASSWORD ?= password
## Docker Images
DOCKER_IMAGE_GO += "golang:${GO_VERSION}@sha256:dd9ad81920b63c7f9f18823d888d5fdcc7e7516086fd16654d07bc437f0e2427"
DOCKER_IMAGE_GOLINT += "golangci/golangci-lint:v1.52.2@sha256:5fa6a92ab28ca3421c88d2b6cd794c9759d05a999aceca73053d014aad41b9d3"
DOCKER_IMAGE_GO += "golang:${GO_VERSION}@sha256:337543447173c2238c78d4851456760dcc57c1dfa8c3bcd94cbee8b0f7b32ad0"
DOCKER_IMAGE_GOLINT += "golangci/golangci-lint:v1.54.2@sha256:abe731fe6bb335a30eab303a41dd5c2b630bb174372a4da08e3d42eab5324127"
DOCKER_IMAGE_DOCKERLINT += "hadolint/hadolint:v2.9.2@sha256:d355bd7df747a0f124f3b5e7b21e9dafd0cb19732a276f901f0fdee243ec1f3b"
DOCKER_IMAGE_COSIGN += "bitnami/cosign:1.8.0@sha256:8c2c61c546258fffff18b47bb82a65af6142007306b737129a7bd5429d53629a"
DOCKER_IMAGE_GH_CLI += "registry.internal.mattermost.com/images/build-ci:3.16.0@sha256:f6a229a9ababef3c483f237805ee4c3dbfb63f5de4fbbf58f4c4b6ed8fcd34b6"
Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This dockerfile is used to build Mattermost rtcd
# A multi stage build, with golang used as a builder
# and gcr.io/distroless/static as runner
ARG GO_IMAGE=golang:1.19.8@sha256:dd9ad81920b63c7f9f18823d888d5fdcc7e7516086fd16654d07bc437f0e2427
ARG GO_IMAGE=golang:1.21@sha256:b17c35044f4062d83c815434615997eed97697daae8745c6dd39dc3673b87efb
# hadolint ignore=DL3006
FROM ${GO_IMAGE} as builder

Expand Down
36 changes: 36 additions & 0 deletions docs/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,42 @@ On the Mattermost side, it may also be necessary to tune the [`FileSettings.MaxF
> If a load-balancer or proxy is in front of Mattermost, extra configuration may be necessary.
> As an example, `nginx` would likely require `client_max_body_size` to be set accordingly.
### Calls Transcriptions

#### Deployment

- `calls-offloader` `v0.5.0`
- `calls-transcriber` `v0.1.0`
- `c6i.2xlarge` EC2 instance
- 8vCPU / 16GB RAM

#### Model sizes

The transcriber's model size can be configured through the [Calls plugin](https://docs.mattermost.com/configure/plugins-configuration-settings.html#transcriber-model-size). At this time we support the following [Whisper.cpp](https://huggingface.co/ggerganov/whisper.cpp) models:

| Model | File size | Memory |
|------:|----------:|-------:|
| tiny | 75MB |~273MB |
| base | 142MB |~388MB |
| small | 466MB |~852MB |

#### Benchmarks

| Model | Threads | CPU (avg) | Memory (avg) | Call duration | Processing time |
|-------|---------|-----------|--------------|---------------|-----------------|
| tiny | 1 | 13.5% | 1.20GB | 10m | 2m20s (4.28x) |
| base | 1 | 13.0% | 1.23GB | 10m | 4m45s (2.10x) |
| small | 1 | 12.8% | 1.67GB | 10m | 16m50s (0.59x) |
| tiny | 2 | 25.0% | 1.20GB | 10m | 1m17s (7.79x) |
| base | 2 | 25.5% | 1.27GB | 10m | 2m41s (3.73x) |
| small | 2 | 25.3% | 1.68GB | 10m | 9m23s (1.07x) |
| tiny | 4 | 49.4% | 1.20GB | 10m | 45s (13.33x) |
| base | 4 | 49.8% | 1.27GB | 10m | 1m32s (6.52x) |
| small | 4 | 49.6% | 1.71GB | 10m | 5m27s (1.84x) |
| tiny | 4 | 48.7% | 1.85GB | 60m | 3m38s (16.51x) |
| base | 4 | 49.5% | 1.70GB | 60m | 7m6s (8.45x) |
| small | 4 | 50.0% | 1.99GB | 60m | 22m50s (2.63x) |

## Scalability

Starting in version `v0.3.2`, this service includes support for horizontal scalability. This can be achieved by adding an HTTP load balancer in front of multiple `calls-offloader` instances, and configuring the [Job Service URL](https://docs.mattermost.com/configure/plugins-configuration-settings.html#job-service-url) setting accordingly to point to the balancer's host.
Expand Down
29 changes: 15 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/mattermost/calls-offloader

go 1.18
go 1.21.4

require (
git.mills.io/prologic/bitcask v1.0.2
Expand All @@ -9,11 +9,12 @@ require (
github.com/docker/docker v20.10.9+incompatible
github.com/gorilla/mux v1.8.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/mattermost/calls-recorder v0.4.2-0.20230830151011-a4935f7c38bf
github.com/mattermost/mattermost/server/public v0.0.0-20230613002302-62a3ee8adcb5
github.com/mattermost/calls-recorder v0.6.0
github.com/mattermost/calls-transcriber v0.1.0
github.com/mattermost/mattermost/server/public v0.0.6
github.com/pborman/uuid v1.2.1
github.com/stretchr/testify v1.8.2
golang.org/x/crypto v0.8.0
github.com/stretchr/testify v1.8.4
golang.org/x/crypto v0.15.0
k8s.io/api v0.27.3
k8s.io/apimachinery v0.27.3
k8s.io/client-go v0.27.3
Expand All @@ -39,7 +40,7 @@ require (
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/gopherjs/gopherjs v1.17.2 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand All @@ -55,19 +56,19 @@ require (
github.com/plar/go-adaptive-radix-tree v1.0.4 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/wiggin77/merror v1.0.4 // indirect
github.com/wiggin77/merror v1.0.5 // indirect
github.com/wiggin77/srslog v1.0.1 // indirect
golang.org/x/exp v0.0.0-20200908183739-ae8ad444f925 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/oauth2 v0.4.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/term v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/term v0.14.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/grpc v1.54.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
google.golang.org/grpc v1.56.1 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading

0 comments on commit be7044b

Please sign in to comment.