You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by puneetjain <pu...@wipro.com> on 2008/03/28 16:06:39 UTC

Query Regarding Stateless Session Bean Instance Pool Configuration

Hi,

I have written a Stateless Session Bean and trying to deploy on Geronimo
Server, which interns uses OpenEJB. I am trying to configure the the
Stateless Session Bean Instance Pool. Regarding This I have following
issues:

Question1:
=======

How to configure the Stateless Session Bean Instance Pool size with "x" no
of bean to at the startup of the server?

Question2:
========
I have tried below configuration:

 <module name="org.apache.geronimo.configs/openejb/2.0.2/car">
        <gbean name="EJBNetworkService">
            <attribute name="port">${OpenEJBPort + PortOffset}</attribute>
            <attribute name="host">${ServerHostname}</attribute>
        </gbean>
        <gbean name="DefaultStatelessContainer">
            <attribute name="properties">TimeOut 120000
				PoolSize 100
				StrictPooling true</attribute>
        </gbean>
    </module>

I want to restrict the pool size to 100 i.e. if there are more than 100
requests come, only 100 requests will be served. Rest of the requests would
be waiting until a bean gets free. No more than 100 beans should be
instantiated to serve the requests.

With the above configuration the number of instantiate beans is more than
the pool size.

Environment:
=========
OS: Redhat Enterprise Linux 4
Application Server: Geronimo 2.0.2 with tomcat distribution
EJB 3.0
OpenEJB 2.0.2 (As per mention in the configuration
"org.apache.geronimo.configs/openejb/2.0.2/car")

Please help me to resolve the problem. Any reply will be appreciated.

Thanks,
Puneet

-- 
View this message in context: http://www.nabble.com/Query-Regarding-Stateless-Session-Bean-Instance-Pool-Configuration-tp16350835p16350835.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: Query Regarding Stateless Session Bean Instance Pool Configuration

Posted by Manu George <ma...@gmail.com>.
I just commented on the JIRA.
https://issues.apache.org/jira/browse/OPENEJB-786. Would like your
opinion on this David.

Thanks
Manu

On Sat, Mar 29, 2008 at 1:43 PM, puneetjain <pu...@wipro.com> wrote:
>
>  Hi David,
>
>  Thanks for your support. I am sending you the test I have performed to
>  verify the pool size:
>
>  Steps Performed:
>  ============
>  1. I have written a with the session bean given below:
>  2. Pool Size configuration in var/config/config.xml
>
>    <gbean name="DefaultStatelessContainer">
>             <attribute name="properties">TimeOut 120000
>                                 PoolSize 100
>                                 StrictPooling true</attribute>
>         </gbean>
>
>  4. Deployed the application on Geronimo Server.
>  3. I made 300 concurrent request with 2 loops using Jmeter.
>
>  What I observed that around 150 instance of the session bean were created.
>  There were 150 PostConstruct's SOP statements printed on the console, but a
>  single PreDestroy's SOP.
>
>  SOP log is attached below.
>
>  Session Bean:
>  ==========
>  @Stateless
>  public class MySessionBean implements SessionBeanRemote {
>         private static int _instanceCount = 0;
>         private int serialNo;
>         public MySessionBean(){
>                 _instanceCount += 1;
>                 serialNo = _instanceCount;
>                 System.out.println("Instance No: >>> " + _instanceCount);
>         }
>
>     private String doSomething(String reverseWord) {
>         System.out.println("serialNo >> " + serialNo);
>                 .....
>                 .....
>                  Some code which will take some time to be processed.
>                 .....
>                 .....
>     }
>
>   protected void finalize() throws Throwable {
>       System.out.println("Finalize method of Serial No " + serialNo);
>   }
>
>    @PostConstruct
>    public void postConstructCallback()
>    {
>       System.out.println("PostConstruct - Serial No: " + serialNo);
>    }
>
>    @PreDestroy
>    public void preDestroyCallback()
>    {
>       System.out.println("PreDestory - Serial No: " + serialNo);
>    }
>  }
>
>  Console Log:
>  =========
>  I am attaching the console output log file:
>  http://www.nabble.com/file/p16367333/geronimo.out geronimo.out
>
>  As per the log file the number of bean created is 150. But the size of the
>  pool is 100 only and StrictPooling is true. That mean the number of bean
>  created is more than the pool size which should not be done.
>
>  Please help to resolve this problem.
>
>  Thanks,
>  Puneet
>
>
>
>
>
>
>
>  David Blevins wrote:
>  >
>  > Hi Puneet,
>  >
>  > Setting PoolSize to 100 and StrictPooling to true should do exactly
>  > what you want (i.e. block requests in a wait state till one of the 100
>  > instances are returned to the pool).  If this isn't working it's
>  > definitely a bug.
>  >
>  > What technique are you using to determine more than 100 instances are
>  > created?  If you can attach a test that reproduces the issue it will
>  > help us verify and fix the problem.  I've opened Jira issue at:
>  >
>  >   http://issues.apache.org/jira/browse/OPENEJB-786
>  >
>  >
>  > -David
>  >
>  >
>  > On Mar 28, 2008, at 8:06 AM, puneetjain wrote:
>  >>
>  >> Hi,
>  >>
>  >> I have written a Stateless Session Bean and trying to deploy on
>  >> Geronimo
>  >> Server, which interns uses OpenEJB. I am trying to configure the the
>  >> Stateless Session Bean Instance Pool. Regarding This I have following
>  >> issues:
>  >>
>  >> Question1:
>  >> =======
>  >>
>  >> How to configure the Stateless Session Bean Instance Pool size with
>  >> "x" no
>  >> of bean to at the startup of the server?
>  >>
>  >> Question2:
>  >> ========
>  >> I have tried below configuration:
>  >>
>  >> <module name="org.apache.geronimo.configs/openejb/2.0.2/car">
>  >>        <gbean name="EJBNetworkService">
>  >>            <attribute name="port">${OpenEJBPort + PortOffset}</
>  >> attribute>
>  >>            <attribute name="host">${ServerHostname}</attribute>
>  >>        </gbean>
>  >>        <gbean name="DefaultStatelessContainer">
>  >>            <attribute name="properties">TimeOut 120000
>  >>                              PoolSize 100
>  >>                              StrictPooling true</attribute>
>  >>        </gbean>
>  >>    </module>
>  >>
>  >> I want to restrict the pool size to 100 i.e. if there are more than
>  >> 100
>  >> requests come, only 100 requests will be served. Rest of the
>  >> requests would
>  >> be waiting until a bean gets free. No more than 100 beans should be
>  >> instantiated to serve the requests.
>  >>
>  >> With the above configuration the number of instantiate beans is more
>  >> than
>  >> the pool size.
>  >>
>  >> Environment:
>  >> =========
>  >> OS: Redhat Enterprise Linux 4
>  >> Application Server: Geronimo 2.0.2 with tomcat distribution
>  >> EJB 3.0
>  >> OpenEJB 2.0.2 (As per mention in the configuration
>  >> "org.apache.geronimo.configs/openejb/2.0.2/car")
>  >>
>  >> Please help me to resolve the problem. Any reply will be appreciated.
>  >>
>  >> Thanks,
>  >> Puneet
>  >>
>  >> --
>  >> View this message in context:
>  >> http://www.nabble.com/Query-Regarding-Stateless-Session-Bean-Instance-Pool-Configuration-tp16350835p16350835.html
>  >> Sent from the OpenEJB User mailing list archive at Nabble.com.
>  >>
>  >>
>  >
>  >
>  >
>
>  --
>  View this message in context: http://www.nabble.com/Query-Regarding-Stateless-Session-Bean-Instance-Pool-Configuration-tp16350835p16367333.html
>
>
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
>

