Hi subbis, 
        If I let the iteration loop over 5000, I get that exception, It
seems (I am not sure) openjpa is creating a new connection and after a
while mysql runs out of connection. I tried the same code and iteration
loop with a connection pool and it works fine. That should get you
moving as of now, till someone from Open JPA team looks into the issue.

Thanks and Regards,
Nitish Kumar

-----Original Message-----
From: Shubbis [mailto:marius.jo...@broadpark.no] 
Sent: Thursday, March 19, 2009 1:50 PM
To: users@openjpa.apache.org
Subject: Re: Slow performance with OpenJPA when selecting from a
ManyToMany relation.


Hi, thanks for the suggestion, but we are aware of that, and we have
turned
it off on EclipseLink to even the playingfield.

Today we found a new problem with OpenJPA. When running the following
method
we get a similar type of performance hit and an Exception after the
first
run. Note: This exception is the same one we get when running the
ManyToMany
test in a loop.

The method:

        public void insertDeliveryCompany(int iterations) throws
Exception{
                log.setMethod(iterations);

                for (int i = 0; i < 10; i++) {
                        
                        // DeliveryCompany med contactinfo, adress,
areacode og country
                        IDeliveryCompanyDAO dcDao =
daoFactory.getDeliveryCompanyDAO();
                        DeliveryCompany deliveryCompany;
                        ArrayList<DeliveryCompany> deliveryCompanies =
new
ArrayList<DeliveryCompany>();

                        // Fyller DeliveryCompany listen
                        for(int interval = 0; interval < iterations;
interval++){
                                // Region
                                Region region = new Region();
        
region.setRegion("insertDeliveryCompanyRegion");
                                
                                // Country
                                Country country = new Country();
        
country.setCountry("insertDeliveryCompanyCountry");
                                country.setRegion(region);

                                // AreaCode
                                AreaCode areaCode = new AreaCode();
        
areaCode.setArea("insertDeliveryCompanyAreaCode");
                                areaCode.setCountry(country);

                                // Address
                                Address address = new Address();
        
address.setAddress("insertDeliveryCompanyAddress");
                                address.setAreaCode(areaCode);

                                // ContactInfo
                                ContactInfo contactInfo = new
ContactInfo();
                                contactInfo.setAddress(address);
        
contactInfo.setEmail("insertDeliveryCompanyEmail");
        
contactInfo.setPhoneNr("insertDeliveryCompanyPhoneNr");

                                // Fyller DeliveryCompany listen
                                deliveryCompany = new DeliveryCompany();
        
deliveryCompany.setCompanyName("insertDeliveryCompany");
        
deliveryCompany.setContactInfo(contactInfo);
                                deliveryCompanies.add(deliveryCompany);
                        }
                        log.registerStart();
                        daoFactory.beginTransaction();

                        for (int j = 1; j <= iterations; j++) {
                                dcDao.save(deliveryCompanies.get(j-1));
                                log.registerIteration(j + 1);
                        }
                        daoFactory.commitTransaction();
//                      daoFactory.resetEntityManager();
                        log.registerEnd();
                }
                log.endMethod();
        }


And the console dump:

94  OpenJPAPU  INFO   [main] openjpa.Runtime - Starting OpenJPA 1.2.0
172  OpenJPAPU  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class
"org.apache.openjpa.jdbc.sql.MySQLDictionary".
OPENJPA (insertDeliveryCompany): 43500
0  OpenJPAPU  INFO   [main] openjpa.Runtime - Starting OpenJPA 1.2.0
0  OpenJPAPU  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class
"org.apache.openjpa.jdbc.sql.MySQLDictionary".
<openjpa-1.2.0-r422266:683325 nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: Communications link
failure

Last packet sent to the server was 0 ms ago.
        at
org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4238)
        at
org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.
java:4203)
        at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:10
2)
        at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:88
)
        at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:64
)
        at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.connect(JDBCStoreManager
.java:868)
        at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.getConnection(JDBCStoreM
anager.java:229)
        at
org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:371)
        at
org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:325)
        at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.getInitializeStateResult
