dev@grizzly.java.net

About Grizzly's RCM

From: Bongjae Chang <carryel_at_korea.com>
Date: Fri, 17 Jul 2009 20:46:01 +0900

Hi,

Today, I tried to review and test the ResourceAllocationFilter.

But, I have some questions about ResourceAllocationFilter.


1. ResourceAllocationFilter#getContextRoot()'s return value

If a client sends "GET /examples/index.html HTTP/1.1" request to the grizzly server, getContextRoot() returns "examples/index.html".

But, I think that ResourceAllocationFilter#getContextRoot() should return "/examples/index.html" because a user's policyMetric is like "/myApplication|0.9".

Is it right?

If my thoughts are correct, here is the proposed patch.

Index: com/sun/grizzly/rcm/ResourceAllocationFilter.java
===================================================================
--- com/sun/grizzly/rcm/ResourceAllocationFilter.java (revision 3411)
+++ com/sun/grizzly/rcm/ResourceAllocationFilter.java (working copy)
@@ -466,7 +466,7 @@
                                 case 0: // Search for first ' '
                                     if (c == 0x20){
                                         state = 1;
- start = byteBuffer.position() + 1;
+ start = byteBuffer.position();
                                     }
                                     break;
                                 case 1: // Search for next ' '



2. ResourceAllocationFilter#invokeProtocolParser()'s strange code?

Here is ResourceAllocationFilter#invokeProtocolParser()

---
public boolean invokeProtocolParser(...) {
   ...
   try{
      NIOContext copyContext = (NIOContext) Cloner.clone(ctx);
      copyContext.execute(copyContext.getProtocolChainContextTask());
      copyContext.setThreadPool(threadPool);
   } catch(...){
      ...
   }
   ...
}
---

I couldn't understand the above code because the decided thread pool(threadPool) was set after NIOContext.execute().

Then, NIOContext.execute() doesn't use the decided thread pool but original thread pool.

Is it right?


3. Implications of the policyMetric

When I read the JavaDoc and http://weblogs.java.net/blog/jfarcand/archive/2006/04/resource_consum.html, it seems that an user can set the policyMetric like the following.

---
-Dcom.sun.grizzly.rcm.policyMetric="/examples|0.9"
---

Then, does it mean that the policy is applied to all sub requests of "examples" context? Or does it mean that the policy is applied to only "/examples" request?

I think that it is better that the policy should be applied to "/examples", "/examples/index.html", "/examples/something" and etc...

What do you think?


If I am missing some points, please advice me.

Thanks.

--
Bongjae Chang