Re: Query Regarding Stateless Session Bean Instance Pool Configuration

Posted by puneetjain <pu...@wipro.com>.
Hi David,

Thanks for your support. I am sending you the test I have performed to
verify the pool size:

Steps Performed:
============
1. I have written a with the session bean given below:
2. Pool Size configuration in var/config/config.xml
   <gbean name="DefaultStatelessContainer">
            <attribute name="properties">TimeOut 120000
 				PoolSize 100
 				StrictPooling true</attribute>
        </gbean>

4. Deployed the application on Geronimo Server.
3. I made 300 concurrent request with 2 loops using Jmeter.

What I observed that around 150 instance of the session bean were created.
There were 150 PostConstruct’s SOP statements printed on the console, but a
single PreDestroy's SOP.

SOP log is attached below.

Session Bean:
==========
@Stateless
public class MySessionBean implements SessionBeanRemote {
	private static int _instanceCount = 0;
	private int serialNo;
	public MySessionBean(){
		_instanceCount += 1;
		serialNo = _instanceCount;
		System.out.println("Instance No: >>> " + _instanceCount);
	}	
	
    private String doSomething(String reverseWord) {
	System.out.println("serialNo >> " + serialNo);
   		.....
		.....
		 Some code which will take some time to be processed.
		.....
		.....
    }

  protected void finalize() throws Throwable {
      System.out.println("Finalize method of Serial No " + serialNo);
  }

   @PostConstruct
   public void postConstructCallback()
   {
      System.out.println("PostConstruct - Serial No: " + serialNo);
   }

   @PreDestroy
   public void preDestroyCallback()
   {
      System.out.println("PreDestory - Serial No: " + serialNo);
   }
}

Console Log:
=========
I am attaching the console output log file: 
http://www.nabble.com/file/p16367333/geronimo.out geronimo.out 

As per the log file the number of bean created is 150. But the size of the
pool is 100 only and StrictPooling is true. That mean the number of bean
created is more than the pool size which should not be done.

Please help to resolve this problem.

Thanks,
Puneet





