[Resin-interest] Memory and slowdown...

2008-04-03 Thread Andrew Fritz
Our production servers have their maximum memory set to 2048m. 
Everything is fine for a while. Eventually the java process ends up with 
all 2048m allocated. At this point server load starts going up and 
response time gets bad. Eventually request start timing out.

Restarting the server fixes the problem instantly and everything is good 
again. Occasionally one of the servers will do this on its own, 
presumably because it reaches the 1m free threshold. That appears to be 
to small a margin and a restart is needed well before there is only 1m 
left so I adjusted the minimum free memory from 1m to 24m.

That seems like a bandage though. The heap dump returned a blank page so 
I'm not sure what was going on there. I'm just curious if anyone has any 
theories about what might be eating up memory over time.

We are using Hibernate and PHP and of course java.

Andrew



___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] Memory and slowdown...

2008-04-03 Thread Scott Ferguson

On Apr 2, 2008, at 8:21 AM, Andrew Fritz wrote:

> Our production servers have their maximum memory set to 2048m.
> Everything is fine for a while. Eventually the java process ends up  
> with
> all 2048m allocated. At this point server load starts going up and
> response time gets bad. Eventually request start timing out.
>
> Restarting the server fixes the problem instantly and everything is  
> good
> again. Occasionally one of the servers will do this on its own,
> presumably because it reaches the 1m free threshold. That appears to  
> be
> to small a margin and a restart is needed well before there is only 1m
> left so I adjusted the minimum free memory from 1m to 24m.
>
> That seems like a bandage though. The heap dump returned a blank  
> page so
> I'm not sure what was going on there. I'm just curious if anyone has  
> any
> theories about what might be eating up memory over time.
>
> We are using Hibernate and PHP and of course java.

Does the heap dump page work for you in a normal situation, i.e.  
before you start running out of memory?

That's really the first place to start looking.  The leaking memory  
might be obvious from Resin's heap dump page.  If it's not enough  
information, the next step would be to use a more sophisticated memory  
profiler.

-- Scott

>
>
> Andrew
>
>
>
> ___
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest



___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] @Remote EJB3

2008-04-03 Thread Scott Ferguson

On Apr 2, 2008, at 6:22 PM, Matt Johnston wrote:

> Does the current version of resin support the @Remote functionality of
> EJB3? I looked at the documentation, but it was very sparse.
>
> I basically have an EJB3 that I want to share among all my web-apps
> within the same resin server. Each web-app is independent (each is  
> on a
> separate domain name). How I can share my beans between each of  
> these apps?

Those are actually different questions.  In your case, you don't  
really need to use @Remote, since it's all in the same server.

Resin's EJB support works in all of the Resin contexts: web-app, host,  
cluster.  So, if you configure your bean at the  level, it  
will be available for all of your virtual hosts.  If you configure it  
at the  level, it will be available for all the web-apps in your  
host.

So, you might have something like:


 

 

 

(Or use  instead of .)

-- Scott
>
>
> -- 
>
> Matt Johnston
> http://www.lattaoutdoors.com
> http://www.gearapalooza.com
>
>
> ___
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest



___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] Locking the EnvironmentClassLoader

2008-04-03 Thread Scott Ferguson

On Apr 2, 2008, at 2:25 PM, Knut Forkalsrud wrote:

> This was with version 3.1.4, I haven't tried 3.1.5 yet.

3.1.5 is interesting, since it should handle the null classes faster  
(basically, 3.1.5 pre-analyzes all the jars). The locking in 3.1.5 is  
the same as 3.1.4.

I've updated the locking for the next snapshot, since it was a little  
too broad.  It would be interesting to see if there's a performance  
difference for your app.

-- Scott

>
>
> -Knut
>
>
>
> Knut Forkalsrud wrote:
>>
>> Just a comment on this, we found similar problems not too long ago.
>> Performance under load turned out to be limited by the synchronized
>> lock in EnvironmentClassloader.  So our fancy new 8 core systems
>> suddenly were reduced to single thread performance.  Some profiling
>> highlighted two major offenders.
>>
>>  - Hibernate's "classic" HQL query parser (which is a legacy thing,  
>> the
>>default Hibernate configuration no longer uses it).
>>  - Beanshell.  We had a lot of beanshell interpreters running in  
>> the system.
>>
>> The common denominator for these two was that they do a lot of  
>> lookups
>> (Class.forName()) on names that are not actual class names.  We ended
>> up (among other counter measures) writing our own class loader to  
>> cache
>> all sorts of class lookups, blatantly violating all sorts of class  
>> loading rules.
>> We will probably never be able to reload our app cleanly, but  
>> performance
>> improved at least 10x.
>>
>> -Knut
>
> ___
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest



