openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shubbis <marius.jo...@broadpark.no>
Subject Re: Slow performance with OpenJPA when selecting from a ManyToMany relation.
Date Thu, 19 Mar 2009 08:19:42 GMT

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:102)
	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(JDBCStoreManager.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(JDBCStoreManager.java:321)
	at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:277)
	at
org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:111)
	at
org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java: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(StateManagerImpl.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(EntityManagerImpl.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:282)
	at
org.apache.openjpa.jdbc.schema.SimpleDriverDataSource.getConnection(SimpleDriverDataSource.java:81)
	at
org.apache.openjpa.jdbc.schema.SimpleDriverDataSource.getConnection(SimpleDriverDataSource.java:76)
	at
org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:113)
	at
org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:93)
	at
org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:113)
	at
org.apache.openjpa.jdbc.schema.DataSourceFactory$DefaultsDataSource.getConnection(DataSourceFactory.java:305)
	at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.connectInternal(JDBCStoreManager.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.


Mime
View raw message