Where is all the time spent at startup?
Yes, the container startup and initialising the database maping stuffs take a lot of time. Also, If I debug my code, it would be 2-3 times slower. Normally, it takes about 10 - 15 seconds to run my simple test with simple code like em.persist(new MyEntityBean()). If I choose to debug my code, it would take 30 - 40 seconds to run my code.
BTW: my database is mysql
So you mean it is Hibernate startup that is the slowest bit?
This is normal.
There *are* some ways to optimize it, but I'm not sure how easy they are to do in HEM yet.
first thing you should do is to disable the reflection optimizer:
that should give much better startup time
I looked the detail of the timer and I can see that Hibernate takes 70% of startup time. My hibernate.cglib.use_reflection_optimizer is set to false by default. Also I've noticed if I reboot my computer and run the test, it would take about 8 seconds. But if I run it again and again, it will be slower and slower. This is really weired, it can't be a momory leak because the jvm is restarted each time I run the test.
Also, can someone explain why it's 2 - 3 times slower when debug is turned on?
Also I've noticed it hangs in here for quite a while:
WARN 14-02 17:51:40,453 (BeanSchemaBinding.java:init:227) -You should use the 2.0 version of the Microcontainer xml. xmlns='urn:jboss:bean-deployer:2.0'
I've just noticed it's also very slow in booking example when debug is turned on. Here is the result when I run LoginTest:
INFO 15-02 10:31:26,235 (Initialization.java:init:90) -initializing Seam
INFO 15-02 10:31:27,735 (Ejb.java:startup:40) -starting the embedded EJB container
INFO 15-02 10:31:29,564 (LocalTxDataSource.java:bindConnectionFactory:117) -Bound datasource to JNDI name 'java:/DefaultDS'
INFO 15-02 10:31:48,501 (LocalTxDataSource.java:bindConnectionFactory:117) -Bound datasource to JNDI name 'java:/bookingDatasource'
INFO 15-02 10:31:54,157 (Initialization.java:init:95) -done initializing Seam
As you can see, it takes 28 seconds to initialise Seam. 2 datasources take about 20 seconds to bind. I don't understand why this happens.
Here is my PC spec:P4 3GHz, 1G RAM, Windows XP. I've tried another computer with AMD 64 and get about same result.
how many entities do you have ?
debug will slow things down, but 2-3 times as slow sounds high...todays jvm's are pretty good at running at close to full speed for debuggin.
As u can see I am now running booking example which takes 28 seconds to initialise when debug is turned on. I don't understand why this happens.
(repeat) how many entities do you have ?
The booking example has got 3 entities:
hmm so you are saying this is just the plain default setup that takes 28 seconds on your machine ?
that sounds pretty weird...last time i ran this it was much faster.
Can anyone else verify that just starting the booking demo takes that long in their setup ? (and then what that setup is ;)
I've rebooted my computer and had nothing running except eclipse.
Here is result i've got to run LoginTest:
run: 6-8 seconds in average
debug: 28-29 seconds in average
I am using Seam beta 2.
and debug is *just* running the jvm in debug mode (not changing the log level's etc.)
what jdk/jvm is this ? (i'm a bit surprised ;)