Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions cmd/config_gcr_rps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"Seed": 42,

"Platform": "GCR",
"DirigentConfigPath": "cmd/dirigent/config_containerd.json",
"InvokeProtocol" : "http1",
"EndpointPort": 80,

"BusyLoopOnSandboxStartup": false,

"RpsTarget": 1,
"RpsColdStartRatioPercentage": 0,
"RpsCooldownSeconds": 10,
"RpsImage": "ghcr.io/vhive-serverless/invitro_empty_function:latest",
"RpsRuntimeMs": 10,
"RpsMemoryMB": 2048,
"RpsIterationMultiplier": 80,

"TracePath": "RPS",
"Granularity": "minute",
"OutputPathPrefix": "data/out/experiment",
"IATDistribution": "equidistant",
"CPULimit": "1vCPU",
"ExperimentDuration": 1,
"WarmupDuration": 0,

"IsPartiallyPanic": false,
"EnableZipkinTracing": false,
"EnableMetricsScrapping": false,
"MetricScrapingPeriodSeconds": 15,
"AutoscalingMetric": "concurrency",

"GRPCConnectionTimeoutSeconds": 15,
"GRPCFunctionTimeoutSeconds": 900
}
31 changes: 31 additions & 0 deletions cmd/config_gcr_trace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"Seed": 42,

"Platform": "GCR",
"DirigentConfigPath": "cmd/dirigent/config_containerd.json",
"InvokeProtocol" : "http1",
"EndpointPort": 80,

"BusyLoopOnSandboxStartup": false,

"TracePath": "data/traces/example",
"Granularity": "minute",
"OutputPathPrefix": "data/out/experiment",
"IATDistribution": "exponential",
"CPULimit": "1vCPU",
"ExperimentDuration": 30,
"WarmupDuration": 0,

"IsPartiallyPanic": false,
"EnableZipkinTracing": false,
"EnableMetricsScrapping": false,
"MetricScrapingPeriodSeconds": 15,
"AutoscalingMetric": "concurrency",

"GRPCConnectionTimeoutSeconds": 15,
"GRPCFunctionTimeoutSeconds": 900,
"DAGMode": false,
"EnableDAGDataset": true,
"Width": 2,
"Depth": 2
}
8 changes: 8 additions & 0 deletions cmd/gcr_settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Region": "us-central1",
"Project": "serverless-scheduling",
"ServiceAccount": "328799819690-compute@developer.gserviceaccount.com",

