See service/endpoint/config.go.
The server accepts configuration with the following options:
-
Models: list of models - seeservice/config/model.gofor all options.ID:string- required - model ID, used to generate the URLs.Debug:bool- optional - enables further output and debugging.URL:string- required - model location source.- to use S3, set environment variable
AWS_SDK_LOAD_CONFIG=true - to use GCS, set environment variable
GOOGLE_APPLICATION_CREDENTIALS=true
- to use S3, set environment variable
DataStore:string- optional - name of Datastore to cache, should matchDatastores[].ID.Transformer:string- optional - name of model output transformer. See #Transformer.Batch: optional - enables or overrides server-side batching configuration. Seeservice/tfmodel/batcher/config/config.go.Test: optional - enables a client request to send to self on start up.Test:bool- iftrue, a client will generate a non-batch request with random values based on the model input signature.Single:map[string]interface{}- if present, will use the provided values for certain input keys, otherwise randomly generated based on model input signature.SingleBatch:bool- iftrue, a client will generate a batch request with random values based on the model input signature; ifSingleis set, values will be used for provided keys.Batch:map[string][]interface{}- if present, will be used to generate a batch of requests for the self-test.
Inputs: optional - used to further provide or define inputs, a list ofshared.Field.Name:string- required - input name, only required if an entry is provided.Index:int- optional - used to maintain cache key ordering.Auxiliary:bool- optional - the input is permitted to be provided in an evaluation request.Wildcard:bool- conditionally required - if enabled this input will not have a vocabulary for lookup; ifUseDictis true, the service will refuse to start if it cannot guess the vocabulary extraction Operation.Precision:int- conditionally required - if the input is a float type and dictionary is enabled, this can be used to round the value to a lower precision which can improve cache hit rates; ifUseDictis true, the service will refuse to start if it encounters a float input without aPrecision.
KeyFields:[]string- optional - list of fields used to generate caching key (by default, all model inputs, sorted alphabetically). Can be used to order and add valid inputs that can be used as a cache key but not used as prediction input.Auxiliary:[]string- deprecated, optional - list of additional fields that are acceptable for eval server call. Deprecated, useField.Auxiliary.Outputs:[]shared.Field- deprecated, optional - model outputs are automatically pulled from the model.
-
Connection: optional - list of external Aerospike connections.ID:string- required - connection IDHostnames:string- required - Aerospike hostnames
-
Datastores: list of datastore cachesID:string- required - datastore ID (to be matched withModels[].DataStores[].ID)Connection:string- optional - connection IDNamespace:string- optional - Aerospike namespaceDataset:string- optional - Aerospike datasetStorable:string- optional - name of registeredstorableproviderCache: optional - in-memory cache settingSizeMB:int- optional - cache size in MB
-
Endpoint: some special administrative optionsPort:int- optional - used inaddrforhttp.Server, default8080.ReadTimeoutMs,WriteTimeoutMs:int- optional - additional settings forhttp.Server, default5000for both.MaxHeaderBytes:int- optional - additional settings forhttp.Server, default8192(8 * 1024).WriteTimeout:int- optional - maximum request timeout.PoolMaxSize,BufferSize:int- optional - controls implementation ofnet/http/httputil, default512and131072(128 * 1024), respectively.MaxEvaluatorConcurrency:int- optional - controls semaphore that prevents too many CGo goroutines from spawning, default5000.
-
EnableMemProf:bool- optional - enables endpoint for memory profiling. -
EnableCPUProf:bool- optional - enables endpoint for cpu profiling. -
AllowedSubnet:bool- optional - restricts administrative endpoints to IP string prefixes.- Restricts the system configuration, memory profile, CPU profile, and health endpoints.
-
ContinueOnRecover:bool- optional - panics will not bubble up.
mly client does not come with an external config file.
To create a client, use the following snippet:
mly := client.New("$modelID", []*client.Host{client.NewHost("mlServiceHost", mlServicePort)}, options ...)Where optional options can be of, but not limited to, the following:
NewCacheSize(sizeOption)NewCacheScope(CacheScopeLocal|CacheScopeL1|CacheScopeL2)NewGmetric()- custom instance ofgmetricservice
See shared/client/option.go for more options.
Since v0.16.0, there have been added options for Aerospike behavior.
Since each shared/client.Service instance operates on 1 model, there was an added option to share Aerospike connections via WithConnectionSharing().
Additionally, Aerospike client Policy override options were provided.
Use WithClientOptions() to provide shared/datastore/client.Option options.
See shared/datastore/client/option.go.
Note that even if a ClientPolicy or BasePolicy is set via shared/datastore/client.Option, the timeout values will be applied from the server configuration unless using WithBypassConfiguredTimeout().