-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RequestLog: Reduce Chance of Memory Leak #53
Comments
If using the default RequestContext it will correctly not use RequestLog if not initialized: If someone implements their own ConcurrencyStrategy then it will automatically use the RequestLog. |
Instead of changing default behavior a max limit of 1000 has been set for the HystrixRequestLog. If 1000 commands get added to a log any further will be ignored and warnings output (they will flood logs) to make someone fix the configuration. logger.warn("RequestLog ignoring command after reaching limit of " + MAX_STORAGE + ". See https://github.com/Netflix/Hystrix/issues/53 for more information."); Right now it is hardcoded to 1000. If there are actually legit reasons to go higher than that (I and the people sitting near me can't think of a reason as it's generally single-digits or dozens at the high end) we can make it configurable.
This will limit impact of memory leaks and draw attention to what needs to happen. The options are:
https://github.com/Netflix/Hystrix/wiki/How-To-Use#wiki-RequestContextSetup
https://github.com/Netflix/Hystrix/wiki/Configuration#wiki-CommandExecution hystrix.command.default.requestLog.enabled = false |
@benjchristensen Any problems if i disabled request log? |
If you don't need it, then feel free to disable it. We use it fairly heavily for debugging/understanding our system, but YMMV |
@mattrjacobs Thanks for your so quick response. |
In one of our applications we run user provided code querying an eventually consistent database. We use a request context for the request cache (we do not guarantee "read your own writes") so we can end up with a few thousands of commands by batch. We can fairly easily estimate the amount of requests, is there a way to configure your limit or is it still hardcoded? |
This is still a hardcoded value. Also note that it solely refers to the |
I'd like to have this warning be made configurable please, while we work over time to analyze what we can change in our code to reduce the number of commands per request. Until then we're having to turn off the request logs which otherwise has valuable information. Any kind of configuration is fine: the value of MAX_STORAGE, turning it on or off, and/or (if needed) writing the warning out once per request instead of for every command. Thanks! |
The intent of this restriction is to avoid memory leaks when the request context is not set up properly. IMO, disabling this restriction is a bad idea. From your description, it sounds like it's possibly expected to have more than 1000 commands in a request. I'd be interested in what that system looks iike |
Sorry for the late reply. Disabling the restriction was just one option. Any of the other options is also fine (a configurable value of MAX_STORAGE, or an option to write the warning out once per request instead of for every command invocation). Regarding the system, we've used Hystrix to encapsulate things like JMS sends and memcached calls. Combined, these can number in the thousands for certain kinds of heavy requests. |
I'm OK with either of the approaches you mentioned:
I have fairly low bandwidth to work on this presently. How high is the priority on this? If it's high, then submitting a PR would greatly help in getting it into the library. |
Resurrecting this thread to throw my hat in the ring: |
We are in a similar situation where our code depends on user-provided rules configuration and also involves some calls triggered from class proxies. Our approach to keep it performant was simply to rely on Hystrix's We now noticed that we have this warning, and after adding some logging of Moreover it seems we rarely have much more than 1000 calls as we don't see this line repeated a lot. It would thus be nice if we could at least configure the limit, but also if it was logged only once. Ideally cached results should be aggregated to avoid counting towards this limit. I know Hystrix is in maintenance mode but I wanted to post this for future reference. |
Need to evaluate if "hystrix.command.default.requestLog.enabled" should default to false instead of true.
It can potentially cause memory leaks if the request context is not setup right so it may be better for it to be opt-in ... or either:
The text was updated successfully, but these errors were encountered: