-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Mulitple object persist too slow
PostPosted: Sun Mar 08, 2009 4:52 am 
Newbie

Joined: Wed May 14, 2008 6:17 am
Posts: 2
Hi, I have a simple class and about 12 which extends from it. An example is here.

Code:
@Entity
@Table(name="HwAtCommand")
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class Command extends DomainObject implements Comparable<Command>{

    private String targetAcuIp;

    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;

    @Enumerated
    private CommandType type;

    private int priority=0;

    private boolean send = false;

    @Temporal(TemporalType.TIMESTAMP)
    private Date lastAttempt;

    private int attemptCount;

    public abstract PreparedStatement generateSQLStatement(Connection conn)
            throws SQLException;

    ....getters and setter for properties
}

@Entity
@Table(name = "hwIdentifierCommand")
@PrimaryKeyJoinColumn(name = "parentId")
public class IdentifierCommand extends Command {

    public static final String CREATE_COMMAND = "insert into sqminikey(x'09') values (sqminikey(?), ?, 'no');";
    public static final String REPLACE_COMMAND = "replace into sqminikey(x'09') values (sqminikey(?), ?, 'no');";
    public static final String REMOVE_COMMAND = "delete from sqminikey(x'09') where sqminikey==?;";

    private byte[] identifierSerialNumber;

    private Long subjectId;
   

    .... methods
}


My problem is, that in a system with about 1000 people put in database, many operation may need to persist about tousands of new instances of some commands. This seems to be a very thin bottleneck for my application, cause as i tried to simply persist 2000 instances to MS SQL Server, it took over 3 minutes. 3 minutes for 2000 instances persist is in my opinion too much. I know it's not only 2000 inserts, it is probably double that much, but still database on the device, which is simple implementation of SQLite handles 2000 inserts in about 5 min, a there's bottle neck of small ram, arm processor and writing to MMC card. The worst is that there may occure companies with 10 000 people and more, a in the worst case, about 100000 instances of Command may be need to persist.
Is the time for persisting 2000 instances normal? Is there any way to speed this "bulk insert" up besides using JDBC(I know this should speed things up but I would loose independence on SQL provider and maybe have some problem with generating primary keys )? I am not using any second level caching, but i think this shouldn't have influence on the persist operation, only on get operation.

Does somebody have any ideas?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


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

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.