NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
Imen Jbebli Posted via mailing list.
|
Posted: Fri May 08, 2009 2:39 pm Post subject: heap space in jpa application |
|
|
Hi,
It’s the first time I work with netbeans.
I used to work with eclipse. I have done with it many web projects (using the frameworks STRUTS, HIBERNATE, SPRING and APACHE as web container).
Now we choose Netbeans, because as shown in this sample, NETBEANS generates all in some clicks and in a short time.
So, I applied the tutorial "http://www.netbeans.org/kb/docs/web/jsf-jpa-crud-wizard.html" with a database containing a lot of data (in some tables 2 millions of registrations), and the response time is too long and in the end a have a message (java heap space).
In fact, I encountered this problem with a project done with eclipse (web application with frameworks STRUTS, HIBERNATE and STRUTS) and I resolved it by adding “lazy="true"” for each tag “set” in the *.hbm.xml files, also I added the DLL “tcnative-1.dll” in order to perform APACHE TOMCAT, and so I no longer have the problems.
So, in this case, I tried to do the same think. So, I have deleted under the package “jpa.entities”, all the annotation “// @OneToMany(mappedBy = "idAbonnement")” and of corse the related attribute and the methods getter and setter, then I generated the JSF Pagesfiles from Entities Classes, but I always have the same problem ???????????????
I focused in your FAQ, I found you speaking about modifying /
*** netbeans_default_options="-J-Xms512m -J-Xmx512m -J-XX:PermSize=32m -J-XX:MaxPermSize=128m -J-Xverify:none
*** <java-config suffix="...">
<jvm-options>-Xmx512m</jvm-options>
<jvm-options>-XX:NewRatio=2</jvm-options>
<jvm-options>-XX:MaxPermSize=128m</jvm-options>
...
</java-config>
But no result.
My database is created under the SGBD PostgreSQL.
RAM: 1G
Procesess: 3.20 GHZ and P IV
Space in disque / 25 GO
I hope that you can help and advise me.
Thanks in advance |
|
| Back to top |
|
 |
Daoud AbdelMonem Faleh Posted via mailing list.
|
Posted: Fri May 08, 2009 5:38 pm Post subject: heap space in jpa application |
|
|
Hi Imen,
I think there is some confusion in this mail.
Please find my comments in-line.
Imen Jbebli a écrit :
| Quote: | Hi,
It’s the first time I work with netbeans.
I used to work with eclipse. I have done with it many web projects (using the frameworks STRUTS, HIBERNATE, SPRING and APACHE as web container).
Now we choose Netbeans, because as shown in this sample, NETBEANS generates all in some clicks and in a short time.
So, I applied the tutorial "http://www.netbeans.org/kb/docs/web/jsf-jpa-crud-wizard.html" with a database containing a lot of data (in some tables 2 millions of registrations), and the response time is too long and in the end a have a message (java heap space).
|
Increasing java Heap space here as stated in the FAQ *may* help.
Although the entities generation has to deal with DDL and has nothing
todo with how much entries are in db tables.
| Quote: |
In fact, I encountered this problem with a project done with eclipse (web application with frameworks STRUTS, HIBERNATE and STRUTS) and I resolved it by adding “lazy="true"” for each tag “set” in the *.hbm.xml files, also I added the DLL “tcnative-1.dll” in order to perform APACHE TOMCAT, and so I no longer have the problems.
|
1- Here you are talking about a runtime error that happen when the
application is deployed to the App server. Netbeans has nothing todo
with runtime errors.
2- Am confused as you mentioned *.hbm.xml files those are a specific
hibernate artefacts with no connection to JPA.
3- lazy Loading *may* help with performance when you have a large object
graph with many interconnected entities. One should be careful here when
the code is run in an unmanaged environment like tomcat.
4- The JPA equivalent to Hibernate Lazy loading "fetch = FetchType.LAZY"
property to @OneToMany or @ManyToMany annotation.
5- In the 4th step of "Entity Classes From DataBase" wizard you can set
"Association Fetch" to "lazy".
6- Tomcat Native libraries have nothing todo with the "java heap space"
thing, it's a wrapper to sendfile(2) kernel system call [1]
7- Hibernate is known to generate alot of dynamic proxies at runtime
that could affect memory allocation. I guess the perm-gen space is the
most solicited part of java memory spaces.
| Quote: |
So, in this case, I tried to do the same think. So, I have deleted under the package “jpa.entities”, all the annotation “// @OneToMany(mappedBy = "idAbonnement")” and of corse the related attribute and the methods getter and setter, then I generated the JSF Pagesfiles from Entities Classes, but I always have the same problem ???????????????
|
JPA is about configuration by annotation and configuration by exception,
deleting those annotations, and the JPA provider will leak the meta-data
it needs to perform his work.
| Quote: | I focused in your FAQ, I found you speaking about modifying /
*** netbeans_default_options="-J-Xms512m -J-Xmx512m -J-XX:PermSize=32m -J-XX:MaxPermSize=128m -J-Xverify:none
|
Setting xmx to 512 is quite low for any serious development.
| Quote: | *** <java-config suffix="...">
<jvm-options>-Xmx512m</jvm-options>
<jvm-options>-XX:NewRatio=2</jvm-options>
<jvm-options>-XX:MaxPermSize=128m</jvm-options>
...
</java-config>
But no result.
|
Where are you putting those configs? tomcat server.xml?
| Quote: | My database is created under the SGBD PostgreSQL.
RAM: 1G
Procesess: 3.20 GHZ and P IV
Space in disque / 25 GO
|
Really this is low for a developer machine. But well am your compatriot
and I know how it work in governmental agencies...
| Quote: | I hope that you can help and advise me.
Thanks in advance
|
You're welcome for any further questions.
[1] http://www.freebsd.org/cgi/man.cgi?query=sendfile&sektion=2
--
http://kissthedots.blogspot.com/
"Le dieu n'est pas a craindre ; la mort ne donne pas de souci ; et
tandis que le bien est facile a obtenir, le mal est facile a supporter." |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|