db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabio <pruef...@me.com>
Subject Persisting ~10**4 entities takes 100-1200 sec
Date Sun, 22 Feb 2009 08:44:35 GMT
Hello,

I'm using Derby (latest version) in embedded mode in a Swing  
application. As JPA Provider, I'm using TopLink Essentials (2.1 Build  
b60e-fcs).

Basically, the app grabs some data from the web and stores it in the  
embedded database. However, the storing process takes quite a while.  
Here's a code snippet:

//---------------------------------------------
		ArrayList<Load> load_data = grabHourlyLoadForMonthAndYear(month,  
year);
	        if (load_data.size() > 0) {
	            	System.out.println(load_data.size()+" objects");
	            	em.getTransaction().begin();
		        for (Load l : load_data)
		            em.persist(l);
		        long start = System.currentTimeMillis();
		        em.getTransaction().commit();
		        System.out.println("time: "+ ((System.currentTimeMillis()- 
start)/1000) + " sec");
	         }
//---------------------------------------------	
grabHourlyLoadForMonthAndYear() grabs the data from the web. "em" is  
the EntityManager.
The entity "Load" has 5 fields (id, country, year, hourInYear, load)

A typical output looks like this:
	
	17856 objects
	time: 102 sec
	16128 objects
	time: 551 sec
	17856 objects
	time: 1200 sec

As you can see, the time increases drastically while the number of  
objects doesn't. From a usability standpoint, that's way too much time  
spent on waiting.

Has anyone seen similar slow downs while using Derby together with  
TopLink Essentials in a desktop application?

Best Regards
Fabio

Mime
View raw message