Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Make message cache size configurable per CG #39

Merged
merged 8 commits into from
Jan 27, 2017
Merged

Conversation

aravindvs
Copy link
Contributor

This patch makes sure we can configure the message cache size per
CG and has the following pieces:
(1) Move the cassandra based config manager behind the interface so that we can easily write tests
(2) Update existing code which got the hard type to get the interface
(3) Modify outputhost to get the new message cache size value from configMgr. Update tests to use this value.

Aravind Srinivasan added 4 commits January 24, 2017 15:48
This patch makes sure we can configure the message cache size per
CG. Also modifies the integration test to use the new config
rather than overwriting the default value.
We should move the cassandra based cfg manager behind the
config manager interface rather than using the hard type.
Modify message cache test to use the config manager mock interface
and update the args passed to the newMessageDeliveryCache.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 54.748% when pulling fe9cf38 on output_msg_cache_cfg into f21e38f on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 54.857% when pulling fe9cf38 on output_msg_cache_cfg into f21e38f on master.

// get the initial credits based on the message cache size
cfg, err := cgCache.getDynamicCgConfig()
if err == nil {
extCache.initialCredits = cgCache.getMessageCacheSize(cfg, defaultNumOutstandingMsgs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to set extCache.initialCredits to a default value if the err != nil, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GuillaumeBailey it is set already above in line 312 (already existing code).

// OutputCgConfig is the per cg config used by the
// cassandra config manager
OutputCgConfig struct {
MessageCacheSize []string `name:"messagecachesize" default:"/=10000"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a comment stating that each entry in the slice is a tuple or change the name of the member to reflect that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forgot to add this.. will add it now!

@@ -781,6 +786,8 @@ func (msgCache *cgMsgCache) manageMessageDeliveryCache() {
msgCache.numAcks = 0
}
}
case <-msgCache.cfgRefreshTicker.C:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need another ticker ? Can you do this refresh whenever redeliveryTicker fires ? Since the configMgr already caches the object, calling Get() should be light-weight.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was mainly worried about the calls to cassandra every 500ms (which is the redeliveryTicker) but since it is caching it, i will update to use the same ticker..

@@ -781,6 +786,8 @@ func (msgCache *cgMsgCache) manageMessageDeliveryCache() {
msgCache.numAcks = 0
}
}
case <-msgCache.cfgRefreshTicker.C:
msgCache.refreshCgConfig(msgCache.maxOutstandingMsgs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The creditBatchSize (declared above) is derived out of this maxOutstandingMsgs, so when this gets refreshed, you likely also want to adjust the credit batch size to the store.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! will fix it.

Aravind Srinivasan added 2 commits January 25, 2017 07:23
(1) Use the already existing redleivery ticker for refreshing the config
as well since configMgr already caches the object.
(2) Make sure creditBatchSize is updated.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 54.861% when pulling c8b2387 on output_msg_cache_cfg into f21e38f on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.07%) to 54.798% when pulling 4e4a165 on output_msg_cache_cfg into 49808c2 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 54.687% when pulling 5d0a9c5 on output_msg_cache_cfg into c60d970 on master.

@aravindvs aravindvs merged commit 9034aaf into master Jan 27, 2017
@aravindvs aravindvs deleted the output_msg_cache_cfg branch January 27, 2017 18:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants