Skip to content

Commit

Permalink
Issue 77 - 504 Gateway timeout when updating model used by 1,000's of…
Browse files Browse the repository at this point in the history
… agents

Signed-off-by: zhangl <zhangl@us.ibm.com>
  • Loading branch information
LiilyZhang committed Sep 2, 2021
1 parent ca1fc8a commit 4b16160
Show file tree
Hide file tree
Showing 19 changed files with 1,520 additions and 434 deletions.
26 changes: 26 additions & 0 deletions common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,20 @@ type NotificationInfo struct {
MetaData *MetaData
}

type ObjectInQueue struct {
NotificationAction string // Notification status and type
NotificationType string
Object MetaData
Destinations []StoreDestinationStatus //use this list if NotificationType is common.TypeDestination
}

type DestinationRequestInQueue struct {
Action string
Status string
Object MetaData
Destination Destination
}

// ACLentry contains ACL information about each user
type ACLentry struct {
Username string
Expand Down Expand Up @@ -611,6 +625,7 @@ const (
Feedback = "feedback"
Error = "error"
Ping = "ping"
ReceiverError = "receiverError"
)

// Indication whether the object has been delivered to the destination
Expand Down Expand Up @@ -686,6 +701,17 @@ const (
DeleteAction = "delete"
)

// DestinationUpdateRequestInQueue Action
const (
// Update = "update"
)

// NotificationType of object sent to objectWorkQueue
const (
TypeDestination = "destination"
TypeObject = "object"
)

// Resend flag options
const (
ResendAll = iota
Expand Down
31 changes: 29 additions & 2 deletions common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ type Config struct {
// dummy - for the dummyAuthenticate Authentication handler
AuthenticationHandler string `env:"AUTHENTICATION_HANDLER"`

// Buffer size of Object Queue to send objects for notification handling
// For the CSS, default value is 1000
// For the ESS, default value is 2
ObjectQueueBufferSize uint64 `env:"OBJECT_QUEUE_BUFFER_SIZE"`

// CommunicationProtocol is a comma separated list of protocols to be used for communication between CSS and ESS
// The elements of the list can be 'http', 'mqtt', and 'wiotp'
// wiotp indicates MQTT communication via the Watson IoT Platform and mqtt indicates direct MQTT communication to a broker
Expand Down Expand Up @@ -195,6 +200,10 @@ type Config struct {
// Default value: none
HTTPCSSCACertificate string `env:"HTTP_CSS_CA_CERTIFICATE"`

// HTTPESSClientTimeout is to specify the http client timeout in seconds for ESS
// default is 120s
HTTPESSClientTimeout int `env:"HTTPESSClientTimeout"`

// LogLevel specifies the logging level in string format
LogLevel string `env:"LOG_LEVEL"`

Expand Down Expand Up @@ -232,6 +241,13 @@ type Config struct {
// Other notifications are resent with frequency equal to ResendInterval*6
ResendInterval int16 `env:"RESEND_INTERVAL"`

// ESSCallSPIRetryInterval specifies the frequence in seconds of resend failed updated notifications.
// Default is 2s
ESSCallSPIRetryInterval int32 `env:"ESS_CALL_SPI_RETRY_INTERVAL"`

// ESSSPIMaxRetry specifies the number of retry if ESS receives notification transparent error
ESSSPIMaxRetry int `env:"ESSSPIMaxRetry"`

// ESSPingInterval specifies the frequency in hours of ping messages that ESS sends to CSS
ESSPingInterval int16 `env:"ESS_PING_INTERVAL"`

Expand Down Expand Up @@ -651,6 +667,14 @@ func ValidateConfig() error {
}
}

if Configuration.ObjectQueueBufferSize == 0 {
if Configuration.NodeType == CSS {
Configuration.ObjectQueueBufferSize = 1000
} else {
Configuration.ObjectQueueBufferSize = 2
}
}

return nil
}

Expand Down Expand Up @@ -684,7 +708,9 @@ func SetDefaultConfig(config *Config) {
config.MaxCompressedlLogTraceFilesNumber = 50
config.LogTraceDestination = "file"
config.LogTraceMaintenanceInterval = 60
config.ResendInterval = 5
config.ResendInterval = 10
config.ESSSPIMaxRetry = 1000
config.ESSCallSPIRetryInterval = 2
config.ESSPingInterval = 1
config.RemoveESSRegistrationTime = 30
config.MaxDataChunkSize = 120 * 1024
Expand All @@ -698,14 +724,15 @@ func SetDefaultConfig(config *Config) {
config.MongoCACertificate = ""
config.MongoAllowInvalidCertificates = false
config.MongoSessionCacheSize = 1
config.MongoSleepTimeBetweenRetry = 2000
config.MongoSleepTimeBetweenRetry = 4000
config.DatabaseConnectTimeout = 300
config.StorageMaintenanceInterval = 30
config.ObjectActivationInterval = 30
config.CommunicationProtocol = MQTTProtocol
config.HTTPPollingInterval = 10
config.HTTPCSSUseSSL = false
config.HTTPCSSCACertificate = ""
config.HTTPESSClientTimeout = 120
config.MessagingGroupCacheExpiration = 60
config.ShutdownQuiesceTime = 60
config.ESSConsumedObjectsKept = 1000
Expand Down
Loading

0 comments on commit 4b16160

Please sign in to comment.