(JDBCStoreManager.java:441)
        at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStor
eManager.java:321)
        at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreMana
ger.java:277)
        at
org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingSt
oreManager.java:111)
        at
org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.jav
a:57)
        at
org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:894)
        at
org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:852)
        at
org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:774)
        at
org.apache.openjpa.kernel.BrokerImpl.isDetached(BrokerImpl.java:4286)
        at
org.apache.openjpa.kernel.SingleFieldManager.persist(SingleFieldManager.
java:257)
        at
org.apache.openjpa.kernel.StateManagerImpl.cascadePersist(StateManagerIm
pl.java:2893)
        at
org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2457)
        at
org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2280)
        at
org.apache.openjpa.kernel.DelegatingBroker.persist(DelegatingBroker.java
:1021)
        at
org.apache.openjpa.persistence.EntityManagerImpl.persist(EntityManagerIm
pl.java:645)
        at
project.ojpa.dao.DeliveryCompanyDAO.save(DeliveryCompanyDAO.java:55)
        at
project.tests.InsertManager.insertDeliveryCompany(InsertManager.java:233
)
        at project.client.AnalyticsClient.main(AnalyticsClient.java:67)
Caused by: com.mysql.jdbc.CommunicationsException: Communications link
failure

Last packet sent to the server was 0 ms ago.
        at
com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1070
)
        at
com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2120)
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:723)
        at
com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:298)
        at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:28
2)
        at
org.apache.openjpa.jdbc.schema.SimpleDriverDataSource.getConnection(Simp
leDriverDataSource.java:81)
        at
org.apache.openjpa.jdbc.schema.SimpleDriverDataSource.getConnection(Simp
leDriverDataSource.java:76)
        at
org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(Delegatin
gDataSource.java:113)
        at
org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(Decoratin
gDataSource.java:93)
        at
org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(Delegatin
gDataSource.java:113)
        at
org.apache.openjpa.jdbc.schema.DataSourceFactory$DefaultsDataSource.getC
onnection(DataSourceFactory.java:305)
        at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.connectInternal(JDBCStor
eManager.java:879)
        at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.connect(JDBCStoreManager
.java:864)
        ... 21 more
Caused by: com.mysql.jdbc.CommunicationsException: The driver was unable
to
create a connection due to an inability to establish the client portion
of a
socket.

This is usually caused by a limit on the number of sockets imposed by
the
operating system. This limit is usually configurable. 

For Unix-based platforms, see the manual page for the 'ulimit' command.
Kernel or system reconfiguration may also be required.

For Windows-based platforms, see Microsoft Knowledge Base Article 196271
(Q196271).
        at
com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1070
)
        at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:335)
        at
com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2043)
        ... 32 more
Caused by: java.net.BindException: Address already in use: connect
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(Unknown Source)
        at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at
com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:
253)
        at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)
        ... 33 more



Kevin Sutter wrote:
> 
> One other interesting bit of information...  I just heard that
EclipseLink
> runs with a data cache enabled by default, while OpenJPA and Hibernate
do
> not.  Although this setting may not get us completely out of this
> ManyToMany
> performance hole, it is something to be aware of as these performance
> benchmarks are done...
> 

-- 
View this message in context:
http://n2.nabble.com/Slow-performance-with-OpenJPA-when-selecting-from-a
-ManyToMany-relation.-tp2466994p2501684.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


-------------------------------------------------------------------------------------------------------------------------
"The information contained in this e-mail transmission is confidential and may 
be privileged. It is intended only for the 
addressee(s) stated above. If you are not an addressee, any use, dissemination, 
distribution, publication, or copying of 
the information contained in this e-mail is strictly prohibited. If you have 
received this e-mail in error, please 
immediately notify us by telephone (+91 80 6618 6555), or e-mail the sender and 
delete the e-mail from your system. 
If you do not want to receive our emails please let us know so that we may 
delete you from our email list. Proteans 
Software Solutions and its parent group ("CAMO Group") do not accept liability 
for damage caused by this email, and may 
monitor email traffic." 
-------------------------------------------------------------------------------------------------------------------------

Reply via email to