fwbrasil / activate

Abandoned: Pluggable persistence in Scala
GNU Lesser General Public License v2.1
299 stars 46 forks source link

first access is very slow #149

Closed kanekv closed 10 years ago

kanekv commented 10 years ago

When i try to access database for the first time it takes a lot of time to initialize: Reflections took 1945 ms to scan 2 urls, producing 43 keys and 805 values Reflections took 1103 ms to scan 4 urls, producing 158 keys and 3581 values Initializing live cache for context Connection Initializing context Connection

Is there a way to improve it or at least make it non-lazy, so it initializes right after start? What's the best approach to make development cycle faster, it's pretty frustrating to wait several seconds every time after reload

fwbrasil commented 10 years ago

Could you send the full startup log and your computer specs? It normally doesn't take so long to boot for my projects.

kanekv commented 10 years ago

I'm running it in the vagrant VM (virtualbox) host machine is Macbook Air I7 2Hz. How can I get full startup log, enable debug mode?

kanekv commented 10 years ago

Also, is it possible to force activate to do initialization on startup (non-lazy)?

fwbrasil commented 10 years ago

@Kane-Sendgrid I think you don't need to activate the debug mode to obtain the full log. Among the lines you sent should be others with more details.

You can force the persistence context load during the application startup using an empty transactional block "transactional{}". For example, we normally use the Global.start method on Play to do this.

kanekv commented 10 years ago

@fwbrasil I don't see any other log lines related to the activate, can you give a hint what lines you expect to see?

Thanks for the info about transactional!

kanekv commented 10 years ago

@fwbrasil Also, what is difference between asyncTransactional and asyncTransactionalChain?

fwbrasil commented 10 years ago

@Kane-Sendgrid Could you try to configure the log level to DEBUG and post the logs here?

You can find more info about the async transactions in this doc:

https://github.com/fwbrasil/activate/blob/master/activate-docs/transaction.md#async-transactions

Please use the mailing list if you need more info about it.

kanekv commented 10 years ago

@fwbrasil, thanks, where is mailing list btw?

fwbrasil commented 10 years ago

@Kane-Sendgrid here it goes: https://groups.google.com/forum/#!forum/activate-persistence

frossi85 commented 9 years ago

@fwbrasil

I have been experimenting the same problem, because I am a little new in scala world I thought that the problem was a scala compiler performance issue. But then I detect that the source is the issue described here. My project is a Play application with around 25 entities and a lot of play html templates. Perhaps this issue is not a problem in a microservice arquitecture.

You have a way to measure the source of it. It could be the scanning/searching of classes that are Entity or is more the use of reflection in each of those entities??

Could you gave me a pointer to the class that makes the inicialization??