Speed โ€‹โ€‹up application launch on Jetty

I have a small web application configured with Guice , Jersey and EclipseLink , and run this application on the pier (8.0.0.M1) during development. There are about 10 (small) JPA managed classes (entities and embedded) and about 20 classes.

The initial launch takes 15 seconds + 5 seconds for the first requests. It seems that the JPA is working on the first query, since I have a strategy to create the โ€œcreateโ€ table and see some Maven JPA results on the first query.

Rebooting takes about 10 seconds, and the first request after rebooting takes 3 to 4 seconds.

You might think that the launch time is not so bad, but I wonder if I can speed up the launch to work more smoothly, as with Django. Any idea for tweaking at startup?

+6
java performance jpa jetty guice
source share
2 answers

I am afraid that if you are not ready to delete the table creation strategy, you will have to endure such load times. Essentially, every time you run your application, it will drop / create / check tables and issue the correct DDL statements to match the objects in your package.

Assuming you have finished defining your objects, and you are working on some business logic code, you can create the database once and just reuse your initial setup.

+2
source share

I assume that you are using Jetty for rapid application development (RAD), and you want to review and test any changes as quickly as possible. If your RAD environment database does not have a real โ€œpersistentโ€ requirement, you can try switching to the im-memory database engine. A DB engine, such as HSQL, allows you to quickly deploy new tables (and other structures) compared to existing DBMSs. This will require the use of ORM because HSQL SQL is very different from most other databases, but it looks like you are already using JPA, so it should not be difficult.

The only alternative that I see is to use a database that already has an appropriate schema and does not drop it every time.

0
source share

All Articles