Skip to content

Commit

Permalink
Implement test by URL for webrtc load test (#328)
Browse files Browse the repository at this point in the history
* Implement test by URL for webrtc load test

* make it easier to click the link from a terminal

* implement as a string format
  • Loading branch information
mjh1 authored Nov 15, 2023
1 parent f9be780 commit c717610
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,5 @@ tags
/testdriver
/recordtester
/api-transcoder

webrtc-load-tester.conf
12 changes: 9 additions & 3 deletions cmd/webrtc-load-tester/roles/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type loadTestArguments struct {
}
Playback struct {
BaseURL string
ManifestURL string
RegionViewersJSON map[string]int
ViewersPerWorker int
MemoryPerViewerMiB int
Expand Down Expand Up @@ -67,6 +68,7 @@ func Orchestrator() {
fs.StringVar(&cliFlags.Streamer.InputFile, "streamer-input-file", "bbb_sunflower_1080p_30fps_2sGOP_noBframes_2min.mp4", "Input file to stream")

fs.StringVar(&cliFlags.Playback.BaseURL, "playback-base-url", "https://monster.lvpr.tv/", "Base URL for the player page")
fs.StringVar(&cliFlags.Playback.ManifestURL, "playback-manifest-url", "", "URL for playback")
utils.JSONVarFlag(fs, &cliFlags.Playback.RegionViewersJSON, "playback-region-viewers-json", `{"us-central1":100,"europe-west2":100}`, "JSON object of Google Cloud regions to the number of viewers that should be simulated there. Notice that the values must be multiples of playback-viewers-per-worker, and up to 1000 x that")
fs.IntVar(&cliFlags.Playback.ViewersPerWorker, "playback-viewers-per-worker", 50, "Number of viewers to simulate per worker")
fs.IntVar(&cliFlags.Playback.MemoryPerViewerMiB, "playback-memory-per-viewer-mib", 100, "Amount of memory to allocate per viewer (browser tab)")
Expand Down Expand Up @@ -138,7 +140,7 @@ func runLoadTest(ctx context.Context, args loadTestArguments) error {
}

glog.Infof("Stream created: %s", stream.ID)
glog.Infof("Access the stream at: %s", path.Join(args.APIServer, "/dashboard/streams", stream.ID))
glog.Infof("Access the stream at: https://%s", path.Join(args.APIServer, "/dashboard/streams", stream.ID))

_, streamer, err := gcloud.CreateJob(ctx, streamerJobSpec(args, stream.StreamKey))
if err != nil {
Expand Down Expand Up @@ -269,6 +271,11 @@ func playerJobSpec(args loadTestArguments, region string, viewers int, playbackI
numTasks := viewers / args.Playback.ViewersPerWorker
timeout := args.TestDuration + 10*time.Minute

playbackURL := ""
if args.Playback.ManifestURL != "" {
playbackURL = fmt.Sprintf(args.Playback.ManifestURL, playbackID)
}

return gcloud.JobSpec{
Region: region,

Expand All @@ -277,8 +284,7 @@ func playerJobSpec(args loadTestArguments, region string, viewers int, playbackI
Args: []string{
"-base-url", args.Playback.BaseURL,
"-playback-id", playbackID,
// TODO: Support region/node-specific playback by building the playback URL here
// "-playback-url", stream.PlaybackURL,
"-playback-url", playbackURL,
"-simultaneous", strconv.Itoa(simultaneous),
"-duration", args.TestDuration.String(),
},
Expand Down

0 comments on commit c717610

Please sign in to comment.