___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] cascade persist with Amber

2008-04-03 Thread Scott Ferguson

On Mar 31, 2008, at 2:58 AM, Torkil Svensgaard wrote:

> Hi list
>
> I'm playing around a bit with Amber and can't seem to get cascading  
> persist to work. The attached code runs fine but doesn't persist the  
> competences, only the search.
>
> Have I misunderstood something?

Based on the bug report, this looks like a problem with class-change  
detection and reloading.  The next snapshot will include that fix.  I  
added a few extra tests for cascaded persistence, and the persistence  
itself seems to be working fine.

-- Scott

>
>
> Thanks in advance,
>
> Torkil
> package com.scr.data.search.entity;
>
> import java.util.Set;
>
> import javax.persistence.CascadeType;
> import javax.persistence.Entity;
> import javax.persistence.GeneratedValue;
> import javax.persistence.Id;
> import javax.persistence.OneToMany;
>
> @Entity
> public class Search {
>   
>   @Id
>   @GeneratedValue
>   private int _id;
>   @OneToMany(mappedBy="search", cascade={CascadeType.ALL})
>   private Set competences;
>   public int get_id() {
>   return _id;
>   }
>   public void set_id(int _id) {
>   this._id = _id;
>   }
>   public Set getCompetences() {
>   return competences;
>   }
>   public void setCompetences(Set competences) {
>   this.competences = competences;
>   }
> }
> package com.scr.data.search.entity;
>
> import javax.persistence.Entity;
> import javax.persistence.GeneratedValue;
> import javax.persistence.Id;
> import javax.persistence.JoinColumn;
> import javax.persistence.ManyToOne;
>
> @Entity
> public class Competence {
>   
>   @Id
>   @GeneratedValue
>   private int _id;
>   private String _name;
>   private int _level;
>   private int _experience;
>   private int _last;
>   @ManyToOne
>   @JoinColumn(name="search")
>   private Search search;
>   
>   public int get_id() {
>   return _id;
>   }
>   public void set_id(int _id) {
>   this._id = _id;
>   }
>   public String get_name() {
>   return _name;
>   }
>   public void set_name(String _name) {
>   this._name = _name;
>   }
>   public int get_level() {
>   return _level;
>   }
>   public void set_level(int _level) {
>   this._level = _level;
>   }
>   public int get_experience() {
>   return _experience;
>   }
>   public void set_experience(int _experience) {
>   this._experience = _experience;
>   }
>   public int get_last() {
>   return _last;
>   }
>   public void set_last(int _last) {
>   this._last = _last;
>   }
>
>   public Search getSearch() {
>   return search;
>   }
>   public void setSearch(Search search) {
>   this.search = search;
>   }
>
> }
> package com.scr.inhouse.test;
>
> import java.io.IOException;
> import java.io.PrintWriter;
> import java.util.HashSet;
>
> import javax.ejb.TransactionAttribute;
> import javax.persistence.EntityManager;
> import javax.persistence.PersistenceContext;
> import javax.servlet.http.HttpServlet;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
>
> import com.scr.data.search.entity.Competence;
> import com.scr.data.search.entity.Search;
>
> public class TestServlet extends HttpServlet {
>
>   private static final long serialVersionUID = -6604204182506392192L;
>   @PersistenceContext(name="search")
>   private EntityManager _manager;
>   
>   @Override
>   protected void doGet(HttpServletRequest request,  
> HttpServletResponse response) throws IOException {
>   
>   PrintWriter out = response.getWriter();
>   response.setContentType("text/html");
>   
>   insert(out);
>   }
>   
>   @TransactionAttribute
>   protected void insert(PrintWriter out) {
>   Search search = new Search();
>   
>   HashSet competences = new HashSet();
>   
>   Competence competence1 = new Competence();
>   competence1.set_level(5);
>   competence1.set_name("Java");
>   
>   competences.add(competence1);
>   
>   Competence competence2 = new Competence();
>   competence2.set_level(5);
>   competence2.set_name("PHP");
>   
>   competences.add(competence2);
>   
>   System.out.println(competences);
>   
>   search.setCompetences(competences);
>   
>   _manager.persist(search);
>   
>   }
> }
> ___
> resin-interest mailing list
> resin-interest@caucho.com
> h