jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hoying, Ken" <KHoy...@tiaa-cref.org>
Subject RE: JCSAdmin Servlet.
Date Fri, 30 Sep 2005 14:20:43 GMT
Thank you for your response.  After reading your comments and looking at the source code, my
suspicion is that you are correct in that not all objects being placed in the cache are serializable.
 I am going to verify that next.  However, I did have one suggestion after reviewing the code.
 I believe the reason that I am seeing the byte count bounce is that the order is probably
not guaranteed and the count value is dependent upon when the first non-serializable item
is returned in the iteration.  I would like to suggest that the try catch block be placed
inside the while loop so that the byte size at least encompasses all serializable objects.
 I am assuming that the non-serializable objects throw and exception here.

public int getByteCount( CompositeCache cache )
        throws Exception
    {
        MemoryCache memCache = cache.getMemoryCache();

        Iterator iter = memCache.getIterator();

        CountingOnlyOutputStream counter = new CountingOnlyOutputStream();
        ObjectOutputStream out = new ObjectOutputStream( counter );

        // non serializable objects will cause problems here
        try
        {
            while ( iter.hasNext() )
            {
                ICacheElement ce = (ICacheElement) ( (Map.Entry) iter.next() ).getValue();

                out.writeObject( ce.getVal() );
            }
        }
        catch ( Exception e )
        {
            //log later
        }

        // 4 bytes lost for the serialization header

        return counter.getCount() - 4;
    }

-----Original Message-----
From: Smuts, Aaron [mailto:Aaron.Smuts@travelocity.com]
Sent: Friday, September 30, 2005 9:29 AM
To: JCS Users List
Subject: RE: JCSAdmin Servlet.


I haven't seen the byte count bounce around.  ... ?

The objects must be serializable for that byte count to be nearly
accurate.  

Again, you can't do what you are trying to do very easily.  If you want.
Put a wrapper in front of your calls to JCS.  Do what the counting byte
stream does.   Implement expired and spooled envent handlers so you can
decrement when items are spooled and removed.  Your wrapper could then
have a decent estimate.  This is too inefficient to build into the
cache, but if you really need it, then you should be able to make a
wrapper for your self.

Personally, I wouldn't try.  Just experiment with putting elements and
seeing how much memory the vm is using or check the admin jsp and then
adjust the max size.  You should be able to come up with a decent
estimate through experimentation, an estimate that will be almost as
good as any wrapper could give, but without the performance costs.

Cheers,

Aaron


> -----Original Message-----
> From: Hoying, Ken [mailto:KHoying@tiaa-cref.org]
> Sent: Friday, September 30, 2005 9:22 AM
> To: JCS Users List
> Subject: RE: JCSAdmin Servlet.
> 
> The JCSAdmin.jsp page is simple and nice to use.
> 
> I have noticed that the sizes reported seem to yo-yo up and down.  How
> reliable is this value and has anyone else noticed this behavior?  I
need
> to determine how large our cache is growing to so that I can limit the
> number of items in the cache to an appropriate size.
> 
> Thanks,
> Ken
> 
> -----Original Message-----
> From: Smuts, Aaron [mailto:Aaron.Smuts@travelocity.com]
> Sent: Thursday, September 29, 2005 11:32 AM
> To: JCS Users List
> Subject: RE: JCSAdmin Servlet.
> 
> 
> Yes.  Just use the JCSAdmin.jsp.  You can find it here:
> 
>
http://svn.apache.org/viewcvs.cgi/jakarta/jcs/trunk/src/java/org/apache/
> jcs/admin/JCSAdmin.jsp?rev=224094&view=log
> 
> 
> Minor builds can be found here:
> 
> http://svn.apache.org/viewcvs.cgi/jakarta/jcs/trunk/tempbuild/
> 
> 
> > -----Original Message-----
> > From: Niclas Rothman [mailto:niro@lechill.com]
> > Sent: Thursday, September 29, 2005 10:35 AM
> > To: JCS Users List
> > Subject: RE: JCSAdmin Servlet.
> >
> > Thanks Ken!!! It helped a lot!!!
> > As the article says, much easier to just use the JCSAdmin.jsp file
> > instead!
> >
> > Niclas
> >
> > -----Original Message-----
> > From: Hoying, Ken [mailto:KHoying@tiaa-cref.org]
> > Sent: Thursday, September 29, 2005 4:17 PM
> > To: JCS Users List
> > Subject: RE: JCSAdmin Servlet.
> >
> > Take a look at the following article.  It appears that these needed
> > files are not distributed with JCS.
> >
> > http://www.jroller.com/page/aspinei/?anchor=jcs_the_good_the_bad
> >
> > -----Original Message-----
> > From: Niclas Rothman [mailto:niro@lechill.com]
> > Sent: Thursday, September 29, 2005 10:15 AM
> > To: JCS Users List
> > Subject: JCSAdmin Servlet.
> >
> >
> > Hi there, I try to get the JCSAdmin servlet to work.
> >
> > Have mapped the servlet in my web.xml.
> >
> >
> >
> > Now the Servlet complains about not finding a .vm resource.
> >
> >
> >
> > Unable to find resource
> > '/org/apache/jcs/admin/servlet/JCSAdminServletRegionDetail.vm'
> >
> > org.apache.velocity.exception.ResourceNotFoundException: Unable to
> find
> > resource
> '/org/apache/jcs/admin/servlet/JCSAdminServletRegionDetail.vm'
> >         at
> >
>
org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(Re
> > sourceManagerImpl.java:458)
> >         at
> >
>
org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(Res
> > ourceManagerImpl.java:341)
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > When I looke in the jcs.jar file I can see that there are two .vm
> files.
> >
> >
> > However, where should I put these files and do I need to configure
the
> > JCSAdmin servlet with some init parameters?
> >
> >
> >
> > Niclas
> >
> >
> >
> > **************************************************************
> > This message, including any attachments, contains confidential
> > information intended for a specific individual and purpose, and is
> > protected by law.  If you are not the intended recipient, please
> contact
> > sender immediately by reply e-mail and destroy all copies.  You are
> > hereby notified that any disclosure, copying, or distribution of
this
> > message, or the taking of any action based on it, is strictly
> > prohibited.
> > TIAA-CREF
> > **************************************************************
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jcs-users-help@jakarta.apache.org
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jcs-users-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jcs-users-help@jakarta.apache.org
> 
> 
> 
> **************************************************************
> This message, including any attachments, contains confidential
information
> intended for a specific individual and purpose, and is protected by
law.
> If you are not the intended recipient, please contact sender
immediately
> by reply e-mail and destroy all copies.  You are hereby notified that
any
> disclosure, copying, or distribution of this message, or the taking of
any
> action based on it, is strictly prohibited.
> TIAA-CREF
> **************************************************************
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jcs-users-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org



**************************************************************
This message, including any attachments, contains confidential information intended for a
specific individual and purpose, and is protected by law.  If you are not the intended recipient,
please contact sender immediately by reply e-mail and destroy all copies.  You are hereby
notified that any disclosure, copying, or distribution of this message, or the taking of any
action based on it, is strictly prohibited.
TIAA-CREF
**************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Mime
View raw message