[ 
https://issues.apache.org/jira/browse/KNOX-989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16119612#comment-16119612
 ] 

Mohammad Kamrul Islam commented on KNOX-989:
--------------------------------------------

I find the code in *InstrumentedGatewayFilter.java* where the timer keys are 
built. The related function is pasted below. I believe removing the line #7 
could reduce the unnecessary timer keys. 

However, I would like to run this idea for  comments before I send any patch.
   
{code:java}
1. private Timer timer(ServletRequest request) {
2.    StringBuilder builder = new StringBuilder();
3.    builder.append("client.");
4.    builder.append(request.getServletContext().getContextPath());
5.    if (request instanceof HttpServletRequest) {
6.         HttpServletRequest httpServletRequest = (HttpServletRequest) request;
7.        builder.append(httpServletRequest.getPathInfo());
8.        builder.append(".");
9.        builder.append(httpServletRequest.getMethod());
10.      builder.append("-requests");
11    }
12    return metricRegistry.timer(builder.toString());
13  }
{code}

> Revisit JMX Metrics to fix the Out of Memory issue
> --------------------------------------------------
>
>                 Key: KNOX-989
>                 URL: https://issues.apache.org/jira/browse/KNOX-989
>             Project: Apache Knox
>          Issue Type: Bug
>          Components: Server
>            Reporter: Sandeep More
>            Assignee: Mohammad Kamrul Islam
>             Fix For: 0.14.0
>
>
> Bug  [KNOX-986|https://issues.apache.org/jira/browse/KNOX-986] uncovers 
> problem with Metrics when large number of unique URLs are accessed via Knox. 
> The problem here is that Knox creates metrics objects per unique URL, the 
> metrics objects are not flushed out (for obvious reason - to maintain the 
> metric state). 
> We need to come up with a proper fix to mitigate this while being able to use 
> the JMX Metrics. 
> One way of doing this would be to have Metrics objects at service level ( 
> e.g. /gateway/sandbox/webhdfs/* ) the other way would be to have a reaper 
> process that clears out the unused objects. Other suggestions are welcomed !



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to