Max-beans-in-cache, transactions and passivation
WLS 6.1 sp4
database concurrency, oracle
I compute max-beans-in-cache as:
(max # fetched in a transaction) * (number of worker threads)
therefore if I think that a table with have at most 500 rows and the
server is configured with 20 worker threads I have 500 * 20 = 10000 as
my max-beans-in-cache.
In my test the table has 7 rows. In our load test I see the Beans In
Use Count go up to 9999 instances and then start passivation.
I have two questions:
1) What does 'Beans In Use Count' really mean
2) why is weblogic using much more memory than it should to store 7 unique entities?
thanks
See my comments below.
S
Chad Urso McDaniel <[email protected]> wrote:
>
I understand this, but WebLogic should either reuse objects in the
cache/pool or not cache them at all. There are cases where the objects in the cahce are used. For e.g. with entity
beans and Read-Only concurrancy, when cache-between-tx is set. However I noticed
this behavior for other cases too and therefore the caching is not all that intellegent.
Also the beans in the pool are reused.
The current situation results in
objects being allocated, referenced by the cache so they will never be
garbage collected, but the objects are never used again once their
transaction completes. This is very, very wasteful with memory.
In some cases as mentioned above.
S
"Sri" <[email protected]> writes:
Hi,
The reason for having so many entries is due to fact that there isno way WLS
would know there are only 7 rows in the db everytime an entity beanis created/modified/accessed.
For e.g., if you run a test where you do 'findAll' the first run wouldhave 7
beans and the next most likely (There is another parameter that youcould use
to control number of beans in the cache, idle-timeout-seconds. Thoughits not
clear from the doc how the entity beans are handled wrt this parameter,it might
passivate entity beans if this timeout occurs) 14 and so on. If thisis a overhead
for your system then reduce this number.
S
container start removing beans before Chad Urso McDaniel <[email protected]>
wrote:
WLS 6.1 sp4
database concurrency, oracle
I compute max-beans-in-cache as:
(max # fetched in a transaction) * (number of worker threads)
therefore if I think that a table with have at most 500 rows and the
server is configured with 20 worker threads I have 500 * 20 = 10000as
my max-beans-in-cache.
In my test the table has 7 rows. In our load test I see the BeansIn
Use Count go up to 9999 instances and then start passivation.
I have two questions:
1) What does 'Beans In Use Count' really mean
2) why is weblogic using much more memory than it should to store7 unique
entities?
thanks
Similar Messages
-
Max-beans-in-cache ==== Error
Hi all,
I have a entity bean with max-beans-in-cache=5000 and one of the findByXXX fetches
more than that and the application stops with an exception. Is there anyway or
a strategy to follow when cases like this where the records of find exceeds the
max limit. This is a huge data process application and we tried to do maximum
filters to reduce the records to minimal.
Please help me with your thoughts or ideas to .. how to avoid or is there any
deployment time argument .. etc
using WL 7.0
Thanks
-arunIf you just invoke the finder, then the container should not complain
about bringing back > max-beans-in-cache elements. However if you try
to enlist > max-beans-in-cache beans in a transaction, it will throw a
CacheFull.
One way to avoid this is to limit your maxRows returned by the finder.
This can be done in the CMP descriptor.
-- Rob
Arun nair wrote:
Hi all,
I have a entity bean with max-beans-in-cache=5000 and one of the findByXXX fetches
more than that and the application stops with an exception. Is there anyway or
a strategy to follow when cases like this where the records of find exceeds the
max limit. This is a huge data process application and we tried to do maximum
filters to reduce the records to minimal.
Please help me with your thoughts or ideas to .. how to avoid or is there any
deployment time argument .. etc
using WL 7.0
Thanks
-arun -
Max-beans-in-cache and getting mail
Hi,
Here is the situation. I am currently using the
max-beans-in-cache option in the stateful-session-cache . What I want to do is when the max bean amount has been reached and the bean is removed. At this point I would like to have an email or some kind of notification that this happened.
Does anybody have any idea how to do this?
thanks,
MarcHi,
Here is the situation. I am currently using the
max-beans-in-cache option in the stateful-session-cache . What I want to do is when the max bean amount has been reached and the bean is removed. At this point I would like to have an email or some kind of notification that this happened.
Does anybody have any idea how to do this?
thanks,
Marc -
CMP cache limits and passivation
Good day,
We are hitting issues around filling up the EJB cache but we also want
to limit the memory impact of the deployment. What I mean is that if
you have max-beans-in-cache set to 50 and you involve more than 50 EB in
a txn, it throws a cache full exception. We can bump up the cache size,
but for an unbounded collection, this is an artificial fix, another txn
may load more than the new size.
I read in an old posting that the EJB team was looking at passivating EB
involved in a txn to avoid this issue. Was this incorporated into the
engine and if so, how is it controlled?
Thanks,
SeanSean Garagan wrote:
Hi Rob,
Thanks for the response.
The only issue about not using an unbounded collection is that entity
beans and finder methods are defined as unbounded collections. If you
use the WLS example of the bands (or the EJB spec of orders and items)
all of the collections are unbounded. Without using WLS specific tags,
there does not seem to be a way to limit the returned values to allow an
EB to batch operations in smaller chunks to alleviate the problem.Indeed. The max-elements tag is in our descriptors to limit the number
of rows returned from the database. It would be nice to see this
standardized.
-- Rob
>
I guess it comes down to another hole in the spec (hopefully one that
will be patched).
Sean
Rob Woollen wrote:
No, passivation during transactions is on the feature plan for a
future release.
That being said, an unbounded collection is probabbly not a great idea
regardless. you don't want to bring back a huge amount of data from
the database, and you don't want us to have to passivate your working
set out of memory.
-- Rob
Sean Garagan wrote:
Good day,
We are hitting issues around filling up the EJB cache but we also
want to limit the memory impact of the deployment. What I mean is
that if you have max-beans-in-cache set to 50 and you involve more
than 50 EB in a txn, it throws a cache full exception. We can bump
up the cache size, but for an unbounded collection, this is an
artificial fix, another txn may load more than the new size.
I read in an old posting that the EJB team was looking at passivating
EB involved in a txn to avoid this issue. Was this incorporated into
the engine and if so, how is it controlled?
Thanks,
Sean -
Max Beans in Cache causes NULL Pointer Exception
Hi All,
a rather weird event (from our perspective) occurs when we do the
following:
We have an entity bean set to max beans in cache 100 (default value of
our deployment tool ), the database table related to that bean holds
lets say 300 entries.
Doing a find all and in the same session bean instanciated transaction a
processing loop over the enumeration of beans we get an NULL Pointer
exception when accesing the 101 Bean. Neverthless the Weblogic server
increases the cache size automatically but obviously not fast enough and
not on time.
has anyone experienced the same problem and has a fix for it, appart
from increasing the cache size in the deployment descriptor ?
any help welcome
MichaelHi Michael.
Can you post the stack trace of the NullPointerException? Was it in
your code or ours? Also, what version of WebLogic are you using?
-- Rob
Rob Woollen
Software Engineer
BEA WebLogic
[email protected]
Michael Rupprecht wrote:
Hi All,
a rather weird event (from our perspective) occurs when we do the
following:
We have an entity bean set to max beans in cache 100 (default value of
our deployment tool ), the database table related to that bean holds
lets say 300 entries.
Doing a find all and in the same session bean instanciated transaction a
processing loop over the enumeration of beans we get an NULL Pointer
exception when accesing the 101 Bean. Neverthless the Weblogic server
increases the cache size automatically but obviously not fast enough and
not on time.
has anyone experienced the same problem and has a fix for it, appart
from increasing the cache size in the deployment descriptor ?
any help welcome
Michael -
Hi ,
I have the following parameter set in weblogic-ejb-jar.xml for a statefulsession bean.
==================================================
stateful-session-cache>
<max-beans-in-cache>2</max-beans-in-cache>
<idle-timeout-seconds>600</idle-timeout-seconds>
</stateful-session-cache>
==================================================
I then create more than 2 requests(approx 10) to the stateful session bean for which the above parameter is set.
In EJB-MONITORING-Stateful Ejbs I have the following fields set from the customize view:
Activation Count
Passivation Count
Cache Access Count
Cache Miss Count
Cached Beans Current Count
EJB Name
My understanding is that no more than 2 beans should appear in the Cached Beans Current Count.If the request is sent from more than 2 browsers invoking the stateful bean I should get Invocation Target exception.
But upon sending requests from more than 2 browsers invoking the same session bean I see that :
count of Cached Beans Current Count = number of browsers/clients from where the request is coming.
There is no exception.
Kindly clarify my understanding.
ThanksHi,
if you give some number in <max-beans-in-cache>number</max-beans-in-cache>.Then Weblogic Server going to create that many number of objects initially .
In case of statefull SessionBeans, If you give 3 ,Then Server creates 3 objects for that bean to provide service to the 3 clients at a time .
Whenever it receives the 4 requests at a time then three request's will be served at a time and 4th request will wait until the server passivate any object out of 3 in some persistant storage and create the object for 4th client.
it will not throw any exception or error if we sent more than number of requests which we were mention in max-beans-in-cache.
----Anilkumar kari -
Max-beans-in-cache, cachefullException, outOfMemoryError
Hi,
I am trying to find the best way to find the numbers to be set in max-beans-in-cache
for entity beans. I have a stateless session bean through which I access the entity
beans. If I don't set any value for this property, in some query which will return
2500 records, I get a cachefullexception and if I increase it and set this property
to say 5000, I get an outofmemory error. I am not sure how to decide what value
should be used. Any help or suggestion would be greatly appreciated. We are using
WLS 7.0 on NT machines in a cluster.
I have already tried the maxPermSize option in the jvm. The max heap size is
set to 768m.
Thanks,
JaideepPlease reply only to the newsgroup.
If you are doing a find and then invoking on the bean, splitting the transaction into
multiple transactions that return smaller sets of beans is the only thing I can think of to
get around the problem.
If you are simply doing a find, but not invoking the beans, you could set finders-load-bean
to false in the EJB deployment descriptor to avoid loading the bean when the finder is
called. The bean will then be loaded and put into the cache only when it is invoked.
However, this setting affects all finders defined on the bean and if you have transactions
that do a find and invoke, performance could be lower if set to false.
Unless relationship-caching is turned on, related beans are not loaded when a finder is
invoked.
Arunabh
"Chadha, Jaideep" wrote:
Thanks Arunabh. I tried different values and came
up with the ones that suite our needs. Also the
cache size is restricted in a transaction, we can
split the transactions into multiple transactions
especially for read-only data. Do you think that
would be a good idea? I was also thinking if it
was possible to define the attribute for the
entity beans especially in case of relationships that
they get loaded in finders when I need them but for
some methods they don't get loaded in finders. And
when a getXXX is invoked that particular bean gets
loaded at that time.
It will be helpful, if you could let me know.
Thanks,
JaideepArunabh Hazarika wrote:
Increasing the max-beans-in-cache will always mean higher memory requirements. Afraid
there is no way around it except to increase the max heap size. You could try a new
feature in WLS 7.0 - application level caches. This is specified in the application
deployment descriptor rather than at the bean deployment descriptor. With this cache,
the cache size can be specified in terms of memory-size rather than an instance-count.
You can find out how to set this from:
http://e-docs.bea.com/wls/docs70/programming/app_xml.html (search for entity-cache)
This cache would be shared across all EJBs in the application. Also, note that this will
not prevent CacheFullExceptions from occuring, but would be more useful in avoiding
OutOfMemory errors. To avoid CacheFullExceptions without indefinitely increasing the
heap size, try to limit the number of beans loaded in a single transaction.
Hope this helps
Arunabh
Jaideep wrote:
Hi,
I am trying to find the best way to find the numbers to be set in max-beans-in-cache
for entity beans. I have a stateless session bean through which I access the entity
beans. If I don't set any value for this property, in some query which will return
2500 records, I get a cachefullexception and if I increase it and set this property
to say 5000, I get an outofmemory error. I am not sure how to decide what value
should be used. Any help or suggestion would be greatly appreciated. We are using
WLS 7.0 on NT machines in a cluster.
I have already tried the maxPermSize option in the jvm. The max heap size is
set to 768m.
Thanks,
Jaideep -
Hi all
If I change max-beans-in-cache property then do I need to redeploy (run ejbc on)
the stateful session beans or will the server pick it up when I just restart the
app server.
I am using Weblogic 6.1 SP2
Regards
Kamran YousafI believe I was wondering this once myself. An easy way to find out is to change
the value and then restart the server and check the EJB's configuration in your
weblogic console.
You will need to redeploy the beans though which should happen automatically if
the timestamp on your ear file or jar file changes.
"kamran" <[email protected]> wrote:
>
Hi all
If I change max-beans-in-cache property then do I need to redeploy (run
ejbc on)
the stateful session beans or will the server pick it up when I just
restart the
app server.
I am using Weblogic 6.1 SP2
Regards
Kamran Yousaf -
Max-beans-in-cache, cachefullexception, outofmemory error
Hi,
I am trying to find the best way to find the numbers to be set in max-beans-in-cache
for entity beans. I have a stateless session bean through which I access the
entity beans. If I don't set any value for this property, in some query which
will return 2500 records, I get a cachefullexception and if I increase it and
set this property to say 5000, I get an outofmemory error.
I am not sure how to decide what value should be used.
Any help or suggestion would be greatly appreciated.
We are using WLS 7.0 on NT machines in a cluster.
Thanks,
JaideepIf you need to perform some sort of bulk processing then perhaps you
shouldn't be using
entity beans at all.
"Jaideep" <[email protected]> wrote in message
news:[email protected]..
>
unfortunately, for a specific functionality in our application we need toget that
many records. Now I am debating about changing the finder method so thatit returns
only 500 records at one time and then I can call it multiple number oftimes.
This may not be the best thing to do and we may take some kind of aperformance
hit also but it may avoid the cachefull and outofmemory problems.
Any suggestions or comments??
Thanks,
Jaideep
Rob Woollen <[email protected]> wrote:
First off, does what does the session bean or its caller do with the
2500 or 5000 records? i.e. do you really need to select that many.
Unfortunately there is no easy answer on how to set max-beans-in-cache.
It depends a lot on your memory, application, and load.
-- Rob
Jaideep wrote:
Hi,
I am trying to find the best way to find the numbers to be set in
max-beans-in-cache
for entity beans. I have a stateless session bean through which Iaccess the
entity beans. If I don't set any value for this property, in somequery which
will return 2500 records, I get a cachefullexception and if I increaseit and
set this property to say 5000, I get an outofmemory error.
I am not sure how to decide what value should be used.
Any help or suggestion would be greatly appreciated.
We are using WLS 7.0 on NT machines in a cluster.
Thanks,
Jaideep
Dimitri -
How to determine the value of max-beans-in-cache
As we have CacheFullException problem, but I dont know what is the side effect
if I set an extremely large value for this parament. Is there any proper way
to determine the proper value?
"Jenny Wong" <[email protected]> wrote:
>
>As we have CacheFullException problem, but I dont know what is the side
>effect
>if I set an extremely large value for this parament. Is there any proper
>way
>to determine the proper value?
Hi Jenny,
The WebLogic Server allows you to configure the number of active beans (with an
identity) which are present in the EJB cache.
This cache is the in-memory space where beans exist.
When a bean is brought into the cache, ejbActivate() is called, when it is removed,
ejbPassivate() is called. It is basically
equivalent to virtual memory being kept in memory or on disk. Tuning it too high
will use up memory unnecessarily.
Activation and passivation of EJBs is analogous to virtual memory on a computer.
You want to minimize the number of times that
your beans are activated and passivated. The cache size can help minimize this
activity. To set determine if you cache size
should be bigger, take a number of execution snapshots. Look at these snapshots
of your execution and see if there is a lot of
passivation and activation going on. If so, increase the size of your cache and
see if performance improves. Otherwise, leave this
value alone.
regards,
Ashok.
-
Min size for max-beans-in-cache / stateful EJB
Hello,
Weblogic (7 and 8) seems to have a minimum size for this setting.
This minimum seems to be around 8 instances because when we set it to 3 for
instance, the cache size reported by the admin console is 8 (with 8 active
clients) and no ejb has been passivated.
Is there an explanation for this behaviour ?
LaurentI would also like to know the answer to this one.
Can the default be changed via the administration console or config.xml? If so, where? -
I deployed a stateful session EJB on a cluster of WebLogic 6.0 with service pack
1. I noticed that every method call is followed by a call to ejbPassivate and
ejbActivate (even though I set the max-beans-in-cache descriptor to 200 and idle-timeout-seconds
to 100). If I take out the stateful-session-clustering section in the deployment
descriptor, ejbPassivate and ejbActivate is no longer invoked after every method
call.
What is the reason for this behavior? And is there anyway to stop this (the ejbPassivate
and ejbActivate methods contain some complicated logic and invoking those methods
all the time is too intensive)?
Thanks for your help.
Steve
Hi Steve,
We use in-memory replication to cluster stateful session bean. so we need to
serialize the state before we create or update the secondary. We do it in
ejbPassivate(), that is why you are seeing it. when you just deploy it in a
single server, we do not need to do it, that is why you do not see
ejbPassivate() being called.
Thanks
Yu Tian
Steve Lu <[email protected]> wrote in message
news:3b27aa60$[email protected]..
>
> I deployed a stateful session EJB on a cluster of WebLogic 6.0 with
service pack
> 1. I noticed that every method call is followed by a call to ejbPassivate
and
> ejbActivate (even though I set the max-beans-in-cache descriptor to 200
and idle-timeout-seconds
> to 100). If I take out the stateful-session-clustering section in the
deployment
> descriptor, ejbPassivate and ejbActivate is no longer invoked after every
method
> call.
>
> What is the reason for this behavior? And is there anyway to stop this
(the ejbPassivate
> and ejbActivate methods contain some complicated logic and invoking those
methods
> all the time is too intensive)?
>
> Thanks for your help.
>
> Steve
-
Stateful beans in cache doesn't seem to work
I have a stateful bean that I have set max beans in cache to "1". When I deploy it, no errors reported or so, the Weblogic console still states "8" in the column "Cached Beans Current Count" when monitoring the bean.
When I view the descriptor in the console it looks fine. What can be wrong here?
Using Weblogic 8.1 SP4, here's the statueful descriptor:
<weblogic-enterprise-bean>
<ejb-name>MyStatefulBean</ejb-name>
<stateful-session-descriptor>
<stateful-session-cache>
<max-beans-in-cache>1</max-beans-in-cache>
</stateful-session-cache>
<allow-concurrent-calls>True</allow-concurrent-calls>
</stateful-session-descriptor>
<reference-descriptor>
</reference-descriptor>
<enable-call-by-reference>True</enable-call-by-reference>
<jndi-name>test.mystatefulbean/MyStatefulBean/Home</jndi-name>
<local-jndi-name>test.mystatefulbean/MyStatefulBean/LocalHome</local-jndi-name>
</weblogic-enterprise-bean>I agree with you about the host not being able to install (or at least don't want to install/upgrade) their servers to php5.4... Unfortunately, I can't change that... but by shutting them off took care of all the quotes (single & double) and any other characters which would basically function like an addslashes() command. I'll paste the script below... It's still pretty much the same as when you helped me out with the script... Just minor adjustments::: If you can show me (even though I fixed the problem) how I would integrate the stripslashes() function to the comment field it would be helpful to know for future reference.
<?php // Script 1.0 - contactlist.php
if (isset($_POST['submit']) && !empty($_POST['submit'])) // Test if submit button named submit was clicked and not empty
if (!empty($_POST['first']) && !empty($_POST['last']) && !empty($_POST['email']) && !empty($_POST['phone']) && !empty($_POST['comment'])) {
$comment=stripslashes($_POST[comment]);
$body = "First Name: {$_POST['first']}\nLast Name: {$_POST['last']}\nEmail Address: {$_POST['email']}\nContact Phone Number: {$_POST['phone']}\nContact Preference: {$_POST['contactvia']}\n\nBest Time To Contact: {$_POST['timepref']}\n\nComments:\n {$_POST['comment']}";
$body = wordwrap($body, 70);
mail([email protected]', 'NEW Customer Inquiry Submission',$body, "From: {$_POST['email']}");
header('Location: index.html'); //Redirect to new url if form submitted
?> -
Reporting on Max beans ever in cache
In the Weblogic 5.1 console, for Distributed Objects/EJB/Deployed Beans, on
the properties tab there are values for max beans ever in cache and max
cache size. Is there some way to access these values through a java class
(or some other way) so that I can do a report to see what EJBs have come
close to reaching their max cache size. We have over 500 beans deployed and
need some way to pro-actively check these values. I did not see any API doc
for the console on the website.
ThanksYou can start by looking at this example:
http://dima.dhs.org/misc/WLStats.jsp
and serverinfo utility at
http://developer.bea.com/code/alpha.jsp
Chip Whiteside <[email protected]> wrote:
In the Weblogic 5.1 console, for Distributed Objects/EJB/Deployed Beans, on
the properties tab there are values for max beans ever in cache and max
cache size. Is there some way to access these values through a java class
(or some other way) so that I can do a report to see what EJBs have come
close to reaching their max cache size. We have over 500 beans deployed and
need some way to pro-actively check these values. I did not see any API doc
for the console on the website.
Thanks--
Dimitri -
About Container-managed Transactions and Bean-managed Transactions
as the document of weblogic7.0 describe the differents of Container-managed
Transactions and Bean-managed Transactions,and in the document,It tell us
details of using Bean-managed Transactions,such as \:
import javax.naming.*;import javax.transaction.UserTransaction;.....
import java.sql.*;import java.util.*;
UserTransaction tx = (UserTransaction)
ctx.lookup("javax.transaction.UserTransaction");tx.begin();
tx.commit() //or tx.rollback
but how to use Container-managed Transactions?
what is EJB's deployment descriptor? can someone tell me?
i wonder someone will show me an example of how to use Container-managed
Transactions.
thanks
fish
Many if not all of the WLS EJB examples use container-managed
transactions. That's a good place to start.
I'd also recommend that you pick up a decent EJB book. There's several
on the market right now.
-- Rob
fish wrote:
> <ejb-jar>
> <enterprise-beans>
> <session>
> <ejb-name>testbean</ejb-name>
> <home>test.test.TestHome</home>
> <remote>test.test.Test</remote>
> <ejb-class>test.test.TestBean</ejb-class>
> <session-type>Stateful</session-type>
> <transaction-type>Container</transaction-type>
> </session>
> </enterprise-beans>
>
> <assembly-descriptor>
> <container-transaction>
> <method>
> <ejb-name>EmployeeRecord</ejb-name>
> <method-name>*</method-name>
> </method>
> <trans-attribute>Required</trans-attribute>
> </container-transaction>
> </assembly-descriptor>
> </ejb-jar>
> ----------------------------------------------
> seems i have to write ejb-jar.xml like this,am i right?
> what about <ejb-client-jar>? is it needed in this xml file?
>
> thanks
>
> fish
>
>
Maybe you are looking for
-
Not rally a question, just wanted to share my absolute frustration with the update of iTunes...this is, without a shadow of a doubt THE WORST application i have EVER used, Mac or PC! And that's saying something with the amount of PC dross that's out
-
How to Read Idoc - Segment fields values and status messages
Hi, I am having one requirement as i want to read the segments along with the field values and also i want to read all the status messages. first i read the idoc data from EDIDS and segments data from EDID4 and the staus messges from T100. but stil
-
Clearing g/l account with upload template and ZFG1
Hi there I wonder if someone can help me please. I need to manually clear some line items from 2 g/l accounts that cannot be cleared using the clearing program (they are duplicate documents created in error and since reversed therefore account balanc
-
I have had people ask me to make a short 30 clip for the web say of some of there sporting shots, what is the best way to go about knowing what kind of compression you use and what type of file is best.
-
How do i get iPhoto library upgraded to run
I installed iphoto library upgrader to my computer but iphoto still won't work. How do I run it?