"AllowUnauthenticated": true,
"EndpointSuffix": "328799819690"
}
6 changes: 5 additions & 1 deletion cmd/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const (
var (
configPath = flag.String("config", "cmd/config_knative_trace.json", "Path to loader configuration file")
failurePath = flag.String("failureConfig", "cmd/failure.json", "Path to the failure configuration file")
gcrPath = flag.String("gcrConfig", "cmd/gcr_settings.json", "Path to Google Cloud Run configuration file")
verbosity = flag.String("verbosity", "info", "Logging verbosity - choose from [info, debug, trace]")
iatGeneration = flag.Bool("iatGeneration", false, "Generate IATs only or run invocations as well")
iatFromFile = flag.Bool("generated", false, "True if iats were already generated")
Expand Down Expand Up @@ -95,6 +96,7 @@ func main() {
common.PlatformOpenWhisk,
common.PlatformAWSLambda,
common.PlatformDirigent,
common.PlatformGCR,
}
if !slices.Contains(supportedPlatforms, cfg.Platform) {
log.Fatal("Unsupported platform!")
Expand Down Expand Up @@ -149,7 +151,7 @@ func parseYAMLSpecification(cfg *config.LoaderConfiguration) string {
case "firecracker":
return "workloads/firecracker/trace_func_go.yaml"
default:
if cfg.Platform != common.PlatformDirigent {
if cfg.Platform != common.PlatformDirigent && cfg.Platform != common.PlatformGCR {
log.Fatal("Invalid 'YAMLSelector' parameter.")
}
}
Expand Down Expand Up @@ -201,6 +203,7 @@ func runTraceMode(cfg *config.LoaderConfiguration, readIATFromFile bool, writeIA

// loads dirigent config only if the platform is 'dirigent'
DirigentConfiguration: config.ReadDirigentConfig(cfg),
GCRConfiguration: config.ReadGCRConfiguration(*gcrPath),

IATDistribution: iatType,
ShiftIAT: shiftIAT,
Expand Down Expand Up @@ -245,6 +248,7 @@ func runRPSMode(cfg *config.LoaderConfiguration, readIATFromFile bool, writeIATs
TraceDuration: experimentDuration,

DirigentConfiguration: dirigentConfig,
GCRConfiguration: config.ReadGCRConfiguration(*gcrPath),

Functions: generator.CreateRPSFunctions(cfg, dirigentConfig, warmFunction, warmStartCount, coldFunctions, coldStartCount, yamlPath),
})
Expand Down
1 change: 1 addition & 0 deletions pkg/common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const (
PlatformDirigent string = "dirigent"
PlatformOpenWhisk string = "openwhisk"
PlatformAWSLambda string = "awslambda"
PlatformGCR string = "gcr"
)

// dirigent backend
Expand Down
1 change: 1 addition & 0 deletions pkg/config/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type Configuration struct {
LoaderConfiguration *LoaderConfiguration
FailureConfiguration *FailureConfiguration
DirigentConfiguration *DirigentConfig
GCRConfiguration *GCRConfig

IATDistribution common.IatDistribution
ShiftIAT bool // shift the invocations inside minute
Expand Down
29 changes: 28 additions & 1 deletion pkg/config/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ type DirigentConfig struct {
WorkflowConfigPath string `json:"WorkflowConfigPath"`
}

type GCRConfig struct {
Region string `json:"Region"`
Project string `json:"Project"`
ServiceAccount string `json:"ServiceAccount"`

AllowUnauthenticated bool `json:"AllowUnauthenticated"`
EndpointSuffix string `json:"EndpointSuffix"`
}

func ReadConfigurationFile(path string) LoaderConfiguration {
byteValue, err := os.ReadFile(path)
if err != nil {
Expand Down Expand Up @@ -153,6 +162,24 @@ func ReadFailureConfiguration(path string) *FailureConfiguration {
return &config
}

func ReadGCRConfiguration(path string) *GCRConfig {
byteValue, err := os.ReadFile(path)
if err != nil {
log.Warnf("Google Cloud Run configuration not found at '%s'...", path)
return &GCRConfig{}
}

log.Infof("Google Cloud Run configuration found.")

var config GCRConfig
err = json.Unmarshal(byteValue, &config)
if err != nil {
log.Fatal(err)
}

return &config
}

func ReadWorkflowConfig(path string) WorkflowConfig {
byteValue, err := os.ReadFile(path)
if err != nil {
Expand All @@ -169,7 +196,7 @@ func ReadWorkflowConfig(path string) WorkflowConfig {
}

func ReadDirigentConfig(cfg *LoaderConfiguration) *DirigentConfig {
if cfg.Platform != common.PlatformDirigent {
if cfg.Platform != common.PlatformDirigent && cfg.Platform != common.PlatformGCR {
return nil
}

Expand Down
35 changes: 35 additions & 0 deletions pkg/driver/clients/gcr_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package clients

import (
"github.com/vhive-serverless/loader/pkg/common"
"github.com/vhive-serverless/loader/pkg/config"
"testing"
)

func TestGCRInvoke(t *testing.T) {
t.Skip()

function := &common.Function{
Name: "warm-function-4318010827780319511",
Endpoint: "warm-function-4318010827780319511-328799819690.us-central1.run.app",
DirigentMetadata: &common.DirigentMetadata{},
}

inv := newHTTPInvoker(&config.Configuration{
LoaderConfiguration: &config.LoaderConfiguration{
InvokeProtocol: "http1",
Platform: "GCR",
},
FailureConfiguration: nil,
DirigentConfiguration: &config.DirigentConfig{
Backend: "containerd",
},
GCRConfiguration: nil,
TraceDuration: 1,
Functions: []*common.Function{
function,
},
})

inv.Invoke(function, &common.RuntimeSpecification{Runtime: 1, Memory: 1})
}
6 changes: 4 additions & 2 deletions pkg/driver/clients/http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type httpInvoker struct {
dirigentCfg *config.DirigentConfig

isKnative bool
isGCR bool
isDandelion bool
isWorkflow bool
}
Expand All @@ -45,13 +46,14 @@ func newHTTPInvoker(cfg *config.Configuration) *httpInvoker {
dirigentCfg: dcfg,

isKnative: strings.Contains(strings.ToLower(lcfg.Platform), common.PlatformKnative),
isGCR: strings.Contains(strings.ToLower(lcfg.Platform), common.PlatformGCR),
isDandelion: strings.Contains(strings.ToLower(dcfg.Backend), common.BackendDandelion),
isWorkflow: dcfg.Workflow,
}
}

var payload []byte = nil
var contentType string = "application/octet-stream"
var contentType = "application/octet-stream"

func CreateRandomPayload(sizeInMB float64) *bytes.Buffer {
if payload == nil {
Expand Down Expand Up @@ -121,7 +123,7 @@ func (i *httpInvoker) functionInvocationRequest(function *common.Function, runti
}

// add system specific stuff
if !i.isKnative {
if !i.isKnative && !i.isGCR {
req.Host = function.Name
}

Expand Down
6 changes: 6 additions & 0 deletions pkg/driver/clients/invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ func CreateInvoker(cfg *config.Configuration, announceDoneExe *sync.WaitGroup, r
}
case common.PlatformOpenWhisk:
return newOpenWhiskInvoker(announceDoneExe, readOpenWhiskMetadata)
case common.PlatformGCR:
if cfg.LoaderConfiguration.InvokeProtocol == "grpc" {
return newGRPCInvoker(cfg.LoaderConfiguration, ExecutorRPC{})
} else {
return newHTTPInvoker(cfg)
}
default:
logrus.Fatal("Unsupported platform.")
}
Expand Down
5 changes: 4 additions & 1 deletion pkg/driver/deployment/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/sirupsen/logrus"
"github.com/vhive-serverless/loader/pkg/common"
"github.com/vhive-serverless/loader/pkg/config"
"strings"
)

type FunctionDeployer interface {
Expand All @@ -12,7 +13,7 @@ type FunctionDeployer interface {
}

func CreateDeployer(cfg *config.Configuration) FunctionDeployer {
switch cfg.LoaderConfiguration.Platform {
switch strings.ToLower(cfg.LoaderConfiguration.Platform) {
case common.PlatformAWSLambda:
return newAWSLambdaDeployer()
case common.PlatformDirigent:
Expand All @@ -21,6 +22,8 @@ func CreateDeployer(cfg *config.Configuration) FunctionDeployer {
return newKnativeDeployer()
case common.PlatformOpenWhisk:
return newOpenWhiskDeployer()
case common.PlatformGCR:
return newGCRDeployer()
default:
logrus.Fatal("Unsupported platform.")
}
Expand Down
Loading
Loading