David Blevins wrote:
> 
> Hi Puneet,
> 
> Setting PoolSize to 100 and StrictPooling to true should do exactly  
> what you want (i.e. block requests in a wait state till one of the 100  
> instances are returned to the pool).  If this isn't working it's  
> definitely a bug.
> 
> What technique are you using to determine more than 100 instances are  
> created?  If you can attach a test that reproduces the issue it will  
> help us verify and fix the problem.  I've opened Jira issue at:
> 
>   http://issues.apache.org/jira/browse/OPENEJB-786
> 
> 
> -David
> 
> 
> On Mar 28, 2008, at 8:06 AM, puneetjain wrote:
>>
>> Hi,
>>
>> I have written a Stateless Session Bean and trying to deploy on  
>> Geronimo
>> Server, which interns uses OpenEJB. I am trying to configure the the
>> Stateless Session Bean Instance Pool. Regarding This I have following
>> issues:
>>
>> Question1:
>> =======
>>
>> How to configure the Stateless Session Bean Instance Pool size with  
>> "x" no
>> of bean to at the startup of the server?
>>
>> Question2:
>> ========
>> I have tried below configuration:
>>
>> <module name="org.apache.geronimo.configs/openejb/2.0.2/car">
>>        <gbean name="EJBNetworkService">
>>            <attribute name="port">${OpenEJBPort + PortOffset}</ 
>> attribute>
>>            <attribute name="host">${ServerHostname}</attribute>
>>        </gbean>
>>        <gbean name="DefaultStatelessContainer">
>>            <attribute name="properties">TimeOut 120000
>> 				PoolSize 100
>> 				StrictPooling true</attribute>
>>        </gbean>
>>    </module>
>>
>> I want to restrict the pool size to 100 i.e. if there are more than  
>> 100
>> requests come, only 100 requests will be served. Rest of the  
>> requests would
>> be waiting until a bean gets free. No more than 100 beans should be
>> instantiated to serve the requests.
>>
>> With the above configuration the number of instantiate beans is more  
>> than
>> the pool size.
>>
>> Environment:
>> =========
>> OS: Redhat Enterprise Linux 4
>> Application Server: Geronimo 2.0.2 with tomcat distribution
>> EJB 3.0
>> OpenEJB 2.0.2 (As per mention in the configuration
>> "org.apache.geronimo.configs/openejb/2.0.2/car")
>>
>> Please help me to resolve the problem. Any reply will be appreciated.
>>
>> Thanks,
>> Puneet
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/Query-Regarding-Stateless-Session-Bean-Instance-Pool-Configuration-tp16350835p16350835.html
>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Query-Regarding-Stateless-Session-Bean-Instance-Pool-Configuration-tp16350835p16367333.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: Query Regarding Stateless Session Bean Instance Pool Configuration

Posted by David Blevins <da...@visi.com>.
Hi Puneet,

Setting PoolSize to 100 and StrictPooling to true should do exactly  
what you want (i.e. block requests in a wait state till one of the 100  
instances are returned to the pool).  If this isn't working it's  
definitely a bug.

What technique are you using to determine more than 100 instances are  
created?  If you can attach a test that reproduces the issue it will  
help us verify and fix the problem.  I've opened Jira issue at:

  http://issues.apache.org/jira/browse/OPENEJB-786


-David


On Mar 28, 2008, at 8:06 AM, puneetjain wrote:
>
> Hi,
>
> I have written a Stateless Session Bean and trying to deploy on  
> Geronimo
> Server, which interns uses OpenEJB. I am trying to configure the the
> Stateless Session Bean Instance Pool. Regarding This I have following
> issues:
>
> Question1:
> =======
>
> How to configure the Stateless Session Bean Instance Pool size with  
> "x" no
> of bean to at the startup of the server?
>
> Question2:
> ========
> I have tried below configuration:
>
> <module name="org.apache.geronimo.configs/openejb/2.0.2/car">
>        <gbean name="EJBNetworkService">
>            <attribute name="port">${OpenEJBPort + PortOffset}</ 
> attribute>
>            <attribute name="host">${ServerHostname}</attribute>
>        </gbean>
>        <gbean name="DefaultStatelessContainer">
>            <attribute name="properties">TimeOut 120000
> 				PoolSize 100
> 				StrictPooling true</attribute>
>        </gbean>
>    </module>
>
> I want to restrict the pool size to 100 i.e. if there are more than  
> 100
> requests come, only 100 requests will be served. Rest of the  
> requests would
> be waiting until a bean gets free. No more than 100 beans should be
> instantiated to serve the requests.
>
> With the above configuration the number of instantiate beans is more  
> than
> the pool size.
>
> Environment:
> =========
> OS: Redhat Enterprise Linux 4
> Application Server: Geronimo 2.0.2 with tomcat distribution
> EJB 3.0
> OpenEJB 2.0.2 (As per mention in the configuration
> "org.apache.geronimo.configs/openejb/2.0.2/car")
>
> Please help me to resolve the problem. Any reply will be appreciated.
>
> Thanks,
> Puneet
>
> -- 
> View this message in context: http://www.nabble.com/Query-Regarding-Stateless-Session-Bean-Instance-Pool-Configuration-tp16350835p16350835.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
>